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

Add Go modules support but keep dep support #255

Merged
merged 11 commits into from
Mar 20, 2019
Merged

Conversation

liamsi
Copy link
Contributor

@liamsi liamsi commented Mar 6, 2019

cc @jackzampolin

 - remove dep artifacts
 - remove traces of dep from make file: go build will handle those for us
 - update circelci config to go1.12
 - do we need to add all those deps to go.sum, too?
- otherwise tests fail (bug in testify) -> deal with this in a separate PR
@liamsi
Copy link
Contributor Author

liamsi commented Mar 6, 2019

Interestingly, some combination of updated dependencies reveals a failing test:
https://circleci.com/gh/tendermint/go-amino/521?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
(can be reproduced locally, there is an error where a panic is expected -> testify let this pass unnoticed ...)

@liamsi
Copy link
Contributor Author

liamsi commented Mar 6, 2019

Meh, I've opened #256
It's probably worth to fix the tests here directly.

@liamsi liamsi marked this pull request as ready for review March 6, 2019 15:08
@liamsi liamsi changed the title WIP: Migrating from dep to Go modules Add Go modules support but keep dep support Mar 6, 2019
@liamsi liamsi mentioned this pull request Mar 6, 2019
Makefile Outdated

# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: build install check_tools get_tools update_tools get_vendor_deps test fmt metalinter metalinter_all
.PHONY: build install check_tools get_tools update_tools test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add lint? why remove fmt?

I am against removing get_vendor_deps. We'll have to change all documentation + developers are forced to learn a new way! Why not just call go modules install or whatever instead of dep ensure?

Copy link
Contributor Author

@liamsi liamsi Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the magic behind go modules is also that you do not need an extra step. go build or go test will fetch all the deps from mod.go / mod.sum for you (for go >= 1.11)... There is go mod vendor but it isn't necessary. Also:

By default, go commands like go build ignore the vendor directory when in module mode.
https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away

I only left Gopkg.toml for projects that do not yet use modules (but dep) and import go-amino (for them nothing changes; but they do not need the make file either).

Maybe, we should update the documentation though?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh.. I don't have to do anything, cool! Then we can drop get_vendor_deps, thanks 🙇

Copy link
Contributor Author

@liamsi liamsi Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add lint? why remove fmt?

Added lint to .PHONY. I thought it might be better to run fmt through lint / golangci-lint. Added fmt to phony.

Makefile Outdated

########################################
### Testing

test:
go test $(shell go list ./... | grep -v vendor)
go test -v $(shell go list ./... | grep -v vendor)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add verbose flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't seeing what exactly was going on with the failing tests. Can revert though.

@liamsi
Copy link
Contributor Author

liamsi commented Mar 20, 2019

Thanks @melekes!

@liamsi liamsi merged commit 87ef78b into develop Mar 20, 2019
@liamsi liamsi deleted the switch_to_gomodules branch March 20, 2019 21:31
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.

2 participants