Re: [go-nuts] flag: bug with shared values?

2020-09-17 Thread Ian Lance Taylor
On Thu, Sep 17, 2020 at 5:04 PM Manfred Touron wrote: > > I think that I discovered a bug in the stdlib flag package: > > sharedFlag := "init-value" > fooFs := flag.NewFlagSet("foo", flag.ContinueOnError) > barFs := flag.NewFlagSet("bar", flag.ContinueOnError) > fooFs.StringVar(&sh

[go-nuts] flag: bug with shared values?

2020-09-17 Thread Manfred Touron
Hi, I think that I discovered a bug in the stdlib flag package: sharedFlag := "init-value" fooFs := flag.NewFlagSet("foo", flag.ContinueOnError) barFs := flag.NewFlagSet("bar", flag.ContinueOnError) fooFs.StringVar(&sharedFlag, "baz", "foo-default", "testing") barFs.StringVar(

[go-nuts] Re: Inject windows manifest into binary built by "go build"

2020-09-17 Thread Alex
ohh, then you can look into *windres* which comes with mingw. It can create a C object file (from a .rc file that then references the manifest) which you then should be able to link into using the apporiate flags through cgo On Friday, 18 September 2020 at 6:19:02 am UTC+8 aro...@gmail.com wrot

[go-nuts] Re: Inject windows manifest into binary built by "go build"

2020-09-17 Thread Augusto Roman
Thanks! I'll look more into that. Unfortunately, we're not building on a windows machine. :-( Might still be able to make something work, though. On Thursday, September 17, 2020 at 9:26:25 AM UTC-6 Alex wrote: > Yeah looks like *mt.exe* would be the most painless method assuming it > works. >

Re: [go-nuts] Catch/handle cgo SIGSEGV

2020-09-17 Thread Ian Lance Taylor
On Thu, Sep 17, 2020 at 12:09 PM Tamás Gulácsi wrote: > > Can you provide some skim of a C-side signal handler that could induce a Go > panic? > All I want is to have an error on Go side, instead of a crash (though it may > be safer to have a crash...). I can't think of any safe way that a C si

Re: [go-nuts] Catch/handle cgo SIGSEGV

2020-09-17 Thread Brian Candler
It's very hard to think of a case where a SIGSEGV in a C program could continue safely. It typically means pointer access out of bounds, which in turn is usually because some data structure has become corrupted. My question is, where is this SEGV coming from? Is this a bug in the Oracle libra

Re: [go-nuts] Catch/handle cgo SIGSEGV

2020-09-17 Thread Tamás Gulácsi
Thanks, absolutely logical. Can you provide some skim of a C-side signal handler that could induce a Go panic? All I want is to have an error on Go side, instead of a crash (though it may be safer to have a crash...). Ian Lance Taylor a következőt írta (2020. szeptember 17., csütörtök, 21:00:5

Re: [go-nuts] Catch/handle cgo SIGSEGV

2020-09-17 Thread Ian Lance Taylor
On Thu, Sep 17, 2020 at 8:52 AM Tamás Gulácsi wrote: > > I'm searching for help in https://github.com/godror/godror/issues/100 - I've > added a recover, called debug.SetPanicOnFault, without success: the extra > free still panics with SIGSEGV, and the recover does not catch it (or I coded > it

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [200917 12:05]: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqual(a, b)) I was guessing he meant: type S []S var a, b S a = S{0: b} b = S{0: a}

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
Aha, you are totally right. I made silly mistake here. ;D On Thursday, September 17, 2020 at 12:05:31 PM UTC-4 axel.wa...@googlemail.com wrote: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqua

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
Aha, you are totally wrong. I made silly mistake here. ;D On Thursday, September 17, 2020 at 12:05:31 PM UTC-4 axel.wa...@googlemail.com wrote: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqual

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread 'Axel Wagner' via golang-nuts
I think you might've intended this, which does indeed print true: type S []S var a, b S a, b = S{0: b}, S{0: a} fmt.Println(reflect.DeepEqual(a, b)) On Thu, Sep 17, 2020 at 6:03 PM Axel Wagner wrote: > I don't think the docs imply that. For one, a[0] is nil, and b[0] isn't. > > On Thu, Sep 17,

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread 'Axel Wagner' via golang-nuts
I don't think the docs imply that. For one, a[0] is nil, and b[0] isn't. On Thu, Sep 17, 2020 at 5:58 PM tapi...@gmail.com wrote: > > package main > > import ( > "fmt" > "reflect" > ) > > func main() { > f() > } > > func f() { > type S []S > var a, b S > a = S{0: b} > b = S{0: a} >

[go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
package main import ( "fmt" "reflect" ) func main() { f() } func f() { type S []S var a, b S a = S{0: b} b = S{0: a} fmt.Println(reflect.DeepEqual(a, b)) } Now it prints false. But it looks the docs indicates it should print true. -- You received this message because you are

[go-nuts] Catch/handle cgo SIGSEGV

2020-09-17 Thread Tamás Gulácsi
I'm searching for help in https://github.com/godror/godror/issues/100 - I've added a recover, called debug.SetPanicOnFault, without success: the extra free still panics with SIGSEGV, and the recover does not catch it (or I coded it wrongly): https://github.com/godror/godror/blob/2dab250ab19e15

[go-nuts] Re: Inject windows manifest into binary built by "go build"

2020-09-17 Thread Alex
Yeah looks like *mt.exe* would be the most painless method assuming it works. On Thursday, 17 September 2020 at 11:14:36 pm UTC+8 aro...@gmail.com wrote: > Thanks for the reply. Yes, I want to override the manifest for a > particular build of the binary. > > I have two modules: > 1. foo.com/rep

[go-nuts] Re: Inject windows manifest into binary built by "go build"

2020-09-17 Thread Augusto Roman
Thanks for the reply. Yes, I want to override the manifest for a particular build of the binary. I have two modules: 1. foo.com/repo1 which contains foo.com/repo1/cmd/the-binary 2. foo.com/repo2 which will build and package the-binary with specific version and manifest information. I'd like to g

Re: [go-nuts] How to use "go/build".ImportDir to get Package struct?

2020-09-17 Thread Paul Jolly
Hi, You want to be using https://pkg.go.dev/golang.org/x/tools/go/packages The docs include an example of how to do this. Thanks, Paul On Thu, 17 Sep 2020 at 12:29, Hein Meling wrote: > > Hi all, > > I'm trying to get info about the package, but the code below returns an empty > build.Packa

[go-nuts] How to use "go/build".ImportDir to get Package struct?

2020-09-17 Thread Hein Meling
Hi all, I'm trying to get info about the package, but the code below returns an empty build.Package struct... Anyone know how to use this API to get a populated Package struct? p, err := build.ImportDir("../paging", build.FindOnly) if err != nil { t.Error(err) } fmt.Println(p) Thanks, :) Hei