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

gorelease cannot be built from source due to missing dependencies #1013

Closed
glaubitz opened this issue Apr 30, 2019 · 18 comments
Closed

gorelease cannot be built from source due to missing dependencies #1013

glaubitz opened this issue Apr 30, 2019 · 18 comments
Labels
docs A problem or enhancement in documentation question Further information is requested
Milestone

Comments

@glaubitz
Copy link

I am currently trying to build goreleaser which is required for aws-iam-authenticator.

Unfortunately, goreleaser is currently not buildable due to some of the dependencies not being installable:

glaubitz@suse-laptop:~> go get github.com/goreleaser/goreleaser       
package github.com/goreleaser/goreleaser
        imports context: unrecognized import path "context"
package github.com/goreleaser/goreleaser
        imports github.com/Masterminds/semver
        imports github.com/apex/log
        imports github.com/pkg/errors
        imports github.com/apex/log/handlers/cli
        imports github.com/fatih/color
        imports github.com/mattn/go-colorable
        imports github.com/mattn/go-isatty
        imports golang.org/x/sys/unix
        imports github.com/aws/aws-sdk-go/aws
        imports github.com/aws/aws-sdk-go/aws/credentials
        imports github.com/aws/aws-sdk-go/aws/credentials/stscreds
        imports github.com/jmespath/go-jmespath
        imports github.com/aws/aws-sdk-go/aws/session
        imports github.com/aws/aws-sdk-go/service/s3
        imports github.com/caarlos0/ctrlc
        imports github.com/campoy/unique
        imports github.com/google/go-github/v25/github
        imports github.com/google/go-github/v25/github
        imports github.com/google/go-github/v25/github: cannot find package "github.com/google/go-github/v25/github" in any of:
        /usr/lib64/go1.4/src/github.com/google/go-github/v25/github (from $GOROOT)
        /home/glaubitz/go/src/github.com/google/go-github/v25/github (from $GOPATH)
package github.com/goreleaser/goreleaser
        imports github.com/Masterminds/semver
        imports github.com/apex/log
        imports github.com/pkg/errors
        imports github.com/apex/log/handlers/cli
        imports github.com/fatih/color
        imports github.com/mattn/go-colorable
        imports github.com/mattn/go-isatty
        imports golang.org/x/sys/unix
        imports github.com/aws/aws-sdk-go/aws
        imports github.com/aws/aws-sdk-go/aws/credentials
        imports github.com/aws/aws-sdk-go/aws/credentials/stscreds
        imports github.com/jmespath/go-jmespath
        imports github.com/aws/aws-sdk-go/aws/session
        imports github.com/aws/aws-sdk-go/service/s3
        imports github.com/caarlos0/ctrlc
        imports github.com/campoy/unique
        imports github.com/google/go-github/v25/github
        imports gopkg.in/yaml.v2
        imports golang.org/x/oauth2
        imports golang.org/x/net/context/ctxhttp
        imports golang.org/x/sync/errgroup
        imports github.com/mattn/go-zglob
        imports github.com/mitchellh/go-homedir
        imports github.com/goreleaser/nfpm
        imports github.com/imdario/mergo
        imports github.com/goreleaser/nfpm/deb
        imports github.com/blakesmith/ar
        imports github.com/goreleaser/nfpm/rpm
        imports github.com/kamilsk/retry/v4
        imports github.com/kamilsk/retry/v4
        imports github.com/kamilsk/retry/v4: cannot find package "github.com/kamilsk/retry/v4" in any of:
        /usr/lib64/go1.4/src/github.com/kamilsk/retry/v4 (from $GOROOT)
        /home/glaubitz/go/src/github.com/kamilsk/retry/v4 (from $GOPATH)
