go_1_14: remove

zowoq 2a23aa28 9adeb2b8

-444
-284
pkgs/development/compilers/go/1.14.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchurl 4 - , tzdata 5 - , iana-etc 6 - , runCommand 7 - , perl 8 - , which 9 - , pkg-config 10 - , patch 11 - , procps 12 - , pcre 13 - , cacert 14 - , Security 15 - , Foundation 16 - , mailcap 17 - , runtimeShell 18 - , buildPackages 19 - , pkgsBuildTarget 20 - , fetchpatch 21 - , callPackage 22 - }: 23 - 24 - let 25 - go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; 26 - 27 - goBootstrap = runCommand "go-bootstrap" { } '' 28 - mkdir $out 29 - cp -rf ${go_bootstrap}/* $out/ 30 - chmod -R u+w $out 31 - find $out -name "*.c" -delete 32 - cp -rf $out/bin/* $out/share/go/bin/ 33 - ''; 34 - 35 - goarch = platform: { 36 - "i686" = "386"; 37 - "x86_64" = "amd64"; 38 - "aarch64" = "arm64"; 39 - "arm" = "arm"; 40 - "armv5tel" = "arm"; 41 - "armv6l" = "arm"; 42 - "armv7l" = "arm"; 43 - "powerpc64le" = "ppc64le"; 44 - "mips" = "mips"; 45 - }.${platform.parsed.cpu.name} or (throw "Unsupported system"); 46 - 47 - # We need a target compiler which is still runnable at build time, 48 - # to handle the cross-building case where build != host == target 49 - targetCC = pkgsBuildTarget.targetPackages.stdenv.cc; 50 - in 51 - 52 - stdenv.mkDerivation rec { 53 - pname = "go"; 54 - version = "1.14.15"; 55 - 56 - src = fetchurl { 57 - url = "https://dl.google.com/go/go${version}.src.tar.gz"; 58 - sha256 = "0jci03f5z09xibbdqg4lnv2k3crhal1phzwr6lc4ajp514i3plby"; 59 - }; 60 - 61 - # perl is used for testing go vet 62 - nativeBuildInputs = [ perl which pkg-config patch procps ]; 63 - buildInputs = [ cacert pcre ] 64 - ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ] 65 - ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; 66 - 67 - depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; 68 - 69 - hardeningDisable = [ "all" ]; 70 - 71 - prePatch = '' 72 - patchShebangs ./ # replace /bin/bash 73 - 74 - # This source produces shell script at run time, 75 - # and thus it is not corrected by patchShebangs. 76 - substituteInPlace misc/cgo/testcarchive/carchive_test.go \ 77 - --replace '#!/usr/bin/env bash' '#!${runtimeShell}' 78 - 79 - # Patch the mimetype database location which is missing on NixOS. 80 - # but also allow static binaries built with NixOS to run outside nix 81 - sed -i 's,\"/etc/mime.types,"${mailcap}/etc/mime.types\"\,\n\t&,' src/mime/type_unix.go 82 - 83 - # Disabling the 'os/http/net' tests (they want files not available in 84 - # chroot builds) 85 - rm src/net/{listen,parse}_test.go 86 - rm src/syscall/exec_linux_test.go 87 - 88 - # !!! substituteInPlace does not seems to be effective. 89 - # The os test wants to read files in an existing path. Just don't let it be /usr/bin. 90 - sed -i 's,/usr/bin,'"`pwd`", src/os/os_test.go 91 - sed -i 's,/bin/pwd,'"`type -P pwd`", src/os/os_test.go 92 - # Disable the unix socket test 93 - sed -i '/TestShutdownUnix/aif true \{ return\; \}' src/net/net_test.go 94 - # Disable the hostname test 95 - sed -i '/TestHostname/aif true \{ return\; \}' src/os/os_test.go 96 - # ParseInLocation fails the test 97 - sed -i '/TestParseInSydney/aif true \{ return\; \}' src/time/format_test.go 98 - # Remove the api check as it never worked 99 - sed -i '/src\/cmd\/api\/run.go/ireturn nil' src/cmd/dist/test.go 100 - # Remove the coverage test as we have removed this utility 101 - sed -i '/TestCoverageWithCgo/aif true \{ return\; \}' src/cmd/go/go_test.go 102 - # Remove the timezone naming test 103 - sed -i '/TestLoadFixed/aif true \{ return\; \}' src/time/time_test.go 104 - # Remove disable setgid test 105 - sed -i '/TestRespectSetgidDir/aif true \{ return\; \}' src/cmd/go/internal/work/build_test.go 106 - # Remove cert tests that conflict with NixOS's cert resolution 107 - sed -i '/TestEnvVars/aif true \{ return\; \}' src/crypto/x509/root_unix_test.go 108 - # TestWritevError hangs sometimes 109 - sed -i '/TestWritevError/aif true \{ return\; \}' src/net/writev_test.go 110 - # TestVariousDeadlines fails sometimes 111 - sed -i '/TestVariousDeadlines/aif true \{ return\; \}' src/net/timeout_test.go 112 - 113 - sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go 114 - sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_unix.go 115 - 116 - # Disable cgo lookup tests not works, they depend on resolver 117 - rm src/net/cgo_unix_test.go 118 - 119 - '' + lib.optionalString stdenv.isLinux '' 120 - # prepend the nix path to the zoneinfo files but also leave the original value for static binaries 121 - # that run outside a nix server 122 - sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go 123 - 124 - '' + lib.optionalString stdenv.isAarch32 '' 125 - echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash 126 - '' + lib.optionalString stdenv.isDarwin '' 127 - substituteInPlace src/race.bash --replace \ 128 - "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true 129 - sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go 130 - sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go 131 - sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go 132 - 133 - sed -i '/TestChdirAndGetwd/aif true \{ return\; \}' src/os/os_test.go 134 - sed -i '/TestCredentialNoSetGroups/aif true \{ return\; \}' src/os/exec/exec_posix_test.go 135 - sed -i '/TestRead0/aif true \{ return\; \}' src/os/os_test.go 136 - sed -i '/TestSystemRoots/aif true \{ return\; \}' src/crypto/x509/root_darwin_test.go 137 - 138 - sed -i '/TestGoInstallRebuildsStalePackagesInOtherGOPATH/aif true \{ return\; \}' src/cmd/go/go_test.go 139 - sed -i '/TestBuildDashIInstallsDependencies/aif true \{ return\; \}' src/cmd/go/go_test.go 140 - 141 - sed -i '/TestDisasmExtld/aif true \{ return\; \}' src/cmd/objdump/objdump_test.go 142 - 143 - sed -i 's/unrecognized/unknown/' src/cmd/link/internal/ld/lib.go 144 - 145 - # TestCurrent fails because Current is not implemented on Darwin 146 - sed -i 's/TestCurrent/testCurrent/g' src/os/user/user_test.go 147 - sed -i 's/TestLookup/testLookup/g' src/os/user/user_test.go 148 - 149 - touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd 150 - ''; 151 - 152 - patches = [ 153 - ./remove-tools-1.11.patch 154 - ./ssl-cert-file-1.13.patch 155 - ./remove-test-pie-1.14.patch 156 - ./creds-test.patch 157 - ./go-1.9-skip-flaky-19608.patch 158 - ./go-1.9-skip-flaky-20072.patch 159 - ./skip-external-network-tests.patch 160 - ./skip-nohup-tests.patch 161 - ./go_no_vendor_checks-1_14.patch 162 - 163 - # support TZ environment variable starting with colon 164 - (fetchpatch { 165 - name = "tz-support-colon.patch"; 166 - url = "https://github.com/golang/go/commit/58fe2cd4022c77946ce4b598cf3e30ccc8367143.patch"; 167 - sha256 = "0vphwiqrm0qykfj3rfayr65qzk22fksg7qkamvaz0lmf6fqvbd2f"; 168 - }) 169 - 170 - # fix rare TestDontCacheBrokenHTTP2Conn failure 171 - (fetchpatch { 172 - url = "https://github.com/golang/go/commit/ea1437a8cdf6bb3c2d2447833a5d06dbd75f7ae4.patch"; 173 - sha256 = "1lyzy4nf8c34a966vw45j3j7hzpvncq2gqspfxffzkyh17xd8sgy"; 174 - }) 175 - ] ++ [ 176 - # breaks under load: https://github.com/golang/go/issues/25628 177 - (if stdenv.isAarch32 178 - then ./skip-test-extra-files-on-aarch32-1.14.patch 179 - else ./skip-test-extra-files-on-386-1.14.patch) 180 - ]; 181 - 182 - postPatch = '' 183 - find . -name '*.orig' -exec rm {} ';' 184 - ''; 185 - 186 - GOOS = stdenv.targetPlatform.parsed.kernel.name; 187 - GOARCH = goarch stdenv.targetPlatform; 188 - # GOHOSTOS/GOHOSTARCH must match the building system, not the host system. 189 - # Go will nevertheless build a for host system that we will copy over in 190 - # the install phase. 191 - GOHOSTOS = stdenv.buildPlatform.parsed.kernel.name; 192 - GOHOSTARCH = goarch stdenv.buildPlatform; 193 - 194 - # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those 195 - # to be different from CC/CXX 196 - CC_FOR_TARGET = 197 - if (stdenv.buildPlatform != stdenv.targetPlatform) then 198 - "${targetCC}/bin/${targetCC.targetPrefix}cc" 199 - else 200 - null; 201 - CXX_FOR_TARGET = 202 - if (stdenv.buildPlatform != stdenv.targetPlatform) then 203 - "${targetCC}/bin/${targetCC.targetPrefix}c++" 204 - else 205 - null; 206 - 207 - GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]); 208 - GO386 = 387; # from Arch: don't assume sse2 on i686 209 - CGO_ENABLED = 1; 210 - # Hopefully avoids test timeouts on Hydra 211 - GO_TEST_TIMEOUT_SCALE = 3; 212 - 213 - # Indicate that we are running on build infrastructure 214 - # Some tests assume things like home directories and users exists 215 - GO_BUILDER_NAME = "nix"; 216 - 217 - GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; 218 - 219 - postConfigure = '' 220 - export GOCACHE=$TMPDIR/go-cache 221 - # this is compiled into the binary 222 - export GOROOT_FINAL=$out/share/go 223 - 224 - export PATH=$(pwd)/bin:$PATH 225 - 226 - ${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' 227 - # Independent from host/target, CC should produce code for the building system. 228 - # We only set it when cross-compiling. 229 - export CC=${buildPackages.stdenv.cc}/bin/cc 230 - ''} 231 - ulimit -a 232 - ''; 233 - 234 - postBuild = '' 235 - (cd src && ./make.bash) 236 - ''; 237 - 238 - doCheck = stdenv.hostPlatform == stdenv.targetPlatform && !stdenv.isDarwin; 239 - 240 - checkPhase = '' 241 - runHook preCheck 242 - (cd src && HOME=$TMPDIR GOCACHE=$TMPDIR/go-cache ./run.bash --no-rebuild) 243 - runHook postCheck 244 - ''; 245 - 246 - preInstall = '' 247 - rm -r pkg/obj 248 - # Contains the wrong perl shebang when cross compiling, 249 - # since it is not used for anything we can deleted as well. 250 - rm src/regexp/syntax/make_perl_groups.pl 251 - '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then '' 252 - mv bin/*_*/* bin 253 - rmdir bin/*_* 254 - ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' 255 - rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} 256 - ''} 257 - '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' 258 - rm -rf bin/*_* 259 - ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' 260 - rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} 261 - ''} 262 - '' else ""); 263 - 264 - installPhase = '' 265 - runHook preInstall 266 - mkdir -p $GOROOT_FINAL 267 - cp -a bin pkg src lib misc api doc $GOROOT_FINAL 268 - ln -s $GOROOT_FINAL/bin $out/bin 269 - runHook postInstall 270 - ''; 271 - 272 - disallowedReferences = [ goBootstrap ]; 273 - 274 - meta = with lib; { 275 - homepage = "http://golang.org/"; 276 - description = "The Go Programming language"; 277 - license = licenses.bsd3; 278 - maintainers = teams.golang.members; 279 - platforms = platforms.linux ++ platforms.darwin; 280 - knownVulnerabilities = [ 281 - "Support for Go 1.14 ended with the release of Go 1.16: https://golang.org/doc/devel/release.html#policy" 282 - ]; 283 - }; 284 - }
-23
pkgs/development/compilers/go/go_no_vendor_checks-1_14.patch
··· 1 - Starting from go1.14, go verifes that vendor/modules.txt matches the requirements 2 - and replacements listed in the main module go.mod file, and it is a hard failure if 3 - vendor/modules.txt is missing. 4 - 5 - Relax module consistency checks and switch back to pre go1.14 behaviour if 6 - vendor/modules.txt is missing regardless of go version requirement in go.mod. 7 - 8 - This has been ported from FreeBSD: https://reviews.freebsd.org/D24122 9 - See https://github.com/golang/go/issues/37948 for discussion. 10 - 11 - diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go 12 - index 71f68efbcc..3c566d04dd 100644 13 - --- a/src/cmd/go/internal/modload/init.go 14 - +++ b/src/cmd/go/internal/modload/init.go 15 - @@ -133,7 +133,7 @@ func checkVendorConsistency() { 16 - readVendorList() 17 - 18 - pre114 := false 19 - - if modFile.Go == nil || semver.Compare("v"+modFile.Go.Version, "v1.14") < 0 { 20 - + if modFile.Go == nil || semver.Compare("v"+modFile.Go.Version, "v1.14") < 0 || (os.Getenv("GO_NO_VENDOR_CHECKS") == "1" && len(vendorMeta) == 0) { 21 - // Go versions before 1.14 did not include enough information in 22 - // vendor/modules.txt to check for consistency. 23 - // If we know that we're on an earlier version, relax the consistency check.
-34
pkgs/development/compilers/go/remove-test-pie-1.14.patch
··· 1 - diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go 2 - index 56bdfcac19..d7d67ab94d 100644 3 - --- a/src/cmd/dist/test.go 4 - +++ b/src/cmd/dist/test.go 5 - @@ -580,29 +580,6 @@ func (t *tester) registerTests() { 6 - }) 7 - } 8 - 9 - - // Test internal linking of PIE binaries where it is supported. 10 - - if goos == "linux" && (goarch == "amd64" || goarch == "arm64") { 11 - - t.tests = append(t.tests, distTest{ 12 - - name: "pie_internal", 13 - - heading: "internal linking of -buildmode=pie", 14 - - fn: func(dt *distTest) error { 15 - - t.addCmd(dt, "src", t.goTest(), "reflect", "-buildmode=pie", "-ldflags=-linkmode=internal", t.timeout(60)) 16 - - return nil 17 - - }, 18 - - }) 19 - - // Also test a cgo package. 20 - - if t.cgoEnabled && t.internalLink() { 21 - - t.tests = append(t.tests, distTest{ 22 - - name: "pie_internal_cgo", 23 - - heading: "internal linking of -buildmode=pie", 24 - - fn: func(dt *distTest) error { 25 - - t.addCmd(dt, "src", t.goTest(), "os/user", "-buildmode=pie", "-ldflags=-linkmode=internal", t.timeout(60)) 26 - - return nil 27 - - }, 28 - - }) 29 - - } 30 - - } 31 - - 32 - // sync tests 33 - if goos != "js" { // js doesn't support -cpu=10 34 - t.tests = append(t.tests, distTest{
-26
pkgs/development/compilers/go/skip-external-network-tests.patch
··· 1 - diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go 2 - index 85cae90..94b4edd 100644 3 - --- a/src/cmd/go/go_test.go 4 - +++ b/src/cmd/go/go_test.go 5 - @@ -4946,6 +4946,8 @@ func TestBuildmodePIE(t *testing.T) { 6 - } 7 - 8 - func TestExecBuildX(t *testing.T) { 9 - + t.Skipf("skipping, test requires networking") 10 - + 11 - tooSlow(t) 12 - if !canCgo { 13 - t.Skip("skipping because cgo not enabled") 14 - diff --git a/src/net/dial_test.go b/src/net/dial_test.go 15 - index 00a84d1..27f9ec9 100644 16 - --- a/src/net/dial_test.go 17 - +++ b/src/net/dial_test.go 18 - @@ -968,6 +968,8 @@ func TestDialerControl(t *testing.T) { 19 - // mustHaveExternalNetwork is like testenv.MustHaveExternalNetwork 20 - // except that it won't skip testing on non-iOS builders. 21 - func mustHaveExternalNetwork(t *testing.T) { 22 - + t.Skipf("Nix sandbox does not have networking") 23 - + 24 - t.Helper() 25 - ios := runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") 26 - if testenv.Builder() == "" || ios {
-64
pkgs/development/compilers/go/ssl-cert-file-1.13.patch
··· 1 - diff --git a/src/crypto/x509/root_cgo_darwin.go b/src/crypto/x509/root_cgo_darwin.go 2 - index 255a8d3525..a467255a54 100644 3 - --- a/src/crypto/x509/root_cgo_darwin.go 4 - +++ b/src/crypto/x509/root_cgo_darwin.go 5 - @@ -280,6 +280,8 @@ int CopyPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugDa 6 - import "C" 7 - import ( 8 - "errors" 9 - + "io/ioutil" 10 - + "os" 11 - "unsafe" 12 - ) 13 - 14 - @@ -295,6 +297,13 @@ func loadSystemRoots() (*CertPool, error) { 15 - buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data))) 16 - roots := NewCertPool() 17 - roots.AppendCertsFromPEM(buf) 18 - + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" { 19 - + data, err := ioutil.ReadFile(file) 20 - + if err == nil { 21 - + roots.AppendCertsFromPEM(data) 22 - + return roots, nil 23 - + } 24 - + } 25 - 26 - if C.CFDataGetLength(untrustedData) == 0 { 27 - return roots, nil 28 - diff --git a/src/crypto/x509/root_darwin.go b/src/crypto/x509/root_darwin.go 29 - index 2f6a8b8d60..b81889fe69 100644 30 - --- a/src/crypto/x509/root_darwin.go 31 - +++ b/src/crypto/x509/root_darwin.go 32 - @@ -92,6 +92,14 @@ func execSecurityRoots() (*CertPool, error) { 33 - verifyCh = make(chan rootCandidate) 34 - ) 35 - 36 - + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" { 37 - + data, err := ioutil.ReadFile(file) 38 - + if err == nil { 39 - + roots.AppendCertsFromPEM(data) 40 - + return roots, nil 41 - + } 42 - + } 43 - + 44 - // Using 4 goroutines to pipe into verify-cert seems to be 45 - // about the best we can do. The verify-cert binary seems to 46 - // just RPC to another server with coarse locking anyway, so 47 - diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go 48 - index 48de50b4ea..750e12c6b4 100644 49 - --- a/src/crypto/x509/root_unix.go 50 - +++ b/src/crypto/x509/root_unix.go 51 - @@ -38,6 +38,13 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate 52 - 53 - func loadSystemRoots() (*CertPool, error) { 54 - roots := NewCertPool() 55 - + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" { 56 - + data, err := ioutil.ReadFile(file) 57 - + if err == nil { 58 - + roots.AppendCertsFromPEM(data) 59 - + return roots, nil 60 - + } 61 - + } 62 - 63 - files := certFiles 64 - if f := os.Getenv(certFileEnv); f != "" {
-13
pkgs/top-level/all-packages.nix
··· 11495 11495 11496 11496 glslang = callPackage ../development/compilers/glslang { }; 11497 11497 11498 - go_1_14 = callPackage ../development/compilers/go/1.14.nix ({ 11499 - inherit (darwin.apple_sdk.frameworks) Security Foundation; 11500 - } // lib.optionalAttrs (stdenv.cc.isGNU && stdenv.isAarch64) { 11501 - stdenv = gcc8Stdenv; 11502 - buildPackages = buildPackages // { stdenv = buildPackages.gcc8Stdenv; }; 11503 - }); 11504 - 11505 11498 go_1_15 = callPackage ../development/compilers/go/1.15.nix ({ 11506 11499 inherit (darwin.apple_sdk.frameworks) Security Foundation; 11507 11500 } // lib.optionalAttrs (stdenv.cc.isGNU && stdenv.isAarch64) { ··· 19418 19411 19419 19412 ### DEVELOPMENT / GO MODULES 19420 19413 19421 - buildGo114Package = callPackage ../development/go-packages/generic { 19422 - go = buildPackages.go_1_14; 19423 - }; 19424 19414 buildGo115Package = callPackage ../development/go-packages/generic { 19425 19415 go = buildPackages.go_1_15; 19426 19416 }; ··· 19430 19420 19431 19421 buildGoPackage = buildGo116Package; 19432 19422 19433 - buildGo114Module = callPackage ../development/go-modules/generic { 19434 - go = buildPackages.go_1_14; 19435 - }; 19436 19423 buildGo115Module = callPackage ../development/go-modules/generic { 19437 19424 go = buildPackages.go_1_15; 19438 19425 };