Re: [go-nuts] protojson.

2021-04-12 Thread Robert Dionne
You could either use the deprecated https://pkg.go.dev/github.com/golang/protobuf/jsonpb#UnmarshalNext Or you could use a similar strategy https://github.com/golang/protobuf/blob/v1.5.2/jsonpb/decode.go#L77-L81 paired with https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson#Unmarshal

Re: [go-nuts] Gollvm produces bad LLVM IR

2021-04-12 Thread Khanh TN
Hi, I somewhat figured out how to solve this. Commands from LLVM like *lli*,* llc* for *.ll and *.bc files might work (or might not work) with arbitrary versions of LLVM (sometimes the tip doesnt work). However, the command *llvm-goc* works well so I will stick with llvm-goc. I will ask later if

Re: [go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-12 Thread 'wagner riffel' via golang-nuts
On Mon Apr 12, 2021 at 10:23 AM -03, Xiangdong Ji wrote: > Hi, > > I'm trying to run "go vet -vettool=$(which fieldalignment) ./..." for a > large project, and wish to turn its '-fix' option on, wondering how to > pass > that option? Hi Xiangdong, I found that surprising that even docs didn't ment

[go-nuts] Re: `for i, v := range` causes allocation

2021-04-12 Thread Brian Candler
On Monday, 12 April 2021 at 17:01:38 UTC+1 theluk...@gmail.com wrote: > I've heard several times from members of the community (on Matrix and > possibly on answers) that a simple iteration like > > const mixed = "\b5Ὂg̀9! ℃ᾭG" > for _, c := range mixed { > ... do something with c (but not

[go-nuts] protojson.

2021-04-12 Thread ramsa
Hi, Are there any readme or know examples of the application (sample code) that we can refer to better understand the application of the protojson application. If so can you please share the link, https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson I want to read from a stream o

Re: [go-nuts] Gollvm produces bad LLVM IR

2021-04-12 Thread Khanh TN
Hi, Thanks for your reply. I'm trying to extract the LLVM bitcode from Go code for analysis. I did build from the tip of both LLVM and gollvm. I believe it is LLVM 13 on github. It produced good working binaries. However, the *.ll files produced by -emit-llvm by gollvm gives syntax error when rea

Re: [go-nuts] `for i, v := range` causes allocation

2021-04-12 Thread Luke Wilson
On 4/12/21 11:31 AM, Jan Mercl wrote: I believe no silent allocation and no conversion to a slice of runes occurs. A single instance of variable c, of type rune, exists within the loop. There's no problem with modifying 'c'. A problem exists if the _address_ of 'c' is assumed to point to differen

Re: [go-nuts] `for i, v := range` causes allocation

2021-04-12 Thread Ian Lance Taylor
On Mon, Apr 12, 2021 at 9:01 AM Luke Wilson wrote: > > I've heard several times from members of the community (on Matrix and > possibly on answers) that a simple iteration like > > const mixed = "\b5Ὂg̀9! ℃ᾭG" > for _, c := range mixed { > ... do something with c (but not write to it) > > will ac

Re: [go-nuts] `for i, v := range` causes allocation

2021-04-12 Thread Jan Mercl
On Mon, Apr 12, 2021 at 6:01 PM Luke Wilson wrote: > I've heard several times from members of the community (on Matrix and > possibly on answers) that a simple iteration like > > const mixed = "\b5Ὂg̀9! ℃ᾭG" > for _, c := range mixed { > ... do something with c (but not write to it) > > will act

Re: [go-nuts] Gollvm produces bad LLVM IR

2021-04-12 Thread 'Than McIntosh' via golang-nuts
Hi, At the moment gollvm does not put out releases per se, meaning that really the only thing that is advertised as working is the current LLVM tip plus the current gollvm tip at a given moment in time. If you wanted to create a version of gollvm for an older LLVM release (ex: LLVM 10), you would

[go-nuts] `for i, v := range` causes allocation

2021-04-12 Thread Luke Wilson
I've heard several times from members of the community (on Matrix and possibly on answers) that a simple iteration like const mixed = "\b5Ὂg̀9! ℃ᾭG" for _, c := range mixed { ... do something with c (but not write to it) will actually silently allocate a slice of runes and decode the st

Re: [go-nuts] Gollvm produces bad LLVM IR

2021-04-12 Thread Khanh TN
Hi Than, I'm trying to build gollvm with different versions of llvm: LLVM8, 10, 11 and 13git. It looks like only 13git works. -emit-llvm has some issues. The produced *.ll and *.bc LLVM bitcode can only be opened with some of LLVM versions, and which version is quite random to me. Is there a man

Re: [go-nuts] Re: Give us const arrays please :)

2021-04-12 Thread Henry
Thanks for the information. I did not know that. It's good to learn something new. :) On Monday, April 12, 2021 at 7:17:05 PM UTC+7 wagner riffel wrote: > On Mon Apr 12, 2021 at 5:04 AM -03, Henry wrote: > > The example you gave is actually a map[rune]bool in Go, and not an > > array. I > > It's

[go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-12 Thread Xiangdong Ji
Hi, I'm trying to run "go vet -vettool=$(which fieldalignment) ./..." for a large project, and wish to turn its '-fix' option on, wondering how to pass that option? Any comment is highly appreciated. -- You received this message because you are subscribed to the Google Groups "golang-nuts" g

[go-nuts] no matching versions for query "latest"

2021-04-12 Thread Tom Limoncelli
My go.* files have gotten into a situation where `go list -mod=mod -u -m -json all` gives an error: $ go list -mod=mod -u -m -json all go list -m: loading module retractions for github.com/juju/utils@v0.0.0-20200116185830-d40c2fe10647: no matching versions for query "latest" If I don't run `go mo

Re: [go-nuts] Re: Give us const arrays please :)

2021-04-12 Thread 'wagner riffel' via golang-nuts
On Mon Apr 12, 2021 at 5:04 AM -03, Henry wrote: > The example you gave is actually a map[rune]bool in Go, and not an > array. I It's a Go array in form of a composite literal, see https://golang.org/ref/spec#Composite_literals -- You received this message because you are subscribed to the Googl

[go-nuts] Re: Give us const arrays please :)

2021-04-12 Thread Henry
The example you gave is actually a map[rune]bool in Go, and not an array. I don't think C's array work like that too. I think you are confusing Go with other languages. In addition, arrays are rarely used in Go. Many people prefer using slices. On Monday, April 12, 2021 at 6:33:47 AM UTC+7 vlad