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

language/go: several naming convention fixes plus auto-detection #842

Merged

Conversation

jayconrod
Copy link
Contributor

  • For external dependency resolution, if we don't know what naming
    convention the external repository uses (for example, because
    there's no known repository), we'll now use
    goDefaultLibraryNamingConvention. This avoids assuming that
    repositories with build files fetched with http_archive have been
    updated.
  • In migrateNamingConvention, print a warning and avoid renaming if
    there's already a target with the new name.
  • Library, test, and alias actuals are now generated based on import
    path instead of package name.
  • Added unknownNamingConvention, a new zero value.
  • Added detectNamingConvention. It reads the root build file and build
    files in subdirectories one level deep to infer the naming
    convention used if one is not specified in the root build
    file. Defaults to importNamingConvention.
  • Fixed tests.

For #5

* For external dependency resolution, if we don't know what naming
  convention the external repository uses (for example, because
  there's no known repository), we'll now use
  goDefaultLibraryNamingConvention. This avoids assuming that
  repositories with build files fetched with http_archive have been
  updated.
* In migrateNamingConvention, print a warning and avoid renaming if
  there's already a target with the new name.
* Library, test, and alias actuals are now generated based on import
  path instead of package name.
* Added unknownNamingConvention, a new zero value.
* Added detectNamingConvention. It reads the root build file and build
  files in subdirectories one level deep to infer the naming
  convention used if one is not specified in the root build
  file. Defaults to importNamingConvention.
* Fixed tests.

For bazel-contrib#5
@jayconrod
Copy link
Contributor Author

cc @tomlu

I made some progress today, but this isn't quite ready yet. Automatic detection breaks most of the tests, and I still need to fix the integration tests. Will pick it up next week.

Still to do after this (not in this PR):

  • Convert Gazelle repo to new convention.
  • Make sure we can smoothly switch back to the old convention.
  • Test that library targets are deleted after a main package is removed. I think only foo will be removed, not foo_lib.

@jayconrod jayconrod marked this pull request as ready for review August 7, 2020 15:47
@jayconrod jayconrod merged commit cd9d98c into bazel-contrib:go_naming_convention Aug 7, 2020
@jayconrod jayconrod deleted the fix-naming-convention branch August 7, 2020 15:48
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