Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions go/tools/gopackagesdriver/bazel_json_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (b *BazelJSONBuilder) query(ctx context.Context, query string) ([]string, e
return labels, nil
}

func (b *BazelJSONBuilder) Labels(ctx context.Context, requests []string) ([]string, error) {
func (b *BazelJSONBuilder) Labels(ctx context.Context, requests []string, additionalLabels []string) ([]string, error) {
labels, err := b.query(ctx, b.queryFromRequests(requests...))
if err != nil {
return nil, fmt.Errorf("query failed: %w", err)
Expand All @@ -198,8 +198,7 @@ func (b *BazelJSONBuilder) Labels(ctx context.Context, requests []string) ([]str
if len(labels) == 0 {
return nil, fmt.Errorf("found no labels matching the requests")
}

return labels, nil
return append(labels, additionalLabels...), nil
}

func (b *BazelJSONBuilder) Build(ctx context.Context, labels []string, mode packages.LoadMode) ([]string, error) {
Expand Down
3 changes: 2 additions & 1 deletion go/tools/gopackagesdriver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var (
buildWorkingDirectory = os.Getenv("BUILD_WORKING_DIRECTORY")
additionalAspects = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_ADDTL_ASPECTS"))
additionalKinds = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_KINDS"))
additionalLabels = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_ADDTL_LABELS"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's write this out, the abbreviation isn't that commonly used

emptyResponse = &driverResponse{
NotHandled: true,
Compiler: "gc",
Expand Down Expand Up @@ -93,7 +94,7 @@ func run(ctx context.Context, in io.Reader, out io.Writer, args []string) error
return fmt.Errorf("unable to build JSON files: %w", err)
}

labels, err := bazelJsonBuilder.Labels(ctx, queries)
labels, err := bazelJsonBuilder.Labels(ctx, queries, additionalLabels)
if err != nil {
return fmt.Errorf("unable to lookup package: %w", err)
}
Expand Down