aristanetworks / goarista

Fairly general building blocks used in Arista Go code and open-sourced for the benefit of all.
Apache License 2.0
213 stars 68 forks source link

-v flag redefined when using with github.com/golang/glog #76

Closed AfakTolgi closed 1 year ago

AfakTolgi commented 1 year ago

"github.com/aristanetworks/goarista/lanz" import in lanz plugin of telegraf defines the -v flag which is being redefined by "github.com/openconfig/ygot/ygot" causing telegraf to crash

Telegraf debug logs ./telegraf flag redefined: v panic: ./telegraf flag redefined: v

goroutine 1 [running]: flag.(*FlagSet).Var(0xc00013faa0, {0x8998f70, 0xc5ab260}, {0x89556d0, 0x1}, {0x7d8e7bd, 0x14}) /usr/local/go/src/flag/flag.go:982 +0x2f9 flag.Var(...) /usr/local/go/src/flag/flag.go:997 github.com/aristanetworks/glog.init.0() /Users/atolgi/go/pkg/mod/github.com/aristanetworks/glog@v0.0.0-20191112221043-67e8567f59f3/glog_config.go:26 +0x4b

Related Closed telegraf issue

aaronbee commented 1 year ago

You can work around this issue with https://github.com/aristanetworks/glog2glog. To use you would place in your go.mod file:

replace github.com/golang/glog => github.com/aristanetworks/glog2glog v0.0.2

We could also consider removing the glog dependency in the lanz package.

AfakTolgi commented 1 year ago

We are actually not using "github.com/golang/glog" module but it is used by the module "github.com/openconfig/ygot/ygot" which we are using.

aaronbee commented 1 year ago

That's okay. As long as you can modify your program's go.mod file, then you can apply the workaround I described above.

aaronbee commented 1 year ago

The lanz package no long depends on glog, so this issue should be resolved.