Refactor the pkginfo code and fix issue with go_libraries in subrepos #173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was an issue in subrepos created via
go_repo
where we'd include the pkgpath in $PKGDIR. The assumption thatimportPath := filepath.Join(module, pkgDir)
wherepkgDir
is$PKG_DIR
, doesn't hold for this case. We'd end up withgithub.com/owner/module/pkg/src/github.com/owner/pkg/src
as the import path.This PR refactors the code so we have different entry points for
go_library
andgo_module
that are more explicit about these arguments. I have done some spot checking, comparing the results from//third_party/go:std
,//tools/please_go/packageinfo
and///third_party/go/github.com_stretchr_testify//assert
and they all look good. One small thing is we're now returning empty packages for directories that contain only test sources:This is probably harmless but I think the package driver should include test sources somehow. The fact that it doesn't in probably a bug.