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: Incomplete field of 'go list' output not set if Error is set due to missing go:embed files #43727

Closed
bcmills opened this issue Jan 15, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jan 15, 2021

https://tip.golang.org/cmd/go/#hdr-List_packages_or_modules documents the Package struct emitted by go list as:

type Package struct {
	…
	// Error information
	Incomplete bool            // this package or a dependency has an error
	Error      *PackageError   // error loading package
	DepsErrors []*PackageError // errors loading dependencies
}

To me, that means that p.Error != nil must imply p.Incomplete == true, since p.Error != nil is exactly “this package … has an error”.

However, it appears that the Incomplete field is not currently set when p.Error is set due to a missing go:embed input:

$ go version
go version devel +e125ccd10 Thu Jan 14 22:01:23 2021 +0000 linux/amd64

$ go list -e -f 'Incomplete: {{.Incomplete}}{{"\n"}}Error: {{.Error}}' .
Incomplete: false
Error: main.go:5:12: pattern msg.txt: no matching files found

-- go.mod --
module example.com

go 1.16
-- main.go --
package main

import _ "embed"

//go:embed msg.txt
var msg string

func main() {
	println(msg)
}
@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 15, 2021
@bcmills bcmills added this to the Go1.16 milestone Jan 15, 2021
@bcmills
Copy link
Contributor Author

bcmills commented Jan 15, 2021

CC @jayconrod @matloob

@matloob matloob self-assigned this Jan 15, 2021
@gopherbot
Copy link

Change https://golang.org/cl/284257 mentions this issue: cmd/go: set Incomplete field on go list output if no files match embed

@golang golang locked and limited conversation to collaborators Jan 20, 2022
@rsc rsc unassigned matloob Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants
@bcmills @gopherbot @matloob and others