https://github.com/golang/go/issues/30374 seems to be the issue and apparently, there's a workaround:
> The workaround for now is to include at most one `main` package in the `-coverpkg` arguments, or to run coverage in `GOPATH` mode. On Wednesday, February 27, 2019 at 6:01:33 AM UTC-8, Stephane Moreau wrote: > > Hello, > > Just after the new release of go 1.12, I migrated my project to use the > new version. > Every thing went fine so far, all tests and code coverage reports were > generated accruately just like before. > > Once done I activated GO111MODULE option to get rid of the dep dependency > manager we were using before, but now CI fails > > At this point I get an error during my CI process (CI is run within a > docer image golang1.12:alpine3.9) > 2019/02/27 14:15:40 duplicate symbol runtime/debug.modinfo (types 30 and > 30) in <pkg>/cmd/apiserver and $WORK\b593\_pkg_.a(_go_.o) > > I managed to reproduce the very same issue on my windows desktop: > > If I run > go test -count=1 -cover --coverpkg=all ./cache/... > Everything goes fine and I do get the expected results > > If I run > go test -count=1 ./... > I get it working fine too: > ? <pkg>/cache [no test files] > ok <pkg>/cache/memory 0.660s > > > If I run > go test -count=1 -cover --coverpkg=all ./... > I get : > ? <pkg>/cache [no test files] > # <pkg>/cache/memory.test > 2019/02/27 14:31:55 duplicate symbol runtime/debug.modinfo (types 30 and > 30) in <pkg>/cmd/apiserver and > C:\Users\steph\AppData\Local\go-build\5e\5e2f041c975bf4971f8b073ef3a2ceadb95d3c87d8b02241aa6a393d3c5a7632-d(_go_.o) > FAIL <pkg>/cache/memory [build failed] > > Any advice on what I'm doing wrong here ? > > Some more insight on the environment > > go version > go version go1.12 windows/amd64 > > go env > set GOARCH=amd64 > set GOBIN= > set GOCACHE=C:\Users\steph\AppData\Local\go-build > set GOEXE=.exe > set GOFLAGS= > set GOHOSTARCH=amd64 > set GOHOSTOS=windows > set GOOS=windows > set GOPATH=C:\dev\source\catapult/go > set GOPROXY= > set GORACE= > set GOROOT=C:\dev\tools\go1.12 > set GOTMPDIR= > set GOTOOLDIR=C:\dev\tools\go1.12\pkg\tool\windows_amd64 > set GCCGO=gccgo > set CC=gcc > set CXX=g++ > set CGO_ENABLED=1 > set GOMOD=C:\dev\source\catapult\go\src\<pkg>\go.mod > set CGO_CFLAGS=-g -O2 > set CGO_CPPFLAGS= > set CGO_CXXFLAGS=-g -O2 > set CGO_FFLAGS=-g -O2 > set CGO_LDFLAGS=-g -O2 > set PKG_CONFIG=pkg-config > set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 > -fdebug-prefix-map=C:\Users\steph\AppData\Local\Temp\go-build245172374=/tmp/go-build > > -gno-record-gcc-switches > > > modules used : > > module <pkg> > > go 1.12 > > require ( > cloud.google.com/go v0.26.0 > contrib.go.opencensus.io/exporter/stackdriver v0.6.0 // indirect > github.com/BurntSushi/toml v0.3.1 // indirect > github.com/GoogleCloudPlatform/google-cloud-go v0.28.0 > github.com/bcicen/jstream v0.0.0-20190206022353-f306cd3e1fa6 > github.com/bxcodec/faker v2.0.1+incompatible > github.com/elazarl/go-bindata-assetfs v0.0.0-20180223160309-38087fe4dafb > github.com/ghodss/yaml v1.0.0 // indirect > github.com/go-ini/ini v1.41.0 // indirect > github.com/gogo/protobuf v1.1.1 // indirect > github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // > indirect > github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect > github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect > github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect > github.com/google/martian v2.1.0+incompatible // indirect > github.com/googleapis/gax-go v2.0.0+incompatible // indirect > github.com/googleapis/gnostic v0.2.0 // indirect > github.com/gorilla/websocket v1.4.0 > github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // > indirect > github.com/hashicorp/golang-lru v0.5.0 // indirect > github.com/imdario/mergo v0.3.6 // indirect > github.com/inconshreveable/mousetrap v1.0.0 // indirect > github.com/json-iterator/go v1.1.5 // indirect > github.com/kr/fs v0.1.0 // indirect > github.com/lib/pq v1.0.0 > github.com/minio/minio-go v6.0.13+incompatible > github.com/mitchellh/go-homedir v1.0.0 // indirect > github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // > indirect > github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // > indirect > github.com/mongodb/mongo-go-driver v0.0.17 > github.com/nats-io/gnatsd v1.4.1 // indirect > github.com/nats-io/go-nats v1.6.0 > github.com/nats-io/nuid v1.0.0 // indirect > github.com/nimajalali/go-force v0.0.0-20180615191228-2b94c45dfae2 > github.com/peterbourgon/diskv v2.0.1+incompatible // indirect > github.com/pkg/errors v0.8.0 > github.com/pkg/sftp v1.8.3 > github.com/pmezard/go-difflib v1.0.0 // indirect > github.com/rs/xid v1.2.1 // indirect > github.com/rs/zerolog v1.9.1 > github.com/santhosh-tekuri/jsonschema v1.2.2 > github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // > indirect > github.com/spf13/cast v1.2.0 > github.com/spf13/cobra v0.0.3 > github.com/spf13/pflag v1.0.2 > github.com/spf13/viper v1.2.0 > github.com/stretchr/testify v1.2.2 > github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51 // indirect > github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect > github.com/xdg/stringprep v1.0.0 // indirect > github.com/zenazn/goji v0.0.0-20160507202103-64eb34159fe5 // indirect > go.opencensus.io v0.17.0 // indirect > golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b > golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3 // indirect > golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be > golang.org/x/sys v0.0.0-20180920110915-d641721ec2de // indirect > golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect > google.golang.org/api v0.0.0-20180916000451-19ff8768a5c0 > google.golang.org/appengine v1.2.0 // indirect > google.golang.org/genproto v0.0.0-20180918203901-c3f76f3b92d1 // indirect > google.golang.org/grpc v1.15.0 // indirect > gopkg.in/goracle.v2 v2.12.3 > gopkg.in/inf.v0 v0.9.1 // indirect > gopkg.in/ini.v1 v1.42.0 // indirect > k8s.io/api v0.0.0-20180904230853-4e7be11eab3f > k8s.io/apimachinery v0.0.0-20180904193909-def12e63c512 > k8s.io/client-go v8.0.0+incompatible > ) > > -- 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.