[go-nuts] Golang formating of alternate form with zero padding

2024-01-31 Thread Lukas Toral
Hello, I am working on code that formats strings. I have an issue with formatting the alternate form with zero padding of signed hexadecimals. I have a format string like this: "%#07x", I would expect the zero padding to make sure the total width is 7. However, when I format the string using f

[go-nuts] Re: Golang formating of alternate form with zero padding

2024-01-31 Thread 'Brian Candler' via golang-nuts
https://pkg.go.dev/fmt#hdr-Printing The '#' means you want the alternate format with the 0x prepended, and the '7' means you want the number itself padded to 7 digits x := fmt.Sprintf("%07x", 42) // 02a y := fmt.Sprintf("%0#7x", 42) // 0x02a z := fmt.Sprintf("0x%07x", 42) // 0x000

Re: [go-nuts] Re: Passing 2d arrays from Go to C using runtime.Pinner

2024-01-31 Thread peterGo
Michael, Here is a Go solution to the OP's problem. It uses Go memory and Go pointers passed to C in Go memory point to pinned Go memory. https://go.dev/play/p/KLdenIesz1K Peter On Monday, January 29, 2024 at 12:21:18 PM UTC-5 Michael Knyszek wrote: > Thanks for the reproducer. I think I've p

[go-nuts] help with thread limit

2024-01-31 Thread Steve Roth
I am running Go code on a shared web hosting server from a major hosting company. Using cgroups, they limit the number of threads any user can create to 25. Up until a week ago, they had me running on a server with 24 cores, and everything worked fine. Now they've moved me to a new server with 1

Re: [go-nuts] help with thread limit

2024-01-31 Thread Robert Engels
You can use cpuctrl or similar to limit the number of visible cores when you start the process. On Jan 31, 2024, at 8:43 PM, Steve Roth wrote:I am running Go code on a shared web hosting server from a major hosting company.  Using cgroups, they limit the number of threads any user can create to 2

[go-nuts] Re: [External] Differences between unmarshaling with encoding/json and encoding/protojson

2024-01-31 Thread Utkarsh Saxena
Do anyone git solution for this, having same issue? On Thursday, July 21, 2022 at 11:32:32 PM UTC+5:30 Darius Tan wrote: > Hi all, > Is there a comprehensive list of differences between how > json.NewDecoder(r.Body).Decode(&req) and protojson.Unmarshal(req.Bytes(), > pbObj) unmarshals JSON pay