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.

+6 -4
+6 -4
pkgs/build-support/go/module.nix
··· 196 196 runHook postConfigure 197 197 ''); 198 198 199 - buildPhase = args.buildPhase or ('' 199 + buildPhase = args.buildPhase or ( 200 + lib.warnIf (buildFlags != "" || buildFlagsArray != "") 201 + "Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`" 202 + lib.warnIf (builtins.elem "-buildid=" ldflags) 203 + "`-buildid=` is set by default as ldflag by buildGoModule" 204 + '' 200 205 runHook preBuild 201 206 202 207 exclude='\(/_\|examples\|Godeps\|testdata' ··· 313 318 } // meta; 314 319 }); 315 320 in 316 - lib.warnIf (buildFlags != "" || buildFlagsArray != "") 317 - "Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`" 318 - lib.warnIf (builtins.elem "-buildid=" ldflags) "`-buildid=` is set by default as ldflag by buildGoModule" 319 321 lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true" 320 322 lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS" 321 323 package