buildGoModule: warn about flags only when using provided buildPhase
Warn about buildFlags and ldflags only when using buildPhase provided by buildGoModule. This allows developers to use buildFlags in custom buildPhase.
This commit is contained in:
@@ -196,7 +196,12 @@ let
|
||||
runHook postConfigure
|
||||
'');
|
||||
|
||||
buildPhase = args.buildPhase or (''
|
||||
buildPhase = args.buildPhase or (
|
||||
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
||||
"Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
|
||||
lib.warnIf (builtins.elem "-buildid=" ldflags)
|
||||
"`-buildid=` is set by default as ldflag by buildGoModule"
|
||||
''
|
||||
runHook preBuild
|
||||
|
||||
exclude='\(/_\|examples\|Godeps\|testdata'
|
||||
@@ -313,9 +318,6 @@ let
|
||||
} // meta;
|
||||
});
|
||||
in
|
||||
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
||||
"Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
|
||||
lib.warnIf (builtins.elem "-buildid=" ldflags) "`-buildid=` is set by default as ldflag by buildGoModule"
|
||||
lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
|
||||
lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
|
||||
package
|
||||
|
||||
Reference in New Issue
Block a user