Re: [go-nuts] go run, add string value definition with space

2023-11-13 Thread Tong Sun
Yep, works like a charm. thx! On Mon, Nov 13, 2023 at 4:34 AM Michel Levieux wrote: > Hi! > > Not an expert at all, but it seems the format is > "package-qualified.identifier=value", with value being able to just contain > spaces out of the box, so running: > > go run -ldflags="-X 'main.MyVar=th

Re: [go-nuts] go run, add string value definition with space

2023-11-13 Thread 'Michel Levieux' via golang-nuts
Hi! Not an expert at all, but it seems the format is "package-qualified.identifier=value", with value being able to just contain spaces out of the box, so running: go run -ldflags="-X 'main.MyVar=this is a string'" main.go works for me. Note that for parsing the whole thing correctly, the whole

[go-nuts] go run, add string value definition with space

2023-11-09 Thread Tong Sun
go run command-line-arguments -X definition add string value definition of the form importpath.name=value I used to use this to override my variable values, in the form of go run -ldflags="-X main.var1=val1 main.var2=val2" Now, the new problem is that I need to have space in the strin