package github.com/goreleaser/goreleaser
        imports github.com/Masterminds/semver
        imports github.com/apex/log
        imports github.com/pkg/errors
        imports github.com/apex/log/handlers/cli
        imports github.com/fatih/color
        imports github.com/mattn/go-colorable
        imports github.com/mattn/go-isatty
        imports golang.org/x/sys/unix
        imports github.com/aws/aws-sdk-go/aws
        imports github.com/aws/aws-sdk-go/aws/credentials
        imports github.com/aws/aws-sdk-go/aws/credentials/stscreds
        imports github.com/jmespath/go-jmespath
        imports github.com/aws/aws-sdk-go/aws/session
        imports github.com/aws/aws-sdk-go/service/s3
        imports github.com/caarlos0/ctrlc
        imports github.com/campoy/unique
        imports github.com/google/go-github/v25/github
        imports gopkg.in/yaml.v2
        imports golang.org/x/oauth2
        imports golang.org/x/net/context/ctxhttp
        imports golang.org/x/sync/errgroup
        imports github.com/mattn/go-zglob
        imports github.com/mitchellh/go-homedir
        imports github.com/goreleaser/nfpm
        imports github.com/imdario/mergo
        imports github.com/goreleaser/nfpm/deb
        imports github.com/blakesmith/ar
        imports github.com/goreleaser/nfpm/rpm
        imports github.com/kamilsk/retry/v4
        imports github.com/kamilsk/retry/v4/backoff
        imports github.com/kamilsk/retry/v4/backoff
        imports github.com/kamilsk/retry/v4/backoff: cannot find package "github.com/kamilsk/retry/v4/backoff" in any of:
        /usr/lib64/go1.4/src/github.com/kamilsk/retry/v4/backoff (from $GOROOT)
        /home/glaubitz/go/src/github.com/kamilsk/retry/v4/backoff (from $GOPATH)
package github.com/goreleaser/goreleaser
        imports github.com/Masterminds/semver
        imports github.com/apex/log
        imports github.com/pkg/errors
        imports github.com/apex/log/handlers/cli
        imports github.com/fatih/color
        imports github.com/mattn/go-colorable
        imports github.com/mattn/go-isatty
        imports golang.org/x/sys/unix
        imports github.com/aws/aws-sdk-go/aws
        imports github.com/aws/aws-sdk-go/aws/credentials
        imports github.com/aws/aws-sdk-go/aws/credentials/stscreds
        imports github.com/jmespath/go-jmespath
        imports github.com/aws/aws-sdk-go/aws/session
        imports github.com/aws/aws-sdk-go/service/s3
        imports github.com/caarlos0/ctrlc
        imports github.com/campoy/unique
        imports github.com/google/go-github/v25/github
        imports gopkg.in/yaml.v2
        imports golang.org/x/oauth2
        imports golang.org/x/net/context/ctxhttp
        imports golang.org/x/sync/errgroup
        imports github.com/mattn/go-zglob
        imports github.com/mitchellh/go-homedir
        imports github.com/goreleaser/nfpm
        imports github.com/imdario/mergo
        imports github.com/goreleaser/nfpm/deb
        imports github.com/blakesmith/ar
        imports github.com/goreleaser/nfpm/rpm
        imports github.com/kamilsk/retry/v4
        imports github.com/kamilsk/retry/v4/backoff
        imports github.com/kamilsk/retry/v4/strategy
        imports github.com/kamilsk/retry/v4/strategy
        imports github.com/kamilsk/retry/v4/strategy: cannot find package "github.com/kamilsk/retry/v4/strategy" in any of:
        /usr/lib64/go1.4/src/github.com/kamilsk/retry/v4/strategy (from $GOROOT)
        /home/glaubitz/go/src/github.com/kamilsk/retry/v4/strategy (from $GOPATH)
glaubitz@suse-laptop:~>
@caarlos0
Copy link
Member

caarlos0 commented Apr 30, 2019

yeah I don't think this is supported, as it does not use go modules it seems...

please follow one of https://goreleaser.com/install/

thanks!

Deliver Go binaries as fast and easily as possible

@glaubitz
Copy link
Author

glaubitz commented Apr 30, 2019

I'm just seeing this here: https://goreleaser.com/contributing/

The background is that I am packaging aws-iam-authenticator for openSUSE/SLE, so I have to be able to build the packages from source.

Deliver Go binaries as fast and easily as possible

