go version)?$ go version go version go1.12.5 darwin/amd64
I am not sure (I am 1 patch version away from the latest release)
go env)?go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/joshsamuels/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/joshsamuels/Development/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.5/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.5/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/joshsamuels/Development/go/src/git.repo/team/project/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/23/wcm3x4vj7dq87gfg1lhdjhq40000gn/T/go-build800528247=/tmp/go-build -gno-record-gcc-switches -fno-common"
go get ./... in the project root
I expected to see a list of all my dependencies being downloaded successfully
go get ./...
go: finding github.com/dsnet/compress/bzip2 latest
go: finding github.com/xi2/xz latest
go: finding k8s.io/kubernetes/pkg/kubectl latest
go: finding k8s.io/kubernetes/pkg latest
go: finding github.com/go-openapi/spec v0.17.0
go: finding k8s.io/cli-runtime v0.0.0
go: finding github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9
go: finding github.com/go-openapi/analysis v0.17.0
go: finding k8s.io/kube-aggregator v0.0.0
go: finding k8s.io/kubelet v0.0.0
go: finding k8s.io/kube-proxy v0.0.0
go: finding k8s.io/metrics v0.0.0
go: finding k8s.io/sample-apiserver v0.0.0
go: finding k8s.io/cri-api v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/legacy-cloud-providers v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/apimachinery v0.0.0
go: finding k8s.io/api v0.0.0
go: finding k8s.io/apiserver v0.0.0
go: finding k8s.io/code-generator v0.0.0
go: finding k8s.io/client-go v0.0.0
go: finding golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding github.com/go-openapi/loads v0.17.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/component-base v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/kube-controller-manager v0.0.0
go: finding k8s.io/kube-scheduler v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/cluster-bootstrap v0.0.0
go: finding k8s.io/cloud-provider v0.0.0
go: finding golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/apiextensions-apiserver v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding k8s.io/csi-translation-lib v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: error loading module requirements
go get -v ./...
Fetching https://k8s.io/kubernetes/pkg/kubectl?go-get=1
go: finding github.com/dsnet/compress/bzip2 latest
go: finding github.com/xi2/xz latest
Parsing meta tags from https://k8s.io/kubernetes/pkg/kubectl?go-get=1 (status code 200)
get "k8s.io/kubernetes/pkg/kubectl": found meta tag get.metaImport{Prefix:"k8s.io/kubernetes", VCS:"git", RepoRoot:"https://github.com/kubernetes/kubernetes"} at https://k8s.io/kubernetes/pkg/kubectl?go-get=1
get "k8s.io/kubernetes/pkg/kubectl": verifying non-authoritative meta tag
Fetching https://k8s.io/kubernetes?go-get=1
Parsing meta tags from https://k8s.io/kubernetes?go-get=1 (status code 200)
go: finding k8s.io/kubernetes/pkg/kubectl latest
Fetching https://k8s.io/kubernetes/pkg?go-get=1
Parsing meta tags from https://k8s.io/kubernetes/pkg?go-get=1 (status code 200)
get "k8s.io/kubernetes/pkg": found meta tag get.metaImport{Prefix:"k8s.io/kubernetes", VCS:"git", RepoRoot:"https://github.com/kubernetes/kubernetes"} at https://k8s.io/kubernetes/pkg?go-get=1
get "k8s.io/kubernetes/pkg": verifying non-authoritative meta tag
go: finding k8s.io/kubernetes/pkg latest
Fetching https://k8s.io/kubernetes?go-get=1
Parsing meta tags from https://k8s.io/kubernetes?go-get=1 (status code 200)
get "k8s.io/kubernetes": found meta tag get.metaImport{Prefix:"k8s.io/kubernetes", VCS:"git", RepoRoot:"https://github.com/kubernetes/kubernetes"} at https://k8s.io/kubernetes?go-get=1
Fetching https://k8s.io/kube-aggregator?go-get=1
Fetching https://k8s.io/kube-controller-manager?go-get=1
Fetching https://k8s.io/client-go?go-get=1
go: finding github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277
Fetching https://k8s.io/legacy-cloud-providers?go-get=1
Fetching https://k8s.io/apiserver?go-get=1
Fetching https://k8s.io/metrics?go-get=1
Fetching https://k8s.io/kube-scheduler?go-get=1
Parsing meta tags from https://k8s.io/kube-aggregator?go-get=1 (status code 200)
go: finding github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
get "k8s.io/kube-aggregator": found meta tag get.metaImport{Prefix:"k8s.io/kube-aggregator", VCS:"git", RepoRoot:"https://github.com/kubernetes/kube-aggregator"} at https://k8s.io/kube-aggregator?go-get=1
Parsing meta tags from https://k8s.io/client-go?go-get=1 (status code 200)
go: finding k8s.io/kube-aggregator v0.0.0
get "k8s.io/client-go": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at https://k8s.io/client-go?go-get=1
Parsing meta tags from https://k8s.io/apiserver?go-get=1 (status code 200)
get "k8s.io/apiserver": found meta tag get.metaImport{Prefix:"k8s.io/apiserver", VCS:"git", RepoRoot:"https://github.com/kubernetes/apiserver"} at https://k8s.io/apiserver?go-get=1
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding k8s.io/client-go v0.0.0
Parsing meta tags from https://k8s.io/kube-scheduler?go-get=1 (status code 200)
go: finding k8s.io/apiserver v0.0.0
get "k8s.io/kube-scheduler": found meta tag get.metaImport{Prefix:"k8s.io/kube-scheduler", VCS:"git", RepoRoot:"https://github.com/kubernetes/kube-scheduler"} at https://k8s.io/kube-scheduler?go-get=1
go: finding k8s.io/kube-scheduler v0.0.0
Parsing meta tags from https://k8s.io/legacy-cloud-providers?go-get=1 (status code 200)
get "k8s.io/legacy-cloud-providers": found meta tag get.metaImport{Prefix:"k8s.io/legacy-cloud-providers", VCS:"git", RepoRoot:"https://github.com/kubernetes/legacy-cloud-providers"} at https://k8s.io/legacy-cloud-providers?go-get=1
go: finding k8s.io/legacy-cloud-providers v0.0.0
Parsing meta tags from https://k8s.io/kube-controller-manager?go-get=1 (status code 200)
get "k8s.io/kube-controller-manager": found meta tag get.metaImport{Prefix:"k8s.io/kube-controller-manager", VCS:"git", RepoRoot:"https://github.com/kubernetes/kube-controller-manager"} at https://k8s.io/kube-controller-manager?go-get=1
go: finding k8s.io/kube-controller-manager v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://golang.org/x/net?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/sample-apiserver?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/cluster-bootstrap?go-get=1
Fetching https://k8s.io/component-base?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/apimachinery?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/code-generator?go-get=1
Parsing meta tags from https://k8s.io/metrics?go-get=1 (status code 200)
get "k8s.io/metrics": found meta tag get.metaImport{Prefix:"k8s.io/metrics", VCS:"git", RepoRoot:"https://github.com/kubernetes/metrics"} at https://k8s.io/metrics?go-get=1
go: finding k8s.io/metrics v0.0.0
Parsing meta tags from https://k8s.io/sample-apiserver?go-get=1 (status code 200)
Parsing meta tags from https://k8s.io/component-base?go-get=1 (status code 200)
get "k8s.io/sample-apiserver": found meta tag get.metaImport{Prefix:"k8s.io/sample-apiserver", VCS:"git", RepoRoot:"https://github.com/kubernetes/sample-apiserver"} at https://k8s.io/sample-apiserver?go-get=1
get "k8s.io/component-base": found meta tag get.metaImport{Prefix:"k8s.io/component-base", VCS:"git", RepoRoot:"https://github.com/kubernetes/component-base"} at https://k8s.io/component-base?go-get=1
go: finding k8s.io/component-base v0.0.0
go: finding k8s.io/sample-apiserver v0.0.0
Parsing meta tags from https://k8s.io/cluster-bootstrap?go-get=1 (status code 200)
get "k8s.io/cluster-bootstrap": found meta tag get.metaImport{Prefix:"k8s.io/cluster-bootstrap", VCS:"git", RepoRoot:"https://github.com/kubernetes/cluster-bootstrap"} at https://k8s.io/cluster-bootstrap?go-get=1
go: finding k8s.io/cluster-bootstrap v0.0.0
Parsing meta tags from https://k8s.io/apimachinery?go-get=1 (status code 200)
Parsing meta tags from https://k8s.io/code-generator?go-get=1 (status code 200)
get "k8s.io/code-generator": found meta tag get.metaImport{Prefix:"k8s.io/code-generator", VCS:"git", RepoRoot:"https://github.com/kubernetes/code-generator"} at https://k8s.io/code-generator?go-get=1
get "k8s.io/apimachinery": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at https://k8s.io/apimachinery?go-get=1
go: finding k8s.io/code-generator v0.0.0
go: finding k8s.io/apimachinery v0.0.0
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
get "golang.org/x/net": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net?go-get=1
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/cli-runtime?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/kubelet?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/api?go-get=1
go: k8s.io/[email protected]: unknown revision v0.0.0
Fetching https://k8s.io/csi-translation-lib?go-get=1
Parsing meta tags from https://k8s.io/cli-runtime?go-get=1 (status code 200)
get "k8s.io/cli-runtime": found meta tag get.metaImport{Prefix:"k8s.io/cli-runtime", VCS:"git", RepoRoot:"https://github.com/kubernetes/cli-runtime"} at https://k8s.io/cli-runtime?go-get=1
go: finding k8s.io/cli-runtime v0.0.0
Fetching https://golang.org/x/sync?go-get=1
Parsing meta tags from https://k8s.io/kubelet?go-get=1 (status code 200)
get "k8s.io/kubelet": found meta tag get.metaImport{Prefix:"k8s.io/kubelet", VCS:"git", RepoRoot:"https://github.com/kubernetes/kubelet"} at https://k8s.io/kubelet?go-get=1
go: finding k8s.io/kubelet v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: finding golang.org/x/net v0.0.0-20181201002055-351d144fa1fc
Parsing meta tags from https://k8s.io/api?go-get=1 (status code 200)
get "k8s.io/api": found meta tag get.metaImport{Prefix:"k8s.io/api", VCS:"git", RepoRoot:"https://github.com/kubernetes/api"} at https://k8s.io/api?go-get=1
Parsing meta tags from https://k8s.io/csi-translation-lib?go-get=1 (status code 200)
get "k8s.io/csi-translation-lib": found meta tag get.metaImport{Prefix:"k8s.io/csi-translation-lib", VCS:"git", RepoRoot:"https://github.com/kubernetes/csi-translation-lib"} at https://k8s.io/csi-translation-lib?go-get=1
go: finding k8s.io/csi-translation-lib v0.0.0
go: finding k8s.io/api v0.0.0
Parsing meta tags from https://golang.org/x/sync?go-get=1 (status code 200)
Fetching https://k8s.io/cri-api?go-get=1
get "golang.org/x/sync": found meta tag get.metaImport{Prefix:"golang.org/x/sync", VCS:"git", RepoRoot:"https://go.googlesource.com/sync"} at https://golang.org/x/sync?go-get=1
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
Parsing meta tags from https://k8s.io/cri-api?go-get=1 (status code 200)
get "k8s.io/cri-api": found meta tag get.metaImport{Prefix:"k8s.io/cri-api", VCS:"git", RepoRoot:"https://github.com/kubernetes/cri-api"} at https://k8s.io/cri-api?go-get=1
go: finding k8s.io/cri-api v0.0.0
Fetching https://k8s.io/kube-proxy?go-get=1
Fetching https://k8s.io/apiextensions-apiserver?go-get=1
Fetching https://k8s.io/cloud-provider?go-get=1
Parsing meta tags from https://k8s.io/apiextensions-apiserver?go-get=1 (status code 200)
get "k8s.io/apiextensions-apiserver": found meta tag get.metaImport{Prefix:"k8s.io/apiextensions-apiserver", VCS:"git", RepoRoot:"https://github.com/kubernetes/apiextensions-apiserver"} at https://k8s.io/apiextensions-apiserver?go-get=1
go: finding k8s.io/apiextensions-apiserver v0.0.0
Parsing meta tags from https://k8s.io/kube-proxy?go-get=1 (status code 200)
get "k8s.io/kube-proxy": found meta tag get.metaImport{Prefix:"k8s.io/kube-proxy", VCS:"git", RepoRoot:"https://github.com/kubernetes/kube-proxy"} at https://k8s.io/kube-proxy?go-get=1
go: finding k8s.io/kube-proxy v0.0.0
Parsing meta tags from https://k8s.io/cloud-provider?go-get=1 (status code 200)
get "k8s.io/cloud-provider": found meta tag get.metaImport{Prefix:"k8s.io/cloud-provider", VCS:"git", RepoRoot:"https://github.com/kubernetes/cloud-provider"} at https://k8s.io/cloud-provider?go-get=1
go: finding k8s.io/cloud-provider v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: k8s.io/[email protected]: unknown revision v0.0.0
go: error loading module requirements
The errors such as go: k8s.io/[email protected]: unknown revision v0.0.0 are the more specific errors.
Likely related to https://github.com/golang/go/issues/27173#issuecomment-504807285 and https://github.com/golang/go/issues/27173#issuecomment-505089424.
@thepudds is there a workaround to this issue?
cc @liggitt @sttts
@bcmills @jayconrod
We have replace directives setup for these though: https://github.com/kubernetes/kubernetes/blob/e8738d665b29ca98d39a7907a83ef34dfbb5c5e3/go.mod#L436
Looks like go get doesn't look into replace directives?
Looks like
go getdoesn't look into replace directives?
replace directives in modules other than the main module are ignored when building the main module.
So a module-based consumer of k8s.io/api for example does not use any replace directives found in the go.mod file of k8s.io/api.
From https://golang.org/cmd/go/#hdr-The_main_module_and_the_build_list:
The main module's go.mod file defines the precise set of packages available for use by the go command, through require, replace, and exclude statements. Dependency modules, found by following require statements, also contribute to the definition of that set of packages, but only through their go.mod files' require statements: any replace and exclude statements in dependency modules are ignored. The replace and exclude statements therefore allow the main module complete control over its own build, without also being subject to complete control by dependencies.
k8s.io/kubernetes is not primarily intended to be consumed as a module. Only the published subcomponents are (and go get works properly with those).
If you want to consume k8s.io/kubernetes as a module, you'd probably need to add require directives for matching versions of all of the subcomponents, rather than using go get
@liggitt I am not using kubernetes/kubernetes. I am using client-go
These are some of the ones I am using
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
@joshmsamuels could you try to put together a minimal set of steps to reproduce, ideally starting with an empty module? (E.g., something like cd $(mktemp -d); go mod init tempmod;, etc.)?
@thepudds Should I like make a main.go for that then?
It sounds like the Go command is working as intended, but let's make sure we can reproduce this before closing. @joshmsamuels please do post a minimal example to help us see the same error. A gist or a small repo with a go.mod and a couple .go files would be fine.
As others have pointed out, replace directives are only effective for builds within the module where they appear. So if you check out k8s.io/kubernetes, the replace directives there will work, but not replace directives in other go.mod files.
Kubernetes has a complicated system for managing dependencies, and they have a lot of replace directives. Some of their dependencies are required at version v0.0.0 (which doesn't exist): those requirements must be replaced. This prevents k8s.io/kubernetes from being a requirement of other modules.
However, if you aren't depending on k8s.io/kubernetes, you shouldn't have a problem.
I am not using kubernetes/kubernetes
The "Fetching https://k8s.io/kubernetes/pkg/kubectl" text indicates something in your dependency tree is requiring that repo
@liggitt I missed that one sorry 馃檭
@thepudds Should I like make a main.go for that then?
@joshmsamuels You might or might not need a main.go. Frequently modules-related problems can be recreated without any *.go files in a test module. That said, you can also create a tempmod.go something like:
package tempmod
import (
_ "k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/rest"
_ "k8s.io/client-go/tools/clientcmd"
)
mkdir demo
go mod init demo
main.go
import (
_ "k8s.io/kubernetes/pkg/kubectl"
)
func main() {
}
go get ./...
@liggitt So is there a way to use kubectl in my project? Its been working as expected for the last 2 months
If you want to consume k8s.io/kubernetes as a module, you'd probably need to add require directives for matching versions of all of the subcomponents, rather than using go get
Long-term (next few months), the plan is to publish kubectl in its own repo you could depend on as a normal module
I tried the way you suggested in other issues but go get was overriding the versions I pinned
https://github.com/kubernetes/kubectl/tree/master/pkg/util exists today, and there are a slew of PRs migrating pkg/kubectl to the published repo (like https://github.com/kubernetes/kubernetes/pull/79207) which should get merged in the next week or so.
(this is more kubernetes, than go discussion at this point though)
@nikhita Thanks! I still want a temp solution at the very least.
Youre right about it being more of a kubernetes discussion so maybe we should move this over to https://github.com/kubernetes/kubernetes/issues/79384
Closing in favor of kubernetes/kubernetes#79384
Most helpful comment
k8s.io/kubernetes is not primarily intended to be consumed as a module. Only the published subcomponents are (and go get works properly with those).
If you want to consume k8s.io/kubernetes as a module, you'd probably need to add require directives for matching versions of all of the subcomponents, rather than using go get