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

Consider updating declared Go version in go.mod #328

Closed
whereswaldon opened this issue Dec 13, 2022 · 1 comment · Fixed by #329
Closed

Consider updating declared Go version in go.mod #328

whereswaldon opened this issue Dec 13, 2022 · 1 comment · Fixed by #329

Comments

@whereswaldon
Copy link
Contributor

The go.mod file declares go 1.15 right now. Module graph pruning was added in Go 1.17, meaning that other modules can import your module and only pick up the transitive dependencies that are actually reachable based on how they use your code. Right now, importing ghw means importing a yaml parser, a unit test framework, and a CLI flag parser because the declared go version predates go 1.17.

The tidiest dependency graph will come from using go 1.18, as:

The go.sum file recorded by go mod tidy for a module by default includes checksums needed by the Go version one below the version specified in its go directive. So a go 1.17 module includes checksums needed for the full module graph loaded by Go 1.16, but a go 1.18 module will include only the checksums needed for the pruned module graph loaded by Go 1.17. The -compat flag can be used to override the default version (for example, to prune the go.sum file more aggressively in a go 1.17 module).

Go 1.18 is also the oldest Go release still supported by the Go team, so it's a reasonable choice of language version to declare.

Thanks for all of your hard work!

@jaypipes
Copy link
Owner

Hi @whereswaldon! :) I'd be happy to update to go1.18. Fancy pushing up a pull request that does this and adding yourself to the list of ghw contribs? :)

whereswaldon added a commit to whereswaldon/ghw that referenced this issue Dec 13, 2022
This updates the go.{mod,sum} files to declare a version of Go that supports
module graph pruning. The change allows consuming projects to avoid picking
up dependencies on modules that ghw only uses for testing or for its CLI.

Fixes jaypipes#328

Signed-off-by: Chris Waldon <[email protected]>
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 a pull request may close this issue.

2 participants