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

Setup Go module #34

Merged
merged 4 commits into from
Jun 9, 2021
Merged

Setup Go module #34

merged 4 commits into from
Jun 9, 2021

Conversation

gregtyler
Copy link
Contributor

@gregtyler gregtyler commented Mar 8, 2021

Purpose

Since Go 1.16, modules are enabled by default and the loose getcreds.go script doesn't work. (There's a workaround involving disabling modules, but that's not good long term.)

Approach

This change adds a go.mod and go.sum file to initialise the module. As Go cannot run scripts form outside the module's root directory, the PR also changes the documentation and automation scripts to cd properly.

Learning

Took a bit of digging to initially identify why the script wasn't working any more. To disable the must-be-a-module rule, you can use go env -w GO111MODULE=on. But note that this is a permanent non-scoped change, so make sure to switch it back to avoid problems in other Go code.

Checklist

  • I have performed a self-review of my own code
  • I have added relevant logging with appropriate levels to my code
    • N/A
  • I have updated documentation where relevant
  • I have added tests to prove my work
    • N/A
  • I have run the integration tests (results below)

@gregtyler gregtyler marked this pull request as draft March 8, 2021 09:59
@gregtyler gregtyler changed the title Fix go module Setup Go module Mar 8, 2021
Using `go mod init` to setup and `go get` to install dependencies
You now need to run Go from inside its directory, so change `build.sh` to do that and also update the manual instructions
@gregtyler gregtyler marked this pull request as ready for review March 8, 2021 10:44
@cooperaj
Copy link
Contributor

Works for me. I've had to use it as I reset my env.

@gregtyler
Copy link
Contributor Author

@cooperaj Are you okay to approve this?

@jamesrwarren jamesrwarren merged commit c3345d4 into master Jun 9, 2021
@TomTucka TomTucka deleted the fix-go-module branch August 9, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants