Skip to content

go_binary: support build constraints via build_setting #1351

@justinsb

Description

@justinsb

I have a library which requires custom build tags to build it (because there are two modes of operation, and we switch between them using build tags).

Specifically, if building from make I need to do this:

go build -o $@ -tags 'peer_name_alternative peer_name_hash' k8s.io/kops/protokube/cmd/protokube

When I try what I believe to be the equivalent syntax with bazel the tags appear to be ignored - they aren't visible on the command line with bazel build -s for example, and I get a compilation error that suggests the code was ignored.

I'm adding this to go_library: tags = [ "peer_name_alternative", "peer_name_hash" ], # keep. Actual code is here: https://github.com/kubernetes/kops/pull/4514/files

Is there a different place / way I should be passing the tags?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions