[go-nuts] Re: json.number in struct

2020-11-01 Thread Brian Candler
Is there a particular reason why you don't just do this? type Product struct { Weight float64 } That should serialize to/from JSON just fine. You can also include metadata about how you want it serialized: type Product struct { Weight float64 `json:"weight,omitempty"` } -- You recei

Re: [go-nuts] Trying to call powershell script from Go

2020-11-01 Thread Uzair Ally
Hi Kurtis, The issue on my end was the same, I had to bypass execution policy for powershell and change script.ps1 to \\script.ps1. Thanks for your help with this, much appreciated! On Thursday, October 29, 2020 at 5:56:32 AM UTC+3 Kurtis Rader wrote: > I ran, in an interactive administrative

Re: [go-nuts] Does GOMAXPROCS(1) means run a program deterministically

2020-11-01 Thread Harald Weidner
Hello, > I find it is tricky to debug a concurrency Go program in multi-core > systems, so I wonder if there is a way to make the program run in > deterministically. Can I assume a program with GOMAXPROCS(1) can be > deterministically > executed ? Even with GOMAXPROCS=1, a Go program is not 100%

[go-nuts] Does GOMAXPROCS(1) means run a program deterministically

2020-11-01 Thread Ting Yuan
I find it is tricky to debug a concurrency Go program in multi-core systems, so I wonder if there is a way to make the program run in deterministically. Can I assume a program with GOMAXPROCS(1) can be deterministically executed ? Here a deterministic execution means once the input is given,

[go-nuts] Hash Tables Inner Implementation in Go - A story (for normal people)

2020-11-01 Thread Marwan abdel moneim
Hi Guys, I spent a lot of days diving into the implementation of the maps in Go, and wrote this article that makes it easy for other people to understand the implementation better. Thanks very much for *Keith Randa

[go-nuts] json.number in struct

2020-11-01 Thread irvan hendrik
Hi, I have type Product struct { Weight json.Number } func (p Product) GetWeight() float64 { tmp, _ := p.Weight.Float64() return tmp } I would like to be able to call and assign the variable directly. I got the GetWeight() to help me convert from json.Number to float64. How to assign the varia

[go-nuts] Creating your OWN GitHub Action in Go

2020-11-01 Thread Michael Levan
https://www.youtube.com/watch?v=8IgNY8QT3vk -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on t

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread 'Dan Kortschak' via golang-nuts
Ah, it just clicked. You're indirectly using go/packages, which will (unless configured not to), cause changes to the go.mod and go.sum file. This configuration happens for this by adding "-mod=readonly" to packages.Config.BuildFlags (I think). But this isn't exposed via the go/analysis API (the c

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread seank...@gmail.com
you're using the analysis packages which have dependencies on calling the go cmd internally you could try passing readonly via GOFLAGS the fact that your go.mod/go.sum changed means you should reevaluate what you're doing, specifically you have an unversioned/untracked dependency on gorilla/mux

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread ma...@eliasnaur.com
On Sunday, 1 November 2020 at 13:52:34 UTC+1 miki@gmail.com wrote: > I try to change the "go run" command to use "-mod=readonly", didn't help. > Drive-by comment in case you weren't aware: Go 1.16 is switching to -mod=readonly by default. The proposal and links to the implementation are in

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread Miki Tebeka
I try to change the "go run" command to use "-mod=readonly", didn't help. On Sunday, November 1, 2020 at 10:23:07 AM UTC+2 kortschak wrote: > You're using go test, with -mod=readonly, but it's running your code > with go run, without -mod=readonly. > > Either you'll need to unconditionally pass -

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread Amit Saha
> On 1 Nov 2020, at 7:22 pm, 'Dan Kortschak' via golang-nuts > wrote: > > You're using go test, with -mod=readonly, but it's running your code > with go run, without -mod=readonly. > > Either you'll need to unconditionally pass -mod=readonly to go run in > the regression_test.go file, or find

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread 'Dan Kortschak' via golang-nuts
You're using go test, with -mod=readonly, but it's running your code with go run, without -mod=readonly. Either you'll need to unconditionally pass -mod=readonly to go run in the regression_test.go file, or find wether it's been passed to go test and then conditionally pass it to go run. On Sun,

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread Miki Tebeka
I *do* use "go test", see https://github.com/tebeka/recheck/blob/master/regression_test.go On Sunday, November 1, 2020 at 8:43:33 AM UTC+2 amits...@gmail.com wrote: > > > On Sun, 1 Nov 2020, 4:07 pm Miki Tebeka, wrote: > >> Hi, >> >> I wrote a regexp linter (https://github.com/tebeka/recheck) t