Add information how to properly set up checked-out code with GO... env variables
See original GitHub issueMost basic setup with the following steps:
- uses: actions/checkout@v2
...
- uses: actions/setup-go@v2
will fail during dep ensure
or go test ./...
:
/home/runner/work/myproject/myproject is not within a known GOPATH/src
I must admit that with a little bit of searching I couldn’t easily configure it. Currently it starts with empty directories:
/home/runner/go
/home/runner/go/bin
The code after checkout is in:
/home/runner/work/REPOSITORY/REPOSITORY
It would be worth adding some instructions on how to modify the “checkout” step or how to set environment variables or what shell commands to execute to make it all work.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Using Environment Variables in Go | by Wei-Meng Lee
In Windows, you use the set command to view the list of environment variables currently defined. set. If you want to set a...
Read more >Working With Environment Variables in Go | TutorialEdge.net
Using environment variables is an excellent way to simplify a number of different aspects such as handling credentials across various different ...
Read more >How to Write Go Code (with GOPATH)
The command go env GOPATH prints the effective current GOPATH ; it prints the default location if the environment variable is unset. For...
Read more >How to use GitHub Actions environment variables - Snyk
This hands-on article discusses the environment variables available within GitHub Actions and when we should use them.
Read more >Use Environment Variable in your next Golang Project
Just add the code at the end of the os package in the main function. Viper Package. Viper is one of the most...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got it to work with this yml:
The key was to set this: “working-directory: ${{ env.GOPATH }}/src/myproject” and be consistent. An equivalent of Travis’s
go_import_path
is to definepath: ${{ env.GOPATH }}/src/myproject
for checkout andworking-directory
my problem turned out to be unique for the codebase in question https://github.com/kubernetes/kube-openapi/issues/225