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

Go modules #417

Merged
merged 3 commits into from
Apr 27, 2019
Merged

Go modules #417

merged 3 commits into from
Apr 27, 2019

Conversation

retgits
Copy link
Contributor

@retgits retgits commented Apr 26, 2019

Changes to adopt Go modules

Original GH issue: #406

README

  • Updated readme to reflect the use of modules

Gopkg

  • Removed Gopkg.toml and Gopkg.lock

Go mods

  • Created go.mod and go.sum which replaced Gopkg.toml and Gopkg.lock

Vendor

  • Removed vendor folder
  • Vendor folder could be recreated using go mod vendor

Makefile

  • Added GO111MODULE and GOPROXY variables
  • Updated size target to no longer look at .toml files and vendor folder (because they no longer exist)

Travis CI

GitHub module

Tests run

sudo rm -rf $GOPATH/pkg/mod
make build
# results in a correct wtf executable
sudo rm -rf $GOPATH/pkg/mod
go get ./... && go get github.com/go-test/deep && go test -v github.com/wtfutil/wtf/wtf_tests/...
# results in all tests passing

The sudo rm -rf $GOPATH/pkg/mod makes sure that the local go modules cache is completely gone and we properly test the use of Go modules downloaded from the GoCenter proxy

@retgits retgits mentioned this pull request Apr 26, 2019
@senorprogrammer
Copy link
Collaborator

Awesome. To get this to work I first had to do: export GO111MODULE=on.

Currently it fails with the following error:

❯ go build
go: finding github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6
go: finding github.com/alecthomas/chroma v0.6.2
...
go: finding github.com/mattn/go-colorable v0.0.9
verifying github.com/go-ole/[email protected]/go.mod: checksum mismatch
	downloaded: h1:pnvuG7BrDMZ8ifMurTQmxwhQM/odqm9sSqNe5BUI7v4=
	go.sum:     h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=

Thoughts?

@retgits
Copy link
Contributor Author

retgits commented Apr 27, 2019

Good point, should we add to the docs or README that if you want to build from the sources you need to set GO111MODULE=on if you're running the go build command from your $GOPATH? If you're not building the source from within your $GOPATH you shouldn't see that issue.

I've set my GOPROXY to GOPROXY="https://gocenter.io", which makes sure I get the modules from GoCenter as opposed to downloading the sources from GitHub and building the modules locally. I could replicate the behavior by removing the GOPROXY environment variable.

export GOPROXY=""
go build
...
verifying github.com/go-ole/[email protected]/go.mod: checksum mismatch
        downloaded: h1:pnvuG7BrDMZ8ifMurTQmxwhQM/odqm9sSqNe5BUI7v4=
        go.sum:     h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=

and after setting it

export GOPROXY="https://gocenter.io"
go build
# works fine :)

Should I add that as a comment to the README?

@senorprogrammer
Copy link
Collaborator

Ah, I should have thought of that. I do think that should be in the README. I suspect the majority of people will still be building from within the GOPATH, given that that's likely where they'll still be pulling to when updating.

It's building for me now - nice work! I appreciate this quite a bit.

@retgits
Copy link
Contributor Author

retgits commented Apr 27, 2019

Cool! Let me add those two things to the README :)

@retgits
Copy link
Contributor Author

retgits commented Apr 27, 2019

Added both comments to the README

@senorprogrammer senorprogrammer merged commit c579b13 into wtfutil:master Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants