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

x/website: mod tidy -diff flag missing from https://go.dev/ref/mod#go-mod-tidy #69936

Open
bflad opened this issue Oct 18, 2024 · 4 comments
Open
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done. website

Comments

@bflad
Copy link

bflad commented Oct 18, 2024

Go version

go version go1.23.2 darwin/arm64

Output of go env in your module/workspace:

N/A

What did you do?

I happened to know that go mod tidy -diff was added in 1.23 🎉 , but a quick web search for go mod tidy returned https://go.dev/ref/mod#go-mod-tidy, which does not list the new -diff flag. It is correctly shown in cmd/go help text:

$ go mod tidy -help
usage: go mod tidy [-e] [-v] [-x] [-diff] [-go=version] [-compat=version]
Run 'go help mod tidy' for details.
$ go help mod tidy
usage: go mod tidy [-e] [-v] [-x] [-diff] [-go=version] [-compat=version]

Tidy makes sure go.mod matches the source code in the module.
It adds any missing modules necessary to build the current module's
packages and dependencies, and it removes unused modules that
don't provide any relevant packages. It also adds any missing entries
to go.sum and removes any unnecessary ones.

The -v flag causes tidy to print information about removed modules
to standard error.

The -e flag causes tidy to attempt to proceed despite errors
encountered while loading packages.

The -diff flag causes tidy not to modify go.mod or go.sum but
instead print the necessary changes as a unified diff. It exits
with a non-zero code if the diff is not empty.

The -go flag causes tidy to update the 'go' directive in the go.mod
file to the given version, which may change which module dependencies
are retained as explicit requirements in the go.mod file.
(Go versions 1.17 and higher retain more requirements in order to
support lazy module loading.)

The -compat flag preserves any additional checksums needed for the
'go' command from the indicated major Go release to successfully load
the module graph, and causes tidy to error out if that version of the
'go' command would load any imported package from a different module
version. By default, tidy acts as if the -compat flag were set to the
version prior to the one indicated by the 'go' directive in the go.mod
file.

The -x flag causes tidy to print the commands download executes.

See https://golang.org/ref/mod#go-mod-tidy for more about 'go mod tidy'.

What did you see happen?

The command help also points to the website, which doesn't list the flag.

What did you expect to see?

-diff flag documentation added on the website. 😄 Apologies if this isn't the correct place to file this sort of issue (was just following the directions at the bottom of https://github.com/golang/website/blob/master/README.md#report-issues--send-patches).

@gopherbot gopherbot added this to the Unreleased milestone Oct 18, 2024
@bflad
Copy link
Author

bflad commented Oct 18, 2024

For what it's worth, looks like the -x flag is also not documented on the website. 👍

The -x flag causes tidy to print the commands download executes.

@prattmic prattmic added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Oct 21, 2024
@shashank-priyadarshi
Copy link

@prattmic can I please take this up?

@ansaba
Copy link

ansaba commented Nov 5, 2024

@shashank-priyadarshi , thank you for helping on it. Let us know when it is ready for review.
cc: @samthanawalla

@findleyr findleyr modified the milestones: Unreleased, website/backlog Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done. website
Projects
None yet
Development

No branches or pull requests

7 participants