Skip to content

add gomodules support #49

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

Closed
wants to merge 3 commits into from
Closed

add gomodules support #49

wants to merge 3 commits into from

Conversation

mroth
Copy link
Contributor

@mroth mroth commented Dec 20, 2018

Go Modules 📦 have been supported since Go 1.11 as the officially blessed "preliminary support" for dependency management and reproducible builds, and while the writing was on the wall for a while, it seems it's now official that this seems to be the path forward in the Go ecosystem.

This PR adds a standard go module definition for this repository (generated via go mod init and go mod tidy), indicating the current state of the dependency chain. This should simplify things for other people importing this library in their projects (like me!), as well as some other niceness like allowing working outside of GOPATH if desired.

(Note: I'm not 100% certain, but I believe due to semantic versioning requirements any other programs which depend on this will not be able to actually take advantage until there is a tagged git release that includes it, even after it is merged.)

Since travis-ci puts files in a constructed GOPATH by default, it will currently not bother with a detected go.mod (hence the `warning: modules disabled by GO111MODULE=auto in GOPATH/src`) message in install phase output.

This is fine and things still build, but it's more robust to test using the defined modules. This change signals to use modules even when within a GOPATH, so that travis-ci will test with them.
Same as previous commit but for appveyor support.  In this case it looks like the script is manually constructing the GOPATH. Since the appveyor version is currently only testing on stable 1.11, this change will enable the use of gomodules while in the gopath.

(In the future if desired, since it only tests on stable and greater, the appveyor script could be modified to not have a GOPATH at all, and this env variable would not be necessary. But for now, doing the smallest possible change.)
@oschwald oschwald closed this in ae1990f Dec 25, 2019
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.

1 participant