cobra: Can't go get cli cobra

This was previously reported in #1345 by someone else, but was closed with no comment. It is easily reproducible:

$ docker run -it centos:7 bash
[root@fd7977aec9a1 /]# curl -s https://mirror.go-repo.io/centos/go-repo.repo >/etc/yum.repos.d/go-repo.repo
[root@fd7977aec9a1 /]# yum install -y golang git
[root@fd7977aec9a1 /]# [root@fd7977aec9a1 /]# go version
go version go1.15.8 linux/amd64
[root@fd7977aec9a1 /]# go get -v -u github.com/spf13/cobra/cobra
github.com/spf13/cobra (download)
github.com/mitchellh/go-homedir (download)
github.com/spf13/pflag (download)
github.com/spf13/viper (download)
github.com/fsnotify/fsnotify (download)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
golang.org/x/sys (download)
get "golang.org/x/sys/internal/unsafeheader": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/internal/unsafeheader?go-get=1
get "golang.org/x/sys/internal/unsafeheader": verifying non-authoritative meta tag
github.com/hashicorp/hcl (download)
github.com/agext/levenshtein (download)
github.com/apparentlymart/go-textseg (download)
github.com/mitchellh/go-wordwrap (download)
github.com/zclconf/go-cty (download)
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
golang.org/x/text (download)
get "golang.org/x/text/transform": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text/transform?go-get=1
get "golang.org/x/text/transform": verifying non-authoritative meta tag
cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
	/usr/lib/golang/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
	/root/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)
github.com/magiconair/properties (download)
github.com/mitchellh/mapstructure (download)
github.com/pelletier/go-toml (download)
github.com/spf13/afero (download)
github.com/spf13/cast (download)
github.com/spf13/jwalterweatherman (download)
github.com/subosito/gotenv (download)
get "gopkg.in/ini.v1": found meta tag get.metaImport{Prefix:"gopkg.in/ini.v1", VCS:"git", RepoRoot:"https://gopkg.in/ini.v1"} at //gopkg.in/ini.v1?go-get=1
gopkg.in/ini.v1 (download)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at //gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@cemery-tibco Try lowercase on

export GOMODULE111=on
go get -v -u github.com/spf13/cobra/cobra

Go Get in module mode is deprecated. You’ll need to use something like GO111MODULE=on go install github.com/spf13/cobra/cobra@latest

I had to use go get -u github.com/spf13/cobra@latest

I ran into the same issue, but migrating to Go Modules as described here https://github.com/hashicorp/hcl/issues/449#issuecomment-786338990 helped me

I was unable to install cobra cli as well, with no errors or warnings. It seemed to run to completion but without actually installing the cobra binary.

After going into the actual cobra source code downloaded and trying to manually make it there, there were two things I had to install to get it to work (which came from the make logs):

curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh

and go get -u github.com/kyoh86/richgo

After doing both of those, I was able to just do the cobra install as per the instructions and it worked.

Temp workaround seems to work for me, may be master has the fix?

From a checkout of this repo, run go install -x -v github.com/spf13/cobra/cobra . Binary will be in typical install directory, say, $GOPATH/bin