Skip to content

cmd/go: provide build tags for architecture environment variables #45454

Closed
@mdempsky

Description

@mdempsky

This proposal is to have cmd/go automatically set build tags when architecture environment variables are specified.

If an architecture option GO[arch]=[option] is enabled, then cmd/go should set the [arch].[option] build tag. For example, if GOARM=6 is enabled, then cmd/go should set the "arm.6" build tag; if GOARM=7 is enabled, then it should set both the "arm.6" and "arm.7" build tags (since GOARM=7 is a superset of GOARM=6).

Precedent: We already set goexperiment.foo for each GOEXPERIMENT=foo option that's set.

Questions:

  • What to do about default flags? Do we need/want to still set "arm.5", even though that's always implied?

  • GOARM uses just "5", "6", "7", but GOPPC64 uses "power8", "power9". Should cmd/go use "ppc64.power9"? Or should it be "ppc64le.power9" for GOARCH=ppc64le?

  • What about hardfloat/sse2 vs softfloat? Is there any reason to provide 386.sse2, or should users just check for !386.softfloat? In fact, since softfloat exists across architectures, maybe a common "softfloat" tag should be used instead or in addition?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions