Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Check GOPATH from 'go env GOPATH' when running 'make' #1735

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Check GOPATH from 'go env GOPATH' when running 'make' #1735

wants to merge 3 commits into from

Conversation

jiekang
Copy link
Contributor

@jiekang jiekang commented Oct 31, 2017

When running 'make', the GOPATH environment variable is used to determine if the project is in the correct location. This patch changes this step to also try to determine GOPATH from 'go env GOPATH'.

Addresses #1728

When running 'make', the GOPATH environment variable is used to determine if the project is in the correct location. This patch changes this step to also try to determine GOPATH from 'go env GOPATH'.
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

1 similar comment
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@baijum
Copy link
Contributor

baijum commented Nov 2, 2017

[test]

@baijum baijum requested a review from kwk November 2, 2017 05:16
@baijum
Copy link
Contributor

baijum commented Nov 2, 2017

Looks like there are still few more errors:

$ make
vendor/github.com/goadesign/goa/goagen/goagen app -d github.com/fabric8-services/fabric8-wit/design
invalid plugin package import path: cannot find package "github.com/goadesign/goa/goagen/gen_app" in any of:
        /usr/local/go/src/github.com/goadesign/goa/goagen/gen_app (from $GOROOT)
        ($GOPATH not set. For more details see: 'go help gopath')
make: *** [Makefile:240: app/controllers.go] Error 1

@fabric8cd
Copy link

@jiekang snapshot fabric8-wit image is available for testing. docker pull docker.io/fabric8/fabric8-wit:SNAPSHOT-PR-1735-2

@baijum
Copy link
Contributor

baijum commented Nov 2, 2017

[test]

Copy link
Contributor

@baijum baijum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiekang
Copy link
Contributor Author

jiekang commented Nov 2, 2017

The 'go' tools will assume GOPATH is $HOME/go if not set. This feature is in go 1.8+, not 1.7+. For more info see: golang/go#17262

Applications and libraries do not necessarily make the same assumption, or use 'go env' to determine the GOPATH. In this case, goagen uses os.getEnv("GOPATH") extensively to determine the GOPATH. It's not sane to try to set the GOPATH environment variable for a parent process, and I don't think it's a good idea to patch the f8-wit build to set GOPATH to the value of 'go env GOPATH' prior to running goagen or anything else, 1.8 support notwithstanding. The latest commit in this PR does set GOPATH prior to running goagen, mainly to show what needs to be done. I don't like the solution.

For what it's worth, fabric8-wit does not build without go 1.8+ as one of it's dependencies uses features only available in 1.8+. See: #1736

@fabric8cd
Copy link

@jiekang snapshot fabric8-wit image is available for testing. docker pull docker.io/fabric8/fabric8-wit:SNAPSHOT-PR-1735-3

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 this pull request may close these issues.

None yet

5 participants