-
Notifications
You must be signed in to change notification settings - Fork 534
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
Setting GO environment variables (GOPATH, GOBIN) #12
Comments
Since its not totally inferable what these should be set to, we leave them unless the user provides a value. What would your expectation be here? |
I would expect to have |
I agree with @lmittmann here - provide sane defaults for Also, it would be really convenient if the source code was placed in |
FWIW, I don't think it's reasonable to expect users to setup a simple Go build that needs to run in the GOPATH in the following way:
|
Ok, have put some more thought into this and I think I agree that we should provide defaults here. Here's my current wip plan:
then
Thoughts? Does that make sense? |
This looks good to me, thanks! Additional comments:
Is there any chance all of these would be provided by default? |
That makes sense, updated my comment accordingly to create these if necessary.
Want to make sure I understand correctly - you're suggesting that we rearrange the directory structure so that it looks like:
I see why this is desirable, but I'm a little hesitant to do something that heavy/of that magnitude - to do that we'd need to move the entire repo and it would be hard to make it completely transparent to the end user what was happening. I'm more inclined to leave that for the user to do in a script step (though maybe we can provide some examples on the Readme). Does that seem reasonable? |
I understand the hesitation - that being said, samples in the readme showing what needs to be done for Thanks! |
I think it's better to keep Let's assume that my kjk/notionapi repo is checked out under If This is probably fine most of the time but I bet that it'll break tests for some people because they didn't expect the checkout to be polluted by artifacts of This also allows relatively easy work-around for people still relying on GOPATH as opposed to modules. Assuming that my When |
Hi guys, I also encountered this problem and I managed to solve it by adding this step. Works on all environments: -
name: Set GOPATH
# temporary fix
# see https://github.com/actions/setup-go/issues/14
run: |
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash |
I modified my fork to add the Few notes:
|
GOPATH is being slowly phased out. I'm adopting this approach for tools like golint via the Go Wiki. Even a matrix build on the past few versions of Go (go 1.11 through go 1.13) could work without GOPATH if using modules. An example in the README of checking out code to the GOPATH would be useful for projects that aren't yet using Go modules, but I don't think GOPATH should be set (to the workspace). Setting GOBIN to $PWD/bin or similar, and adding GOBIN to to the front of the PATH would be handy, though I don't know if it's possible for environment variable changes in setup-go to persist to other steps? I think just including golint in the docs would help people out.
|
Of course people will invariably have opinions about this. |
I don't think setup-go should be setting The same applies to |
I think it would be good GOPATH to be consistent across Go versions. When it's set by default by Go toolchain to If it's not set by default, do set it. Otherwise people will have to do it themselves in scripts as long as they use Go versions that don't set it by default. |
Fair enough, I guess it's fine to set |
I think |
I keep forgetting that the default Windows shell is |
As stipulated in doc:
So maybe this part of code should be changed: https://github.com/actions/setup-go/blob/master/src/installer.ts#L112-L121 |
add action workflow We should keep following actions/setup-go#12 to reduce custom GOPATH configs and PATH adjustments.
GOBIN environment variable not set by default: actions/setup-go#12
I faced with the following tests behaviour: ``` 2021-02-26T09:49:08.2603123Z === RUN TestContractInitAndCompile/provided_non-existent_config 2021-02-26T09:49:08.2604125Z open /tmp/neogo.inittest/testcontract/notexists.yml: no such file or directory 2021-02-26T09:49:08.2613447Z ##[error]/tmp/neogo.inittest/testcontract/main.go:3:8: could not import github.com/nspcc-dev/neo-go/pkg/interop/runtime (cannot find package "github.com/nspcc-dev/neo-go/pkg/interop/runtime" in any of: 2021-02-26T09:49:08.2629992Z /opt/hostedtoolcache/go/1.13.15/x64/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOROOT) 2021-02-26T09:49:08.2631366Z /home/runner/go/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOPATH)) 2021-02-26T09:49:08.2632556Z error while trying to compile smart contract file: couldn't load packages due to errors: testcontract 2021-02-26T09:49:08.2633646Z --- FAIL: TestContractInitAndCompile (0.01s) ``` The test was run on Github Wrokflows using Go 1.13 and it's clear that go cannot find neo-go package because it's missing in $GOPATH (actually it's located under $GITHUB_WORKSPACE and that's the way the Workflow works). The possible solution is to setup workflow like in actions/setup-go#12 (comment), but that looks ugly. So the other solution is implemented: move temporary test contract inside the neo-go repo to be able to compile it with Go 1.13.
I faced with the following tests behaviour: ``` 2021-02-26T09:49:08.2603123Z === RUN TestContractInitAndCompile/provided_non-existent_config 2021-02-26T09:49:08.2604125Z open /tmp/neogo.inittest/testcontract/notexists.yml: no such file or directory 2021-02-26T09:49:08.2613447Z ##[error]/tmp/neogo.inittest/testcontract/main.go:3:8: could not import github.com/nspcc-dev/neo-go/pkg/interop/runtime (cannot find package "github.com/nspcc-dev/neo-go/pkg/interop/runtime" in any of: 2021-02-26T09:49:08.2629992Z /opt/hostedtoolcache/go/1.13.15/x64/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOROOT) 2021-02-26T09:49:08.2631366Z /home/runner/go/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOPATH)) 2021-02-26T09:49:08.2632556Z error while trying to compile smart contract file: couldn't load packages due to errors: testcontract 2021-02-26T09:49:08.2633646Z --- FAIL: TestContractInitAndCompile (0.01s) ``` The test was run on Github Wrokflows using Go 1.13 and it's clear that go cannot find neo-go package because it's missing in $GOPATH (actually it's located under $GITHUB_WORKSPACE and that's the way the Workflow works). The possible solution is to setup workflow like in actions/setup-go#12 (comment), but that looks ugly. So the other solution is implemented: move temporary test contract inside the neo-go repo to be able to compile it with Go 1.13.
I faced with the following tests behaviour: ``` 2021-02-26T09:49:08.2603123Z === RUN TestContractInitAndCompile/provided_non-existent_config 2021-02-26T09:49:08.2604125Z open /tmp/neogo.inittest/testcontract/notexists.yml: no such file or directory 2021-02-26T09:49:08.2613447Z ##[error]/tmp/neogo.inittest/testcontract/main.go:3:8: could not import github.com/nspcc-dev/neo-go/pkg/interop/runtime (cannot find package "github.com/nspcc-dev/neo-go/pkg/interop/runtime" in any of: 2021-02-26T09:49:08.2629992Z /opt/hostedtoolcache/go/1.13.15/x64/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOROOT) 2021-02-26T09:49:08.2631366Z /home/runner/go/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOPATH)) 2021-02-26T09:49:08.2632556Z error while trying to compile smart contract file: couldn't load packages due to errors: testcontract 2021-02-26T09:49:08.2633646Z --- FAIL: TestContractInitAndCompile (0.01s) ``` The test was run on Github Wrokflows using Go 1.13 and it's clear that go cannot find neo-go package because it's missing in $GOPATH (actually it's located under $GITHUB_WORKSPACE and that's the way the Workflow works). The possible solution is to setup workflow like in actions/setup-go#12 (comment), but that looks ugly. So the other solution is implemented: move temporary test contract inside the neo-go repo to be able to compile it with Go 1.13.
I faced with the following tests behaviour: ``` 2021-02-26T09:49:08.2603123Z === RUN TestContractInitAndCompile/provided_non-existent_config 2021-02-26T09:49:08.2604125Z open /tmp/neogo.inittest/testcontract/notexists.yml: no such file or directory 2021-02-26T09:49:08.2613447Z ##[error]/tmp/neogo.inittest/testcontract/main.go:3:8: could not import github.com/nspcc-dev/neo-go/pkg/interop/runtime (cannot find package "github.com/nspcc-dev/neo-go/pkg/interop/runtime" in any of: 2021-02-26T09:49:08.2629992Z /opt/hostedtoolcache/go/1.13.15/x64/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOROOT) 2021-02-26T09:49:08.2631366Z /home/runner/go/src/github.com/nspcc-dev/neo-go/pkg/interop/runtime (from $GOPATH)) 2021-02-26T09:49:08.2632556Z error while trying to compile smart contract file: couldn't load packages due to errors: testcontract 2021-02-26T09:49:08.2633646Z --- FAIL: TestContractInitAndCompile (0.01s) ``` The test was run on Github Wrokflows using Go 1.13 and it's clear that go cannot find neo-go package because it's missing in $GOPATH (actually it's located under $GITHUB_WORKSPACE and that's the way the Workflow works). The possible solution is to setup workflow like in actions/setup-go#12 (comment), but that looks ugly. So the other solution is implemented: move temporary test contract inside the neo-go repo to be able to compile it with Go 1.13.
GOPATH is no longer exported by the actions/setup-go@v2 > actions/setup-go#12 (comment) > goreleaser/goreleaser-action#267 Added to the GoReleaser configuration for GOAPTH externally Signed-off-by: Konstantina Gramatova <[email protected]>
Ref:
setup-go/src/installer.ts
Lines 105 to 115 in 8187235
The text was updated successfully, but these errors were encountered: