cmd/doc currently uses go/build.Import to locate and import packages. It should use golang.org/x/tools/go/packages.
This may be a little complicated because cmd/doc supports a number of shorthand formats for specifying the package to display documentation for, so we may not have the full package path. However, go/build has limited support for modules, and we're considering deprecating it eventually. Using go/packages could also simplify cmd/doc, since it wouldn't need code for parsing Go source.
cmd/doc currently uses
go/build.Importto locate and import packages. It should usegolang.org/x/tools/go/packages.This may be a little complicated because cmd/doc supports a number of shorthand formats for specifying the package to display documentation for, so we may not have the full package path. However,
go/buildhas limited support for modules, and we're considering deprecating it eventually. Usinggo/packagescould also simplifycmd/doc, since it wouldn't need code for parsing Go source.