Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO111MODULE=on go get -v github.com/google/ko/cmd/ko failed #175

Open
dove-young opened this issue Jun 17, 2020 · 9 comments
Open

GO111MODULE=on go get -v github.com/google/ko/cmd/ko failed #175

dove-young opened this issue Jun 17, 2020 · 9 comments

Comments

@dove-young
Copy link

@dove-young dove-young commented Jun 17, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.6 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
$ go env
```
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build704158439=/tmp/go-build -gno-record-gcc-switches"
```

What did you do?

GO111MODULE=on go get -v  github.com/google/ko/cmd/ko
go: finding github.com/google/ko/cmd/ko latest
go: finding github.com/google/ko/cmd latest
get "modernc.org/strutil": found meta tag get.metaImport{Prefix:"modernc.org/strutil", VCS:"git", RepoRoot:"https://gitlab.com/cznic/strutil"} at //modernc.org/strutil?go-get=1
get "modernc.org/golex": found meta tag get.metaImport{Prefix:"modernc.org/golex", VCS:"git", RepoRoot:"https://gitlab.com/cznic/golex"} at //modernc.org/golex?go-get=1
get "modernc.org/mathutil": found meta tag get.metaImport{Prefix:"modernc.org/mathutil", VCS:"git", RepoRoot:"https://gitlab.com/cznic/mathutil"} at //modernc.org/mathutil?go-get=1
get "modernc.org/cc": found meta tag get.metaImport{Prefix:"modernc.org/cc", VCS:"git", RepoRoot:"https://gitlab.com/cznic/cc"} at //modernc.org/cc?go-get=1
get "modernc.org/xc": found meta tag get.metaImport{Prefix:"modernc.org/xc", VCS:"git", RepoRoot:"https://gitlab.com/cznic/xc"} at //modernc.org/xc?go-get=1
go get: github.com/google/ko@v0.5.1 requires
        github.com/google/go-containerregistry@v0.0.0-20200310013544-4fe717a9b4cb requires
        k8s.io/code-generator@v0.17.2 requires
        gonum.org/v1/netlib@v0.0.0-20190331212654-76723241ea4e requires
        modernc.org/cc@v1.0.0: reading modernc.org/cc/go.mod at revision v1.0.0: git fetch -f https://gitlab.com/cznic/cc refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/214c7c8b018f9220f253771b1476659b6c905c4196c32b80b07a212616372040: exit status 128:
        error: RPC failed; result=22, HTTP code = 404
        fatal: The remote end hung up unexpectedly

What did you expect to see?

What did you see instead?

@dove-young
Copy link
Author

@dove-young dove-young commented Jun 17, 2020

I can install it without GO111MODULE=on .

@jonjohnsonjr
Copy link
Collaborator

@jonjohnsonjr jonjohnsonjr commented Jun 17, 2020

I think this happens if you try to run this from within an existing go module, since it just adds it to the existing package as a dependency?

I'm not sure if the go command is a great way to install global binaries in a world with go modules.

It looks like that was added so that the version info works even if you're installing via go get: #85

We might just need to add better instructions.

@stanleynguyen
Copy link
Contributor

@stanleynguyen stanleynguyen commented Jun 23, 2020

Seems like a problem with upstream package but I'm getting this when trying to GO111MODULE=on go get from outside of an existing go module

Screenshot 2020-06-23 at 11 28 01 PM

Installation of latest commit (using go get without GOMODULE) is fine though

@matzew
Copy link

@matzew matzew commented Jun 24, 2020

same:

GO111MODULE=on go get github.com/google/ko/cmd/ko
go: found github.com/google/ko/cmd/ko in github.com/google/ko v0.5.1
# github.com/google/go-containerregistry/pkg/v1/daemon
go/pkg/mod/github.com/google/go-containerregistry@v0.0.0-20200310013544-4fe717a9b4cb/pkg/v1/daemon/image.go:115:19: undefined: client.NewClientWithOpts
go/pkg/mod/github.com/google/go-containerregistry@v0.0.0-20200310013544-4fe717a9b4cb/pkg/v1/daemon/image.go:115:44: undefined: client.FromEnv
go/pkg/mod/github.com/google/go-containerregistry@v0.0.0-20200310013544-4fe717a9b4cb/pkg/v1/daemon/write.go:38:14: undefined: client.NewClientWithOpts
go/pkg/mod/github.com/google/go-containerregistry@v0.0.0-20200310013544-4fe717a9b4cb/pkg/v1/daemon/write.go:38:39: undefined: client.FromEnv
# k8s.io/cli-runtime/pkg/resource
go/pkg/mod/k8s.io/cli-runtime@v0.17.3/pkg/resource/scheme.go:64:34: undefined: "k8s.io/apimachinery/pkg/runtime".Identifier
go/pkg/mod/k8s.io/cli-runtime@v0.17.3/pkg/resource/scheme.go:65:44: unstructured.UnstructuredJSONScheme.Identifier undefined (type "k8s.io/apimachinery/pkg/runtime".Codec has no field or method Identifier)
➜  ~ ko version
v0.2.0

@matzew
Copy link

@matzew matzew commented Jun 24, 2020

OK, it worked after doing cd $GOROOT

and than running:

GO111MODULE=on go get github.com/google/ko/cmd/ko

🤷‍♂️

@jinglundong
Copy link

@jinglundong jinglundong commented Jul 15, 2020

Please let me know if this approach works. I fixed a similar installation problem by:

  1. Create and go to a local directory that is not in the GOPATH. (GOPATH can be looked up by go env GOPATH)
  2. GO111MODULE=off go get github.com/google/ko/cmd/ko (It has GO111MODULE=off. The behavior of Go modules differs depending on whether you are developing inside or outside of GOPATH.)
  3. export PATH=$GOPATH/bin:$PATH if not already set.
@aavarghese
Copy link

@aavarghese aavarghese commented Aug 13, 2020

I tried ALL of the suggestions in the previous comments. I still can't get ko installed.

I get -bash: ko: command not found. Any ideas?
My go version is
go version go1.15 darwin/amd64

@stanleynguyen
Copy link
Contributor

@stanleynguyen stanleynguyen commented Aug 14, 2020

I tried ALL of the suggestions in the previous comments. I still can't get ko installed.

I get -bash: ko: command not found. Any ideas?
My go version is
go version go1.15 darwin/amd64

@aavarghese Is $GOPATH/bin inside your $PATH?

@aavarghese
Copy link

@aavarghese aavarghese commented Aug 14, 2020

@stanleynguyen thanks for the response. So finally fixed it yesterday. My $PATH had $GOPATH/bin, but my issues was that my $GOBIN was set to the wrong directory (which wasn't in $PATH). KO works for me after fixing that env var.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.