Ensure go_binary.embed libraries' importpath is main#2135
Conversation
Contributor
Author
|
While this fixes my test case, gazelle is failing to build still for the same reason. Digging. |
jayconrod
reviewed
Jul 12, 2019
Contributor
Author
|
Gotcha. |
Go 1.13 is stricter on the package path passed to go tool compile -p. This means that go_library passed in go_binary.embed fails to declare a main.main function, as they now retain their original import path. Fix that by adding a is_main boolean to the GoLibrary provider, which will tell wether a library is supposed to be a main package; that is, compiled from within a go_binary. Fixes #2133 Signed-off-by: Steeve Morin <steeve@zen.ly>
Contributor
Author
|
Updated the PR to add the |
* Revert change in effective_importpath_importmap. It looks like go_path needs these to stay exactly the same. Instead, adjust importmap in emit_archive. * Also set is_main in go_test and nogo, which create GoLibrary providers without calling new_library. * Minor doc rephrasing.
Collaborator
|
Thanks for working on this. Hope you don't mind that I fixed a couple things and updated the PR directly. My earlier advice on updating |
Contributor
Author
|
No worries! Thank you for amending the PR on a Saturday! |
Contributor
Author
|
I had limited connectivity but I wanted to at least update the PR |
jayconrod
pushed a commit
to jayconrod/bazel-gazelle
that referenced
this pull request
Aug 21, 2019
Necessary to make the go1.13 linker happy. Corresponding change in go_binary: bazel-contrib/rules_go#2135 Also: upgrade to rules_go 0.19.3
jayconrod
pushed a commit
to bazel-contrib/bazel-gazelle
that referenced
this pull request
Aug 21, 2019
Necessary to make the go1.13 linker happy. Corresponding change in go_binary: bazel-contrib/rules_go#2135 Also: upgrade to rules_go 0.19.3
jayconrod
pushed a commit
to jayconrod/bazel-gazelle
that referenced
this pull request
Aug 23, 2019
…b#625) Necessary to make the go1.13 linker happy. Corresponding change in go_binary: bazel-contrib/rules_go#2135 Also: upgrade to rules_go 0.19.3
jayconrod
pushed a commit
to jayconrod/rules_go
that referenced
this pull request
Aug 23, 2019
) Go 1.13 is stricter on the package path passed to go tool compile -p. This means that go_library passed in go_binary.embed fails to declare a main.main function, as they now retain their original import path. Fix that by adding a is_main boolean to the GoLibrary provider, which will tell wether a library is supposed to be a main package; that is, compiled from within a go_binary. Fixes bazel-contrib#2133
yushan26
pushed a commit
to yushan26/rules_go
that referenced
this pull request
Jun 16, 2025
…thon (bazel-contrib#2135) Before this PR the lockfile would become platform dependent when the `requirements` file would have env markers. This was not caught because we do not have MODULE.bazel.lock checked into the `rules_python` repository because the CI is running against many versions and the lock file is different, therefore we would not be able to run with `bazel build --lockfile_mode=error`. With this change we use the label to `BUILD.bazel` which is living next to the `python` symlink and since the `BUILD.bazel` is the same on all platforms, the lockfile will remain the same. Summary * refactor(uv): create a reusable macro for using uv for locking reqs. * test(bzlmod): enable testing the MODULE.bazel.lock breakage across platforms. * test(bzlmod): use a universal requirements file for 3.9. This breaks the CI, because the python interpreter file hash is added to the lock file. * fix(bzlmod): keep the lockfile platform independent when resolving python Fixes bazel-contrib#1105 and bazel-contrib#1868 for real this time. Implements an additional helper for bazel-contrib#1975.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Go 1.13 is now stricter on the package path passed to
go tool compile -p. This means that go_library passed in go_binary.embed
fails to declare a main.main, as they now retain their import path. Fix
this by forcing a importmain=main on go_binary.
Fixes #2133