go version)?$ go version go version go1.13.3 darwin/amd64
yes
go env)?go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mikefarah/Library/Caches/go-build"
GOENV="/Users/mikefarah/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mikefarah/dev/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mikefarah/dev/go/src/github.com/mikefarah/yq/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/bl/gjnr232n04ddh2kqnkg8q_nh0000gn/T/go-build615949050=/tmp/go-build -gno-record-gcc-switches -fno-common"
go list -m --versions github.com/mikefarah/yq
v2.4.1 available
v2.4.0 and below
v2.4.1 is an invalid version so the proxy.golang.org couldn't use it.
$ GOPROXY=direct go get github.com/mikefarah/[email protected]
go: finding github.com/mikefarah/yq v2.4.1
go get github.com/mikefarah/[email protected]: github.com/mikefarah/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
This version validation rule is new in go1.13 (https://golang.org/doc/go1.13#modules Version validation).
Will see the same result without proxy.golang.org. (i.e., GOPROXY=direct)
FYI: with go1.14, those v2.x.x+incompatible will be dropped from the list output, and v1.15.0 be the latest one. (See "+incompatible versions" of https://tip.golang.org/doc/go1.14#go-command )
Closing this since it's working as intended.
Sorry - I read that documentation and I don't understand it.
How am I supposed to fix this? I thought we were supposed to use go.mod - but the doco seems to suggest not to use it?
Very confused..
The error message indicates its go.mod file declares the module name module github.com/mikefarah/yq. According to the semantic import versioning convention (https://research.swtch.com/vgo-import), it should be github.com/mikefarah/yq/v2 to be recognized as v2. https://blog.golang.org/v2-go-modules describes how to publish vN (N > 1).
But I am not sure, though, if that's sufficient to completely fix the issue you mentioned.
Have you tried to visit the Gophers' # modules slack channel? I heard a lot of experienced, kind, helpful gophers gather there.
@tbpg @jadekler @bcmills @jayconrod
Updating the module to github.com/mikefarah/yq/v2 worked!
Thanks @hyangah
Most helpful comment
Updating the module to
github.com/mikefarah/yq/v2worked!Thanks @hyangah