/ go Public
cmd/go: list includes "C" in the Imports field but not in Deps #60453
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Importsfield, but not in its
Depsfield. 1.20 is the same in this regard:
The docs say:
So I always naively assumed
Importsto be a strict subset of
Deps, since one is the set of direct imports, and the other is the set of all direct and indirect package dependencies (transitive imports). However,
Cbreaks this rule.
Importsshould stop including
C, and here are my reasons why:
Importsis not the list of direct dependencies, compared to the list of all transitive dependencies in
Deps, then how do I get the list of direct dependencies? Right now I'm taking
Cfrom it, which feels hacky.
Cis not truly a Go package nor a useful import path; see how
go list Cfails in a funky way (which arguably could be fixed to give a better error, too).
CgoFilesfield, which is clearer and more directly useful.
Depsnever included it either, so that's some proof that it's not really needed as a package dependency.
The only reason why one could argue that
Cis that there really is an
import "C"in the source code. However,
Importsis not a direct representation of the import declarations in the source code; they are deduplicated, sorted, and omit any renames like
import foo "bar"or
import _ "baz".
The text was updated successfully, but these errors were encountered: