hi,

I've been seeing the following odd behavior in the middle of a larger 
project where glog.V(2).Infof outputs something, while glog.V(2) evaluates 
to false in the line that just follows.

I'm wondering if it has something to do with some optimization (inlining of 
the compiler messing up with runtime.Callers?), or more likely I'm missing 
something obvious.

So in my particular code the following code prints out "HERE: *true*" but 
oddly doesn't panic:

...
glog.V(2).Infof("HERE: %v", glog.V(2))

hmm := bool(glog.V(2))
if hmm {

  log.Panic("blah")

}

...


Curiously if I use the bool variable in some other way, it works as 
expected -- prints out "HERE: true" and then panics.

...
glog.V(2).Infof("HERE: %v", glog.V(2))

hmm := bool(glog.V(2))

_ = &hmm
if hmm {

  log.Panic("blah")

}

...



I am running some concurrent stuff (maybe I'm leaking something?), and I'm 
linking in Tensorflow (so maybe conflict on some underlying absl library?). 
But I never change directly anything in glog library, other than by setting 
the flags in the command line.

Also I'm not adding any flags to the go compiler:

$ go version
go version go1.11.2 linux/amd64

Also glog is fresh from github.

Any ideas ?

many thanks in advance :)
Jan

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to