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 runHook postConfigure 197 ''); 198 199 - buildPhase = args.buildPhase or ('' 200 runHook preBuild 201 202 exclude='\(/_\|examples\|Godeps\|testdata' ··· 313 } // meta; 314 }); 315 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 lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true" 320 lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS" 321 package
··· 196 runHook postConfigure 197 ''); 198 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 + '' 205 runHook preBuild 206 207 exclude='\(/_\|examples\|Godeps\|testdata' ··· 318 } // meta; 319 }); 320 in 321 lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true" 322 lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS" 323 package