-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.help wantedmodules
Milestone
Description
What version of Go are you using (go version)?
[user@localhost ~]$ go version go version go1.13 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
[user@localhost ~]$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/home/user/.cache/go-build" GOENV="/home/user/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="*.sc-corp.net" GONOSUMDB="*.sc-corp.net" GOOS="linux" GOPATH="/home/user/go" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/user/.local/share/umake/go/go-lang" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/user/.local/share/umake/go/go-lang/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/tmp/test/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build698062687=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Create the following go.mod file:
module test
go 1.13
require k8s.io/client-go v12.0.0+incompatibleCreate the following main.go file:
package main
import (
"fmt"
"k8s.io/client-go/pkg/version"
)
func main() { fmt.Println(version.Get()) }What did you expect to see?
The toolchain should fail all interactions with k8s.io/client-go because of the combination of the go.mod file at the v12.0.0 tag:
[user@localhost test]$ go get k8s.io/client-go@v12.0.0
go: finding k8s.io v12.0.0
go: finding k8s.io/client-go v12.0.0
go: finding k8s.io/client-go v12.0.0
go get k8s.io/client-go@v12.0.0: k8s.io/client-go@v12.0.0: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v12
[user@localhost test]$ go run .
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required
[user@localhost test]$ go build
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required
[user@localhost test]$ go doc k8s.io/client-go/pkg/version
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is requiredWhat did you see instead?
All parts of the toolchain I tested appear to re-find the problematic module on every invocation, however go get fails (as above), go doc warns, and both go run and go build succeed:
[user@localhost test]$ go run .
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
v0.0.0-master+$Format:%h$
[user@localhost test]$ go build
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
[user@localhost test]$ ./test
v0.0.0-master+$Format:%h$
[user@localhost test]$ go doc k8s.io/client-go/pkg/version
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required
package version // import "k8s.io/client-go/pkg/version"
Package version supplies version information collected at build time to
kubernetes components.
func Get() apimachineryversion.InfoMetadata
Metadata
Assignees
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.help wantedmodules