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/go: no way to check staleness of targets built with coverage #57785

Closed
thanm opened this issue Jan 13, 2023 · 1 comment
Closed

cmd/go: no way to check staleness of targets built with coverage #57785

thanm opened this issue Jan 13, 2023 · 1 comment
Assignees
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Jan 13, 2023

What version of Go are you using (go version)?

$ go version
go version devel go1.20-6d34903a85 Fri Jan 13 10:31:21 2023 -0500 linux/amd64

Does this issue reproduce with the latest release?

No.

What operating system and processor architecture are you using (go env)?

Linux/amd64

What did you do?

When I install Go commands (such as cmd/link, cmd/compile) as part of coverage testing scripts (intended to collect coverage for Go itself), I find that I can't use "go list" in the normal way to test for staleness. Example:

$ // Here is a regular install; no problems here.
$ go install cmd/nm
$ go list "-f={{if .Stale}}\tSTALE {{.ImportPath}}: {{.StaleReason}}{{end}}"  cmd/nm
$
$ // Now I install an instrumented "nm"
$ go install -cover cmd/nm
$ go list "-f={{if .Stale}}\tSTALE {{.ImportPath}}: {{.StaleReason}}{{end}}"  cmd/nm
\tSTALE cmd/nm: stale dependency: internal/goarch
$ go list "-f={{if .Stale}}\tSTALE {{.ImportPath}}: {{.StaleReason}}{{end}}" -cover cmd/nm
flag provided but not defined: -cover
usage: go list [-f format] [-json] [-m] [list flags] [build flags] [packages]
Run 'go help list' for details.
$

The problem here is that the "go list" command accepts most build flags (e.g. "-x", "-tags", etc) but does not accept "-cover" and related flags.

This is something of a boutique use case, but I think it is still worth fixing.

@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 13, 2023
@thanm thanm added this to the Go1.20 milestone Jan 13, 2023
@thanm thanm self-assigned this Jan 13, 2023
@bcmills bcmills added the GoCommand cmd/go label Jan 13, 2023
@gopherbot
Copy link

Change https://go.dev/cl/462116 mentions this issue: cmd/go: include coverage build flags for "go list"

@golang golang locked and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants