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

Prevent go.mod file pollution with development dependencies #85

Conversation

arcticicestudio
Copy link
Owner

Resolves #82

Previously when installing development dependencies through "mage",
the `go.mod` file was updated to include the installed packages since
this the default behavior of the `go get` command when running in
"module" mode.
To prevent the pollution of the project's Go module definition the
"module" mode has been disabled when installing the dev/build packages.
This is a necessary workaround until the Go toolchain is able to install
packages globally without updating the module file when the `go get`
command is run from within the project root directory.

See golang/go#30515 for more details and
proposed solutions that might be added to Go's build tools in future
versions.

Epic GH-33
GH-82
@arcticicestudio arcticicestudio merged commit 278d08e into epic/gh-33-the-way-to-go Oct 12, 2019
@arcticicestudio arcticicestudio deleted the improvement/gh-82-prevent-go-mod-pollution-dev-deps branch October 12, 2019 11:27
arcticicestudio added a commit that referenced this pull request Oct 12, 2019
The workaround implemented in GH-82 (PR GH-85) worked fine, but due to
the explicitly disabled "module" mode it was not possible to define
pinned dependency versions but only using the normal `go get` behavior
to build the repositories default branch.

A better workaround is to run the `go get` command for development &
build dependencies/packages outside of the project's root directory.
Therefore the `go.mod` file is not in scope for the `go get` command and
is therefore not updated. In order to use pinned versions the
`GO1111MODULE=on` environment variable is explicitly set when running
the `go get` command.

See golang/go#30515 for more details and
proposed solutions that might be added to Go's build tools in future
versions.

Epic GH-33
GH-88
arcticicestudio added a commit that referenced this pull request Oct 12, 2019
The workaround implemented in GH-82 (PR GH-85) worked fine, but due to
the explicitly disabled "module" mode it was not possible to define
pinned dependency versions but only using the normal `go get` behavior
to build the repositories default branch.

A better workaround is to run the `go get` command for development &
build dependencies/packages outside of the project's root directory.
Therefore the `go.mod` file is not in scope for the `go get` command and
is therefore not updated. In order to use pinned versions the
`GO1111MODULE=on` environment variable is explicitly set when running
the `go get` command.

See golang/go#30515 for more details and
proposed solutions that might be added to Go's build tools in future
versions.

Epic GH-33
Resolves GH-88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants