Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This uses the new package
golang.org/x/tools/go/packages
instead ofgolang.org/x/tools/go/loader
to load code, so that we can support checking packages that use Go modules with Go >= 1.11. This fixes #8.I'm not sure the change in command line usage breaks anything, though the semantics are changed, because
go/packages
works a bit differently fromgo/loader
. The former now takes a set of files and patterns in order to resolve Go packages. The way I did it,go-sumtype myfile.go
still works, andgo-sumtype ./mypkg/subpkg/...
also works, without having to invokego list
, so this is technically an improvement. If you think this is too magical, it's possible that we could revert to the old behaviour, but I don't think so.I added a
go.mod
file for good measure.