@caarlos0
Copy link
Member

yeah, not that you don't go get, but git clone

make setup does the go get with go modules enabled and etc..

@stale
Copy link

stale bot commented May 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 14, 2019
@glaubitz
Copy link
Author

Not looking at an issue fixes a bug automatically?

@stale stale bot removed the wontfix This will not be worked on label May 14, 2019
@glaubitz
Copy link
Author

And running make setup downloads scripts with curl and pipes them into sh which is a security nightmare:

curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
golangci/golangci-lint info checking GitHub for latest tag
golangci/golangci-lint info found version: 1.16.0 for v1.16.0/linux/amd64
golangci/golangci-lint info installed ./bin/golangci-lint
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh
gohugoio/hugo info checking GitHub for latest tag
gohugoio/hugo info found version: 0.55.5 for v0.55.5/Linux/64bit
gohugoio/hugo info installed ./bin/hugo
go mod download
(...)

@caarlos0
Copy link
Member

well, you can always do the same thing manually...

@glaubitz
Copy link
Author

I'm going to hack my own build system for aws-iam-authenticator now. I cannot use goreleaser for a package that is supposed to be shipped with an enterprise distribution.

@caarlos0
Copy link
Member

that's OK... you could also just use the distributed goreleaser binaries...

@caarlos0
Copy link
Member

FWIW you don't even need all those things if you just want to build goreleaser from source:

cd /tmp
git clone https://github.com/goreleaser/goreleaser
cd goreleaser
go get ./...
go build -o goreleaser .
./goreleaser --version

caarlos0 added a commit that referenced this issue May 14, 2019
@glaubitz
Copy link
Author

I cannot import binaries, everything has to be built from source and without an internet connection.

I don't know of any Linux distribution that allows the import of binaries compiled upstream. This would also cause trouble for other architectures besides x86_64 like ARM, POWER or S390x.

@caarlos0
Copy link
Member

got it, so steps above should work... you just need to clone outside GOPATH or set GO111MODULE=on because it uses go modules, and GO111MODULE defaults to auto, which is on inside GOPATH...

@glaubitz
Copy link
Author

glaubitz commented May 14, 2019

Turns out I don't need goreleaser. I'm just iterating over the list of source files in aws-iam-authenticator and then pipe that into go build, see:

https://build.opensuse.org/package/show/home:glaubitz:branches:Cloud:Tools/aws-iam-authenticator

openSUSE Build Service

@caarlos0 caarlos0 added docs A problem or enhancement in documentation question Further information is requested labels May 14, 2019
@caarlos0
Copy link
Member

ah, makes sense.

ok then, will close this, feel free to comment here if you think its needed.

@timbaileyjones
Copy link

I had to remove goreleaser as a dependency from stelligent/mu due to this exact issue. Mu was failing because the go get for goreleaser command was failing. Like @glaubitz, it turns about that mu didn't need the source for goreleaser, just the binary from the releases site. So I had to update the README to just tell the user to come here and get the latest binary.

@caarlos0 - I really think you should re-open this ticket, because not being able to build from source is a pretty serious problem.

@caarlos0
Copy link
Member

caarlos0 commented Aug 9, 2019

the problem is that goreleaser uses go modules, and go get defaults to go modules being disable.

GO111MODULE=on go get github.com/goreleaser/goreleaser

should work.

FWIW docs specifically say to use the pre-compiled binaries.

Even when goreleaser didn't use go mods, it was using dep, so versions of dependencies were also ignored. In some ways hard failing is better than weird issues due to wrong dependencies versions.

@timbaileyjones
Copy link

Thanks for the response, @caarlos0. I only stumbled on the world of different Go packaging methods this week, so I definitely do not know the topic well yet.

If that all it takes build from source, it would be nice for it to be in the README.md.

Another engineer from Stelligent tookstelligent/mu went through this module transition a few months ago, but I wasn't involved in that work. I learned that GO111MODULE defaults to auto when the source is in GOPATH/src (and when we work on mu locally, that IS the case).

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs A problem or enhancement in documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants