Use absolute import paths in option go_package#23
Merged
Jefftree merged 1 commit intogoogle:mainfrom Nov 19, 2025
Merged
Conversation
This changes `option go_package` to use absolute import paths instead of relative ones. This fixes two seemingly unrelated issues when using this library with Bazel via bazel_gazelle. Example compile errors fixed by this change: ``` ERROR: /home/sloretz/projects/bg_bug/streaming_service/BUILD:13:17: GoCompilePkg streaming_service/streaming_service_go_proto.a failed: (Exit 1): builder failed: error executing GoCompilePkg command (from target //streaming_service:streaming_service_go_proto) bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_go++go_sdk+main___download_0/builder_reset/builder compilepkg -sdk external/rules_go++go_sdk+main___download_0 -goroot ... (remaining 67 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging bazel-out/k8-fastbuild/bin/streaming_service/streaming_service_go_proto_/bg_bug/streaming_service/streaming_service_go_proto/streaming_service.pb.go:10:4: could not import ./openapiv3 (open : no such file or directory) compilepkg: error running subcommand external/rules_go++go_sdk+main___download_0/pkg/tool/linux_amd64/compile: exit status 2 ``` ``` ERROR: /home/sloretz/.cache/bazel/_bazel_sloretz/7f1c610792df1dcd4df92ba962d4dced/external/gazelle++go_deps+com_github_google_gnostic_models/extensions/BUILD.bazel:19:11: GoCompilePkg external/gazelle++go_deps+com_github_google_gnostic_models/extensions/extensions.a [for tool] failed: (Exit 1): builder failed: error executing GoCompilePkg command (from target @@gazelle++go_deps+com_github_google_gnostic_models//extensions:extensions) bazel-out/k8-opt-exec-ST-1be4dcb80a27/bin/external/rules_go++go_sdk+main___download_0/builder_reset/builder compilepkg -sdk external/rules_go++go_sdk+main___download_0 -goroot ... (remaining 29 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging external/gazelle++go_deps+com_github_google_gnostic_models/extensions/extensions.go:40:14: undefined: ExtensionHandlerRequest external/gazelle++go_deps+com_github_google_gnostic_models/extensions/extensions.go:49:15: undefined: ExtensionHandlerResponse compilepkg: error running subcommand external/rules_go++go_sdk+main___download_0/pkg/tool/linux_amd64/compile: exit status 2 Use --verbose_failures to see the command lines of failed build steps. ``` Signed-off-by: Shane Loretz <sloretz@intrinsic.ai>
Jefftree
approved these changes
Nov 19, 2025
Collaborator
Jefftree
left a comment
There was a problem hiding this comment.
Thank you! This follows best practices of using absolute paths
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.
This changes
option go_packageto use absolute import paths instead of relative ones. This fixes two build issues when using this library with Bazel via bazel_gazelle.Example build errors fixed by this change:
I don't know enough about golang to be able to explain why this fixes the issue 🤷