Skip to content

cmd/go: unexpected build failure with modules #29887

Closed
@hoyho

Description

@hoyho

What version of Go are you using (go version)?

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xsky/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xsky/Documents/workspace/gopath"
GOPROXY=""
GORACE=""
GOROOT="/Users/xsky/Documents/program/go"
GOTMPDIR=""
GOTOOLDIR="/Users/xsky/Documents/program/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xsky/Documents/tmp/xsky-csi-mod/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4_/fcwszxr93jzc96dp3pzttx3h0000gn/T/go-build753346766=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

copy a project to a folder outside of my GOPATH

go mod init github.example.com/xsky/xsky-csi
go clean -modcache
go build main.go

What did you expect to see?

build successful

What did you see instead?

build fail with output:

# k8s.io/apiextensions-apiserver/pkg/features
../../workspace/gopath/pkg/mod/k8s.io/apiextensions-apiserver@v0.0.0-20190119024419-80a4532647cb/pkg/features/kube_features.go:52:2: undefined: feature.DefaultMutableFeatureGate

content in go.mod:

module github.xsky.com/xsky/xsky-csi

require (
	github.com/NYTimes/gziphandler v1.0.1 // indirect
	github.com/container-storage-interface/spec v1.0.0
	github.com/coreos/etcd v3.3.11+incompatible // indirect
	github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 // indirect
	github.com/docker/distribution v2.7.1+incompatible // indirect
	github.com/docker/docker v1.13.1 // indirect
	github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
	github.com/emicklei/go-restful v2.8.1+incompatible // indirect
	github.com/emicklei/go-restful-swagger12 v0.0.0-20170926063155-7524189396c6 // indirect
	github.com/evanphx/json-patch v4.1.0+incompatible // indirect
	github.com/go-openapi/spec v0.18.0 // indirect
	github.com/go-openapi/strfmt v0.18.0 // indirect
	github.com/go-openapi/validate v0.18.0 // indirect
	github.com/gogo/protobuf v1.2.0 // indirect
	github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff // indirect
	github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect
	github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
	github.com/googleapis/gnostic v0.2.0 // indirect
	github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
	github.com/hashicorp/golang-lru v0.5.0 // indirect
	github.com/imdario/mergo v0.3.6 // indirect
	github.com/json-iterator/go v1.1.5 // indirect
	github.com/kubernetes-csi/drivers v0.5.0-alpha.0.0.20181129192734-8a7f2d3a4057 //v1.0.2
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.1 // indirect
	github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d // indirect
	github.com/onsi/ginkgo v1.7.0 // indirect
	github.com/onsi/gomega v1.4.3 // indirect
	github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
	github.com/pborman/uuid v1.2.0
	github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
	github.com/prometheus/client_golang v0.9.2 // indirect
	github.com/sirupsen/logrus v1.3.0
	github.com/spf13/afero v1.2.0 // indirect
	github.com/spf13/cobra v0.0.3 // indirect
	github.com/spf13/pflag v1.0.3 // indirect
	golang.org/x/net v0.0.0-20190119204137-ed066c81e75e
	golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c
	golang.org/x/time v0.0.0-20181108054448-85acf8d2951c // indirect
	google.golang.org/grpc v1.18.0
	gopkg.in/inf.v0 v0.9.1 // indirect
	gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
	gopkg.in/yaml.v2 v2.2.2 // indirect
	k8s.io/api v0.0.0-20181221193117-173ce66c1e39 // indirect
	k8s.io/apiextensions-apiserver v0.0.0-20190119024419-80a4532647cb
	k8s.io/apimachinery v0.0.0-20190119020841-d41becfba9ee // indirect
	k8s.io/apiserver v0.0.0-20190111033246-d50e9ac5404f+incompatible // indirect;
	k8s.io/client-go v10.0.0+incompatible // indirect
	k8s.io/cloud-provider v0.0.0-20181221204816-2325825fd8d8 // indirect
	k8s.io/component-base v0.0.0-20190118114819-7b44618cd005 // indirect
	k8s.io/csi-api v0.0.0-20190119024756-9225cacc8063 // indirect
	k8s.io/klog v0.1.0 // indirect
	k8s.io/kube-openapi v0.0.0-20190115222348-ced9eb3070a5 // indirect
	k8s.io/kubernetes v1.13.0 // v1.13.2
	k8s.io/utils v0.0.0-20181221173059-8a16e7dd8fb6
	sigs.k8s.io/yaml v1.1.0 // indirect
)

try to click the link from console error
image

image
I try to trace the dependence of apiserver@v0.0.0-20190111033246-d50e9ac5404f+incompatible/pkg/util/feature/feature_gate.go and found there's function Add()..
image

is the dependence(apiextensions-apiserver@v0.0.0-20190119024419-80a4532647cb) can not find its correct dependence(k8s.io/apiserver/pkg/util/feature)?
what 's the main reason it can not build, and how to solve it?
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions