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

Refactor the pkginfo code and fix issue with go_libraries in subrepos #173

Closed

Conversation

Tatskaari
Copy link
Contributor

@Tatskaari Tatskaari commented Oct 30, 2023

There was an issue in subrepos created via go_repo where we'd include the pkgpath in $PKGDIR. The assumption that importPath := filepath.Join(module, pkgDir) where pkgDir is $PKG_DIR, doesn't hold for this case. We'd end up with github.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 and go_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:

  {
    "ID": "cmd/api",
    "Name": "main",
    "PkgPath": "cmd/api"
  },

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.

@Tatskaari Tatskaari force-pushed the refactor-package-info-code branch from 4c4485f to 707cf07 Compare October 31, 2023 12:52
@Tatskaari Tatskaari closed this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant