$ GO111MODULE=on go get -v github.com/mikefarah/yq
github.com/mikefarah/yaml (download)
package github.com/mikefarah/yaml/v2: cannot find package "github.com/mikefarah/yaml/v2" in any of:
/usr/lib/go-1.10/src/github.com/mikefarah/yaml/v2 (from $GOROOT)
/home/rotary/go/src/github.com/mikefarah/yaml/v2 (from $GOPATH)
$ GO11MODULE=on go get -v github.com/mikefarah/yaml/v2
github.com/mikefarah/yaml (download)
package github.com/mikefarah/yaml/v2: cannot find package "github.com/mikefarah/yaml/v2" in any of:
/usr/lib/go-1.10/src/github.com/mikefarah/yaml/v2 (from $GOROOT)
/home/rotary/go/src/github.com/mikefarah/yaml/v2 (from $GOPATH)
We have the same problem
$ go get gopkg.in/mikefarah/yq.v2 130 master
package github.com/mikefarah/yaml/v2: cannot find package "github.com/mikefarah/yaml/v2" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/mikefarah/yaml/v2 (from $GOROOT)
/Users/dlisin/Work/golang-workspace/src/github.com/mikefarah/yaml/v2 (from $GOPATH)
I think the installation procedure has changed - see the change to README.md at https://github.com/mikefarah/yq/commit/8020d4253bfb193edb37b7acfceff3a4a6e525b8.
(Running GO111MODULE=on go get github.com/mikefarah/yq worked for me.)
It does spit out the following warning, but yq seems to work anyway.
go: github.com/mikefarah/yq imports
gopkg.in/mikefarah/yaml.v2: gopkg.in/mikefarah/[email protected]: parsing go.mod:
module declares its path as: gopkg.in/yaml.v2
but was required as: gopkg.in/mikefarah/yaml.v2
@mirw Running GO111MODULE=on go get github.com/mikefarah/yq throws exactly the same error (it is not warning)
Thanks - I hadn't noticed you were running the same command already.
My error message is different, though - you say you see...
$ GO111MODULE=on go get -v github.com/mikefarah/yq
github.com/mikefarah/yaml (download)
package github.com/mikefarah/yaml/v2: cannot find package "github.com/mikefarah/yaml/v2" in any of:
/usr/lib/go-1.10/src/github.com/mikefarah/yaml/v2 (from $GOROOT)
/home/rotary/go/src/github.com/mikefarah/yaml/v2 (from $GOPATH)
...while I see...
$ GO111MODULE=on go get -v github.com/mikefarah/yq
...
go: github.com/mikefarah/yq imports
gopkg.in/mikefarah/yaml.v2: gopkg.in/mikefarah/[email protected]: parsing go.mod:
module declares its path as: gopkg.in/yaml.v2
but was required as: gopkg.in/mikefarah/yaml.v2
Note that my warning is "just" that a module has been imported with a different path from the one it expected, while yours is that it can't find modules at all. Note that I say mine is a warning because, even though I see this message, I can still use yq afterwards.
$ yq -y . <<< '{"hello": "world"}'
hello: world
Which version of golang are you using? I'm using:
$ go version
go version go1.13.3 linux/amd64
@mirw I was previously on go1.10, upgrading to 1.13 seems to have helped. I get the same warning and the package doesn't install, but further than before.
$ go version
go version go1.13.4 linux/amd64
$ GO111MODULE=on go get -v github.com/mikefarah/yq
go: finding github.com/mikefarah/yq v2.4.0+incompatible
go: downloading github.com/mikefarah/yq v2.4.0+incompatible
go: extracting github.com/mikefarah/yq v2.4.0+incompatible
go: finding github.com/pkg/errors v0.8.1
go: downloading github.com/pkg/errors v0.8.1
go: extracting github.com/pkg/errors v0.8.1
go: finding gopkg.in/op/go-logging.v1 latest
go: finding gopkg.in/spf13/cobra.v0 v0.0.3
go: finding gopkg.in/mikefarah/yaml.v2 v2.3.0
go: finding gopkg.in/imdario/mergo.v0 v0.3.8
go: downloading gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
go: downloading gopkg.in/spf13/cobra.v0 v0.0.3
go: downloading gopkg.in/mikefarah/yaml.v2 v2.3.0
go: downloading gopkg.in/imdario/mergo.v0 v0.3.8
go: extracting gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
go: extracting gopkg.in/imdario/mergo.v0 v0.3.8
go: extracting gopkg.in/spf13/cobra.v0 v0.0.3
go: extracting gopkg.in/mikefarah/yaml.v2 v2.3.0
go: github.com/mikefarah/yq imports
gopkg.in/mikefarah/yaml.v2: gopkg.in/mikefarah/[email protected]: parsing go.mod:
module declares its path as: gopkg.in/yaml.v2
but was required as: gopkg.in/mikefarah/yaml.v2
@mirw
When I remove yq and execute go get, I get the following log:
$ GO111MODULE=on go get -v github.com/mikefarah/yq
go: finding gopkg.in/op/go-logging.v1 latest
go: github.com/mikefarah/yq imports
gopkg.in/mikefarah/yaml.v2: gopkg.in/mikefarah/[email protected]: parsing go.mod:
module declares its path as: gopkg.in/yaml.v2
but was required as: gopkg.in/mikefarah/yaml.v2
But this definitely doesn't produce a new yq binary in my case. Are you sure this really compiles?
P.S. when I try GO111MODULE=on go get -v github.com/mikefarah/yq@b6da773ddee10b35d336c20e948d30ea0f34db09 (latest master commit), it works
I tried GO111MODULE=on go get github.com/mikefarah/[email protected] and that worked
I have a feeling it's caching something somewhere....the fixes for 'go get' to work have only gone in recently (version 2.4.1)...
I hit the same problem. : (
I am also facing this problem for some time now.
Any solution for this one?
Out of blue this happens for me
package github.com/mikefarah/yaml/v2: cannot find package "github.com/mikefarah/yaml/v2" in any of:
/home/nizam/Downloads/go1.12.13.linux-amd64/go/src/github.com/mikefarah/yaml/v2 (from $GOROOT)
/home/nizam/go/src/github.com/mikefarah/yaml/v2 (from $GOPATH)
I started a blank VM and I can only get 'go get' to work if I specify the version:
GO111MODULE=on go get github.com/mikefarah/[email protected]
If I leave off the 2.4.1 it complains about yaml/v2
/me scratches head
I've updated the readme but kind of at a loss at why go get wouldn't be downloading the latest version by default?
@mikefarah Did you try raising a ticket as mentioned in the question: I committed a new change (or released a new version) to a repository, why isn't it showing up when I run go get -u or go list -m --versions?
in the FAQ section of https://proxy.golang.org/ ?
Raised an issue - got a response, apparently this is intentional - not sure what the fix is supposed to be...
Fixed! Needed to update the go.module to specify v2 and now you can
GO111MODULE=on go get github.com/mikefarah/yq/v2
Can someone let me know if that works for them?
Fixed! Needed to update the go.module to specify v2 and now you can
GO111MODULE=on go get github.com/mikefarah/yq/v2Can someone let me know if that works for them?
It's working now. Thanks
Ditto, confirming this is also fixed for me now. Thanks!!
yay!
needed to combine Mike's nov comment and goutamtadi, but this worked for me today.
go get github.com/mikefarah/yq/[email protected]
Thanks for the comment and work!
Most helpful comment
I started a blank VM and I can only get 'go get' to work if I specify the version:
If I leave off the 2.4.1 it complains about yaml/v2
/me scratches head
I've updated the readme but kind of at a loss at why go get wouldn't be downloading the latest version by default?