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

Drone: 'make: go: Command not found' #10084

Closed
silverwind opened this issue Jan 31, 2020 · 8 comments · Fixed by #10100
Closed

Drone: 'make: go: Command not found' #10084

silverwind opened this issue Jan 31, 2020 · 8 comments · Fixed by #10100

Comments

@silverwind
Copy link
Member

silverwind commented Jan 31, 2020

https://drone.gitea.io/go-gitea/gitea/20587/1/2

I think this is coming from line GOPATH ?= $(shell $(GO) env GOPATH). Either we need to add go on the pre-build step, set GOPATH only when actually needed or maybe remove GOPATH altogether (assuming the user has set up GOPATH/bin in their PATH)?

cc: @sapk

@sapk
Copy link
Member

sapk commented Feb 1, 2020

In the long time, reference to GOPATH should be removed as we moved to modules.
To do so, we should use module for tools (similar to golang/go#25922 (comment)).
Before doing so we would need to drop vendor (this is a personal choice and not a mandatory step.).
And so wait for go1.14 to be release. (Should be during this month)

In the meantime, if you set GOPATH to something like /dev/null it should not call go to determine GOPATH. (?=)

@silverwind
Copy link
Member Author

silverwind commented Feb 1, 2020

use module for tools

That'd be ideal. It will also bring the benefit of locking down tool versions in go.sum. How would you call a tool from the command line with that method?

@silverwind
Copy link
Member Author

Looks like the issue was introduced very recently in #9751.

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2020

I'm not sure I understand why go would not be found?!

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2020

OK I see. We run the make webpack in an environment that does not have go.

In which case we simply need to change it to:

HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )

ifeq ($(HAS_GO), GO)
	GOPATH ?= $(shell $(GO) env GOPATH)
endif

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2020

We can use a similar formation to protect the rest of the go dependent sections

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2020

@sapk this variable isn't exported it's simply added so that we know where the go tools will be built to etc.

@sapk
Copy link
Member

sapk commented Feb 1, 2020

@zeripath yes I know but we can get ride of call to tools (build in go) to their binary path relative to GOPATH and use module build cache via go run (and version locking via go.sum). The main goal is to be independant of GOPATH defintion and it need to be kept in PATH. This bring benifit by removing a setup step (even if it was needed and setup by everyone before).
But we cannot do it yet relative to oldest supported go version and the solution you suggest is better than the one I propose to set GOPATH to /dev/null.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants