Previously it was not possible to define multiple ldflags, since only
the last definition applies, and there's some quoting issues with
`buildFlagsArray`. With the new `ldflags` argument it's possible to do
this, e.g.
ldflags = drv.ldflags or [] ++ [
"-X main.Version=1.0"
]
can now properly append a flag without clearing all previous ldflags.
this takes care of the following folders in pkgs/development:
* arduino
* chez-modules
* go-packages
* guile-modules
* idris-modules
* perl-modules
* r-modules
* ruby-modules
Go 1.13 slightly changed the behavior GO111MODULE=auto [1], which might
accidentally cause the go command to build the module, for instance in
the checkPhase:
[GO111MODULE=auto] activates the module-aware mode of the go command
whenever the current working directory contains, or is below a
directory containing, a go.mod file — even if the current directory
is within GOPATH/src.
[1] https://golang.org/doc/go1.13#proxy-vars
In Nix, each string has a context that it carries of where it
originated. Some functions like filterAttrs modify the context of its
args when doing comparisons. That is important because we use the
string context of “name” to get where a derivation was defined. This
causes some builtins like unsafeGetAttrPos to report incorrectly that
the string was set in lib/attrsets.nix and reporting that as the
source file. Using removeAttrs avoids this problem.
Fixes#63679
This change moves buildGoPackage from pkgs/development/go-modules to
pkgs/development/go-packages, so we can have buildGoModule at
pkgs/development/go-modules.