Merge pull request #35330 from Mic92/go

go_1_10: init at 1.10 and set as default

authored by Jörg Thalheim and committed by GitHub d81e32be 2649600e

+240 -14
+185
pkgs/development/compilers/go/1.10.nix
··· 1 + { stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin 2 + , perl, which, pkgconfig, patch, procps 3 + , pcre, cacert, llvm 4 + , Security, Foundation, bash 5 + , makeWrapper, git, subversion, mercurial, bazaar }: 6 + 7 + let 8 + 9 + inherit (stdenv.lib) optional optionals optionalString; 10 + 11 + clangHack = writeScriptBin "clang" '' 12 + #!${stdenv.shell} 13 + exec ${stdenv.cc}/bin/clang "$@" 2> >(sed '/ld: warning:.*ignoring unexpected dylib file/ d' 1>&2) 14 + ''; 15 + 16 + goBootstrap = runCommand "go-bootstrap" {} '' 17 + mkdir $out 18 + cp -rf ${go_bootstrap}/* $out/ 19 + chmod -R u+w $out 20 + find $out -name "*.c" -delete 21 + cp -rf $out/bin/* $out/share/go/bin/ 22 + ''; 23 + 24 + in 25 + 26 + stdenv.mkDerivation rec { 27 + name = "go-${version}"; 28 + version = "1.10"; 29 + 30 + src = fetchFromGitHub { 31 + owner = "golang"; 32 + repo = "go"; 33 + rev = "go${version}"; 34 + sha256 = "1dzs1mz3zxgg1qyi2lrlxdz1lsvazxvmj9cb69pgqnwjlh3jpw0l"; 35 + }; 36 + 37 + # perl is used for testing go vet 38 + nativeBuildInputs = [ perl which pkgconfig patch makeWrapper ] 39 + ++ optionals stdenv.isLinux [ procps ]; 40 + buildInputs = [ cacert pcre ] 41 + ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] 42 + ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; 43 + propagatedBuildInputs = optionals stdenv.isDarwin [ Security Foundation ]; 44 + 45 + hardeningDisable = [ "all" ]; 46 + 47 + prePatch = '' 48 + patchShebangs ./ # replace /bin/bash 49 + 50 + # This source produces shell script at run time, 51 + # and thus it is not corrected by patchShebangs. 52 + substituteInPlace misc/cgo/testcarchive/carchive_test.go \ 53 + --replace '#!/usr/bin/env bash' '#!${stdenv.shell}' 54 + 55 + # Disabling the 'os/http/net' tests (they want files not available in 56 + # chroot builds) 57 + rm src/net/{listen,parse}_test.go 58 + rm src/syscall/exec_linux_test.go 59 + 60 + # !!! substituteInPlace does not seems to be effective. 61 + # The os test wants to read files in an existing path. Just don't let it be /usr/bin. 62 + sed -i 's,/usr/bin,'"`pwd`", src/os/os_test.go 63 + sed -i 's,/bin/pwd,'"`type -P pwd`", src/os/os_test.go 64 + # Disable the unix socket test 65 + sed -i '/TestShutdownUnix/areturn' src/net/net_test.go 66 + # Disable the hostname test 67 + sed -i '/TestHostname/areturn' src/os/os_test.go 68 + # ParseInLocation fails the test 69 + sed -i '/TestParseInSydney/areturn' src/time/format_test.go 70 + # Remove the api check as it never worked 71 + sed -i '/src\/cmd\/api\/run.go/ireturn nil' src/cmd/dist/test.go 72 + # Remove the coverage test as we have removed this utility 73 + sed -i '/TestCoverageWithCgo/areturn' src/cmd/go/go_test.go 74 + # Remove the timezone naming test 75 + sed -i '/TestLoadFixed/areturn' src/time/time_test.go 76 + # Remove disable setgid test 77 + sed -i '/TestRespectSetgidDir/areturn' src/cmd/go/internal/work/build_test.go 78 + # Remove cert tests that conflict with NixOS's cert resolution 79 + sed -i '/TestEnvVars/areturn' src/crypto/x509/root_unix_test.go 80 + 81 + sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go 82 + sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_unix.go 83 + 84 + # Disable cgo lookup tests not works, they depend on resolver 85 + rm src/net/cgo_unix_test.go 86 + 87 + '' + optionalString stdenv.isLinux '' 88 + sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go 89 + '' + optionalString stdenv.isArm '' 90 + sed -i '/TestCurrent/areturn' src/os/user/user_test.go 91 + echo '#!${stdenv.shell}' > misc/cgo/testplugin/test.bash 92 + '' + optionalString stdenv.isDarwin '' 93 + substituteInPlace src/race.bash --replace \ 94 + "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true 95 + sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go 96 + sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go 97 + sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go 98 + 99 + sed -i '/TestChdirAndGetwd/areturn' src/os/os_test.go 100 + sed -i '/TestCredentialNoSetGroups/areturn' src/os/exec/exec_posix_test.go 101 + sed -i '/TestCurrent/areturn' src/os/user/user_test.go 102 + sed -i '/TestNohup/areturn' src/os/signal/signal_test.go 103 + sed -i '/TestRead0/areturn' src/os/os_test.go 104 + sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go 105 + 106 + sed -i '/TestGoInstallRebuildsStalePackagesInOtherGOPATH/areturn' src/cmd/go/go_test.go 107 + sed -i '/TestBuildDashIInstallsDependencies/areturn' src/cmd/go/go_test.go 108 + 109 + sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go 110 + 111 + sed -i 's/unrecognized/unknown/' src/cmd/link/internal/ld/lib.go 112 + 113 + touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd 114 + ''; 115 + 116 + patches = [ 117 + ./remove-tools-1.9.patch 118 + ./ssl-cert-file-1.9.patch 119 + ./remove-test-pie.patch 120 + ./creds-test.patch 121 + ./go-1.9-skip-flaky-19608.patch 122 + ./go-1.9-skip-flaky-20072.patch 123 + ]; 124 + 125 + postPatch = optionalString stdenv.isDarwin '' 126 + echo "substitute hardcoded dsymutil with ${llvm}/bin/llvm-dsymutil" 127 + substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil 128 + ''; 129 + 130 + GOOS = if stdenv.isDarwin then "darwin" else "linux"; 131 + GOARCH = if stdenv.isDarwin then "amd64" 132 + else if stdenv.system == "i686-linux" then "386" 133 + else if stdenv.system == "x86_64-linux" then "amd64" 134 + else if stdenv.isArm then "arm" 135 + else if stdenv.isAarch64 then "arm64" 136 + else throw "Unsupported system"; 137 + GOARM = optionalString (stdenv.system == "armv5tel-linux") "5"; 138 + GO386 = 387; # from Arch: don't assume sse2 on i686 139 + CGO_ENABLED = 1; 140 + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; 141 + # Hopefully avoids test timeouts on Hydra 142 + GO_TEST_TIMEOUT_SCALE = 3; 143 + 144 + # The go build actually checks for CC=*/clang and does something different, so we don't 145 + # just want the generic `cc` here. 146 + CC = if stdenv.isDarwin then "clang" else "cc"; 147 + 148 + configurePhase = '' 149 + mkdir -p $out/share/go/bin 150 + export GOROOT=$out/share/go 151 + export GOBIN=$GOROOT/bin 152 + export PATH=$GOBIN:$PATH 153 + ulimit -a 154 + ''; 155 + 156 + postConfigure = optionalString stdenv.isDarwin '' 157 + export PATH=${clangHack}/bin:$PATH 158 + ''; 159 + 160 + installPhase = '' 161 + cp -r . $GOROOT 162 + ( cd $GOROOT/src && ./all.bash ) 163 + 164 + # (https://github.com/golang/go/wiki/GoGetTools) 165 + wrapProgram $out/share/go/bin/go --prefix PATH ":" "${stdenv.lib.makeBinPath [ git subversion mercurial bazaar ]}" 166 + ''; 167 + 168 + preFixup = '' 169 + rm -r $out/share/go/pkg/bootstrap 170 + ln -s $out/share/go/bin $out/bin 171 + ''; 172 + 173 + setupHook = ./setup-hook.sh; 174 + 175 + disallowedReferences = [ go_bootstrap ]; 176 + 177 + meta = with stdenv.lib; { 178 + branch = "1.9"; 179 + homepage = http://golang.org/; 180 + description = "The Go Programming language"; 181 + license = licenses.bsd3; 182 + maintainers = with maintainers; [ cstrahan orivej velovix mic92 ]; 183 + platforms = platforms.linux ++ platforms.darwin; 184 + }; 185 + }
+1 -1
pkgs/development/compilers/go/1.9.nix
··· 118 118 patches = 119 119 [ ./remove-tools-1.9.patch 120 120 ./ssl-cert-file-1.9.patch 121 - ./creds-test.patch 121 + ./creds-test-1.9.patch 122 122 ./remove-test-pie-1.9.patch 123 123 ./go-1.9-skip-flaky-19608.patch 124 124 ./go-1.9-skip-flaky-20072.patch
+14
pkgs/development/compilers/go/creds-test-1.9.patch
··· 1 + diff -ru -x '*~' ./result/src/syscall/creds_test.go go-go1.7.4-src/src/syscall/creds_test.go 2 + --- ./result/src/syscall/creds_test.go 1970-01-01 01:00:01.000000000 +0100 3 + +++ go-go1.7.4-src/src/syscall/creds_test.go 2016-12-21 14:06:39.559932164 +0100 4 + @@ -62,8 +62,8 @@ 5 + if sys, ok := err.(*os.SyscallError); ok { 6 + err = sys.Err 7 + } 8 + - if err != syscall.EPERM { 9 + - t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) 10 + + if err != syscall.EPERM && err != syscall.EINVAL { 11 + + t.Fatalf("WriteMsgUnix failed with %v, want EPERM or EINVAL", err) 12 + } 13 + } 14 +
+11 -12
pkgs/development/compilers/go/creds-test.patch
··· 1 - diff -ru -x '*~' ./result/src/syscall/creds_test.go go-go1.7.4-src/src/syscall/creds_test.go 2 - --- ./result/src/syscall/creds_test.go 1970-01-01 01:00:01.000000000 +0100 3 - +++ go-go1.7.4-src/src/syscall/creds_test.go 2016-12-21 14:06:39.559932164 +0100 4 - @@ -62,8 +62,8 @@ 5 - if sys, ok := err.(*os.SyscallError); ok { 6 - err = sys.Err 1 + --- source.org/src/syscall/creds_test.go 1970-01-01 01:00:01.000000000 +0100 2 + +++ source/src/syscall/creds_test.go 2018-02-22 10:43:47.223615358 +0000 3 + @@ -76,8 +76,8 @@ 4 + if sys, ok := err.(*os.SyscallError); ok { 5 + err = sys.Err 6 + } 7 + - if err != syscall.EPERM { 8 + - t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) 9 + + if err != syscall.EPERM && err != syscall.EINVAL { 10 + + t.Fatalf("WriteMsgUnix failed with %v, want EPERM or EINVAL", err) 11 + } 7 12 } 8 - - if err != syscall.EPERM { 9 - - t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err) 10 - + if err != syscall.EPERM && err != syscall.EINVAL { 11 - + t.Fatalf("WriteMsgUnix failed with %v, want EPERM or EINVAL", err) 12 - } 13 - } 14 13
+24
pkgs/development/compilers/go/remove-test-pie.patch
··· 1 + --- source.org/src/cmd/dist/test.go 2018-02-22 10:40:40.089632339 +0000 2 + +++ source/src/cmd/dist/test.go 2018-02-22 10:56:53.075193788 +0000 3 + @@ -526,21 +526,6 @@ 4 + }) 5 + } 6 + 7 + - // Test internal linking of PIE binaries where it is supported. 8 + - if goos == "linux" && goarch == "amd64" && !isAlpineLinux() { 9 + - // Issue 18243: We don't have a way to set the default 10 + - // dynamic linker used in internal linking mode. So 11 + - // this test is skipped on Alpine. 12 + - t.tests = append(t.tests, distTest{ 13 + - name: "pie_internal", 14 + - heading: "internal linking of -buildmode=pie", 15 + - fn: func(dt *distTest) error { 16 + - t.addCmd(dt, "src", t.goTest(), "reflect", "-buildmode=pie", "-ldflags=-linkmode=internal", t.timeout(60)) 17 + - return nil 18 + - }, 19 + - }) 20 + - } 21 + - 22 + // sync tests 23 + t.tests = append(t.tests, distTest{ 24 + name: "sync_cpu",
+5 -1
pkgs/top-level/all-packages.nix
··· 6210 6210 inherit (darwin.apple_sdk.frameworks) Security Foundation; 6211 6211 }; 6212 6212 6213 - go = go_1_9; 6213 + go_1_10 = callPackage ../development/compilers/go/1.10.nix { 6214 + inherit (darwin.apple_sdk.frameworks) Security Foundation; 6215 + }; 6216 + 6217 + go = go_1_10; 6214 6218 6215 6219 go-repo-root = callPackage ../development/tools/go-repo-root { }; 6216 6220