Skip to content

Commit

Permalink
arg(): allow redefining {BUILD,TARGET}{OS,ARCH,VARIANT}
Browse files Browse the repository at this point in the history
Comments based on testing suggest that it's an incompatible mistake to
flag attempts to redefine TARGETOS, TARGETARCH, and TARGETVARIANT, but
it's okay to not allow TARGETPLATFORM to be redefined.  Do the same for
BUILD...

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Jul 22, 2024
1 parent 08d8e17 commit f843e63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dispatchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ func arg(b *Builder, args []string, attributes map[string]bool, flagArgs []strin
// If the stage introduces one of the predefined args, add the
// predefined value to the list of values known in this stage
if value, defined := builtinArgDefaults[name]; defined {
if haveDefault {
if haveDefault && (name == "TARGETPLATFORM" || name == "BUILDPLATFORM") {
return fmt.Errorf("attempted to redefine %q: %w", name, errdefs.ErrInvalidArgument)
}
if b.BuiltinArgDefaults == nil {
Expand Down

0 comments on commit f843e63

Please sign in to comment.