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

cmd/cgo: inconsistency between package documentation and actual command line flags #69730

Closed
mark-rushakoff opened this issue Oct 1, 2024 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation Issues describing a change to documentation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mark-rushakoff
Copy link
Contributor

Go version

go1.23 and go tip

Output of go env in your module/workspace:

n/a

What did you do?

Viewed documentation at https://pkg.go.dev/cmd/cgo@master and https://pkg.go.dev/cmd/cgo.

What did you see happen?

In the "Using cgo directly" section, the last flag mentioned is -srcdir, but it doesn't have a description like the rest of the flags:

-V
	Print cgo version and exit.
-debug-define
	Debugging option. Print #defines.
<snip>
-objdir directory
	Put all generated files in directory.
-srcdir directory

(It looks like that truncation happened in 840f2c1).

Running gotip tool cgo -help on my machine, I see different flag descriptions:

...
  -objdir string
    	object directory
  -srcdir string
    	source directory
  -trimpath string
    	applies supplied rewrites or trims prefixes to recorded source file paths

The -trimpath flag isn't in the package documentation, and the package documentation has a better description for -objdir. Some other flags show up in a different order (-import* then -gcc* in package docs, vice versa for CLI); I didn't spend time to exhaustively check which other flags were inconsistent between the actual help output and the package docs.

What did you expect to see?

Same flags in the package docs as from the command line.

@gabyhelp
Copy link

gabyhelp commented Oct 1, 2024

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gopherbot gopherbot added compiler/runtime Issues related to the Go compiler and/or runtime. Documentation Issues describing a change to documentation. labels Oct 1, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/616699 mentions this issue: cmd/cgo: add srcdir & trimpath docs, sort options

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 1, 2024
@mknyszek mknyszek added this to the Backlog milestone Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation Issues describing a change to documentation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants