push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
{
lib,
stdenv,
fetchurl,
tzdata,
replaceVars,
iana-etc,
mailcap,
buildPackages,
pkgsBuildTarget,
targetPackages,
testers,
skopeo,
buildGo124Module,
}:
let
goBootstrap = buildPackages.callPackage ./bootstrap122.nix { };
skopeoTest = skopeo.override { buildGoModule = buildGo124Module; };
# We need a target compiler which is still runnable at build time,
# to handle the cross-building case where build != host == target
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc;
isCross = stdenv.buildPlatform != stdenv.targetPlatform;
in
stdenv.mkDerivation (finalAttrs: {
pname = "go";
version = "1.24.8";
src = fetchurl {
url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz";
hash = "sha256-sf8yxcSlDd+hoct4tg3Vo2KushhLt48Ai0JbYglXVfs=";
};
strictDeps = true;
buildInputs =
[ ]
++ lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.libc.out ]
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isMinGW targetPackages.threads.package;
postPatch = ''
patchShebangs .
'';
patches = [
(replaceVars ./iana-etc-1.17.patch {
iana = iana-etc;
})
# Patch the mimetype database location which is missing on NixOS.
# but also allow static binaries built with NixOS to run outside nix
(replaceVars ./mailcap-1.17.patch {
inherit mailcap;
})
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
# that run outside a nix server
(replaceVars ./tzdata-1.19.patch {
inherit tzdata;
})
./remove-tools-1.11.patch
./go_no_vendor_checks-1.23.patch
];
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
# GOHOSTOS/GOHOSTARCH must match the building system, not the host system.
# Go will nevertheless build a for host system that we will copy over in
# the install phase.
GOHOSTOS = stdenv.buildPlatform.go.GOOS;
GOHOSTARCH = stdenv.buildPlatform.go.GOARCH;
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX
CC_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null;
CXX_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null;
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
# Wasi does not support CGO
# ppc64/linux CGO is incomplete/borked, and will likely not receive any further improvements
# https://github.com/golang/go/issues/8912
# https://github.com/golang/go/issues/13192
CGO_ENABLED =
if
(
stdenv.targetPlatform.isWasi
|| (stdenv.targetPlatform.isPower64 && stdenv.targetPlatform.isBigEndian)
)
then
0
else
1;
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
buildPhase = ''
runHook preBuild
export GOCACHE=$TMPDIR/go-cache
export PATH=$(pwd)/bin:$PATH
${lib.optionalString isCross ''
# Independent from host/target, CC should produce code for the building system.
# We only set it when cross-compiling.
export CC=${buildPackages.stdenv.cc}/bin/cc
''}
ulimit -a
pushd src
./make.bash
popd
runHook postBuild
'';
preInstall = ''
# Contains the wrong perl shebang when cross compiling,
# since it is not used for anything we can deleted as well.
rm src/regexp/syntax/make_perl_groups.pl
''
+ (
if (stdenv.buildPlatform.system != stdenv.hostPlatform.system) then
''
mv bin/*_*/* bin
rmdir bin/*_*
${lib.optionalString
(!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS))
''
rm -rf pkg/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH} pkg/tool/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH}
''
}
''
else
lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) ''
rm -rf bin/*_*
${lib.optionalString
(!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS))
''
rm -rf pkg/${finalAttrs.GOOS}_${finalAttrs.GOARCH} pkg/tool/${finalAttrs.GOOS}_${finalAttrs.GOARCH}
''
}
''
);
installPhase = ''
runHook preInstall
mkdir -p $out/share/go
cp -a bin pkg src lib misc api doc go.env VERSION $out/share/go
mkdir -p $out/bin
ln -s $out/share/go/bin/* $out/bin
runHook postInstall
'';
disallowedReferences = [ goBootstrap ];
passthru = {
inherit goBootstrap skopeoTest;
tests = {
skopeo = testers.testVersion { package = skopeoTest; };
version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "go version";
version = "go${finalAttrs.version}";
};
};
};
meta = with lib; {
changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor finalAttrs.version}";
description = "Go Programming language";
homepage = "https://go.dev/";
license = licenses.bsd3;
teams = [ teams.golang ];
platforms = platforms.darwin ++ platforms.linux ++ platforms.wasi ++ platforms.freebsd;
badPlatforms = [
# Support for big-endian POWER < 8 was dropped in 1.9, but POWER8 users have less of a reason to run in big-endian mode than pre-POWER8 ones
# So non-LE ppc64 is effectively unsupported, and Go SIGILLs on affordable ppc64 hardware
# https://github.com/golang/go/issues/19074 - Dropped support for big-endian POWER < 8, with community pushback
# https://github.com/golang/go/issues/73349 - upstream will not accept submissions to fix this
"powerpc64-linux"
];
mainProgram = "go";
};
})

View File

@@ -0,0 +1,191 @@
{
lib,
stdenv,
fetchurl,
apple-sdk_12,
tzdata,
replaceVars,
iana-etc,
mailcap,
buildPackages,
pkgsBuildTarget,
targetPackages,
testers,
skopeo,
buildGo125Module,
}:
let
goBootstrap = buildPackages.callPackage ./bootstrap122.nix { };
skopeoTest = skopeo.override { buildGoModule = buildGo125Module; };
# We need a target compiler which is still runnable at build time,
# to handle the cross-building case where build != host == target
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc;
isCross = stdenv.buildPlatform != stdenv.targetPlatform;
in
stdenv.mkDerivation (finalAttrs: {
pname = "go";
version = "1.25.1";
src = fetchurl {
url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz";
hash = "sha256-0BDBCc7pTYDv5oHqtGvepJGskGv0ZYPDLp8NuwvRpZQ=";
};
strictDeps = true;
buildInputs =
[ ]
++ lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.libc.out ]
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
depsTargetTargetPropagated = lib.optionals stdenv.targetPlatform.isDarwin [
apple-sdk_12
];
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isMinGW targetPackages.threads.package;
postPatch = ''
patchShebangs .
'';
patches = [
(replaceVars ./iana-etc-1.25.patch {
iana = iana-etc;
})
# Patch the mimetype database location which is missing on NixOS.
# but also allow static binaries built with NixOS to run outside nix
(replaceVars ./mailcap-1.17.patch {
inherit mailcap;
})
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
# that run outside a nix server
(replaceVars ./tzdata-1.19.patch {
inherit tzdata;
})
./remove-tools-1.11.patch
./go_no_vendor_checks-1.23.patch
];
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
# GOHOSTOS/GOHOSTARCH must match the building system, not the host system.
# Go will nevertheless build a for host system that we will copy over in
# the install phase.
GOHOSTOS = stdenv.buildPlatform.go.GOOS;
GOHOSTARCH = stdenv.buildPlatform.go.GOARCH;
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX
CC_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null;
CXX_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null;
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
# Wasi does not support CGO
# ppc64/linux CGO is incomplete/borked, and will likely not receive any further improvements
# https://github.com/golang/go/issues/8912
# https://github.com/golang/go/issues/13192
CGO_ENABLED =
if
(
stdenv.targetPlatform.isWasi
|| (stdenv.targetPlatform.isPower64 && stdenv.targetPlatform.isBigEndian)
)
then
0
else
1;
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
buildPhase = ''
runHook preBuild
export GOCACHE=$TMPDIR/go-cache
export PATH=$(pwd)/bin:$PATH
${lib.optionalString isCross ''
# Independent from host/target, CC should produce code for the building system.
# We only set it when cross-compiling.
export CC=${buildPackages.stdenv.cc}/bin/cc
''}
ulimit -a
pushd src
./make.bash
popd
runHook postBuild
'';
preInstall = ''
# Contains the wrong perl shebang when cross compiling,
# since it is not used for anything we can deleted as well.
rm src/regexp/syntax/make_perl_groups.pl
''
+ (
if (stdenv.buildPlatform.system != stdenv.hostPlatform.system) then
''
mv bin/*_*/* bin
rmdir bin/*_*
${lib.optionalString
(!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS))
''
rm -rf pkg/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH} pkg/tool/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH}
''
}
''
else
lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) ''
rm -rf bin/*_*
${lib.optionalString
(!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS))
''
rm -rf pkg/${finalAttrs.GOOS}_${finalAttrs.GOARCH} pkg/tool/${finalAttrs.GOOS}_${finalAttrs.GOARCH}
''
}
''
);
installPhase = ''
runHook preInstall
mkdir -p $out/share/go
cp -a bin pkg src lib misc api doc go.env VERSION $out/share/go
mkdir -p $out/bin
ln -s $out/share/go/bin/* $out/bin
runHook postInstall
'';
disallowedReferences = [ goBootstrap ];
passthru = {
inherit goBootstrap skopeoTest;
tests = {
skopeo = testers.testVersion { package = skopeoTest; };
version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "go version";
version = "go${finalAttrs.version}";
};
};
};
meta = with lib; {
changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor finalAttrs.version}";
description = "Go Programming language";
homepage = "https://go.dev/";
license = licenses.bsd3;
teams = [ teams.golang ];
platforms = platforms.darwin ++ platforms.linux ++ platforms.wasi ++ platforms.freebsd;
badPlatforms = [
# Support for big-endian POWER < 8 was dropped in 1.9, but POWER8 users have less of a reason to run in big-endian mode than pre-POWER8 ones
# So non-LE ppc64 is effectively unsupported, and Go SIGILLs on affordable ppc64 hardware
# https://github.com/golang/go/issues/19074 - Dropped support for big-endian POWER < 8, with community pushback
# https://github.com/golang/go/issues/73349 - upstream will not accept submissions to fix this
"powerpc64-linux"
];
mainProgram = "go";
};
})

View File

@@ -0,0 +1,46 @@
{
lib,
stdenv,
fetchurl,
version,
hashes,
}:
let
platform = with stdenv.hostPlatform.go; "${GOOS}-${if GOARCH == "arm" then "armv6l" else GOARCH}";
in
stdenv.mkDerivation {
name = "go-${version}-${platform}-bootstrap";
src = fetchurl {
url = "https://go.dev/dl/go${version}.${platform}.tar.gz";
sha256 = hashes.${platform} or (throw "Missing Go bootstrap hash for platform ${platform}");
};
# We must preserve the signature on Darwin
dontStrip = stdenv.hostPlatform.isDarwin;
installPhase = ''
runHook preInstall
mkdir -p $out/share/go $out/bin
cp -r . $out/share/go
ln -s $out/share/go/bin/go $out/bin/go
runHook postInstall
'';
meta = {
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor version}";
description = "Go Programming language";
homepage = "https://go.dev/";
license = lib.licenses.bsd3;
teams = [ lib.teams.golang ];
platforms = lib.platforms.darwin ++ lib.platforms.freebsd ++ lib.platforms.linux;
badPlatforms = [
# Support for big-endian POWER < 8 was dropped in 1.9, but POWER8 users have less of a reason to run in big-endian mode than pre-POWER8 ones
# So non-LE ppc64 is effectively unsupported, and Go SIGILLs on affordable ppc64 hardware
# https://github.com/golang/go/issues/19074 - Dropped support for big-endian POWER < 8, with community pushback
# https://github.com/golang/go/issues/73349 - upstream will not accept submissions to fix this
"powerpc64-linux"
];
};
}

View File

@@ -0,0 +1,27 @@
{ callPackage }:
callPackage ./binary.nix {
version = "1.21.0";
hashes = {
# Use `print-hashes.sh ${version}` to generate the list below
darwin-amd64 = "b314de9f704ab122c077d2ec8e67e3670affe8865479d1f01991e7ac55d65e70";
darwin-arm64 = "3aca44de55c5e098de2f406e98aba328898b05d509a2e2a356416faacf2c4566";
freebsd-386 = "312a0065714a50862af714e7a5b3fbbd70fe68f905ffb9bcc56d42eadf6bffab";
freebsd-amd64 = "b8eaa36654625df799654f77f4af0ea7bd9e5e760ebe86e68fe7c484748ae995";
freebsd-arm64 = "bca5be1a9934fc522cb1a2e4849bb9f12ee6b480b48949e36a4dfb8e755a4b25";
freebsd-armv6l = "f4c9c91fa9c37d6d6b7644f3f6b67167b2a44bd48c0cba1d2a5ff5fd50ceb364";
freebsd-riscv64 = "45b99a9884dcd0dd4c8e4c0f99a4dc2901b8e9628dd8091ae5c0620afd536f0a";
linux-386 = "0e6f378d9b072fab0a3d9ff4d5e990d98487d47252dba8160015a61e6bd0bcba";
linux-amd64 = "d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742";
linux-arm64 = "f3d4548edf9b22f26bbd49720350bbfe59d75b7090a1a2bff1afad8214febaf3";
linux-armv6l = "e377a0004957c8c560a3ff99601bce612330a3d95ba3b0a2ae144165fc87deb1";
linux-loong64 = "e484cdc55221f7e7853666ed4f0ef462eef46b52253f84df60a7b908416060cb";
linux-mips = "6311d8ccd6ff9ce3cc8ecc72017d651d23e7325943fa72f4b65cd750be8aacd8";
linux-mips64 = "6d9cb425dc61f60bff41e2dec873abbcc5b8dbd1d32997f994d707b662f3c363";
linux-mips64le = "92f7933d997c589b4f506c6b3cc5b27ff43b294c3a2d40bf4d7eeaf375f92afb";
linux-mipsle = "9bb9f938457411042074a57284d40a086e63f7778f86e1632e018bbc38948c92";
linux-ppc64 = "e34dcc1df804bf8bac035ace3304f23696a9138a79a398dce981d89072d3ae23";
linux-ppc64le = "e938ffc81d8ebe5efc179240960ba22da6a841ff05d5cab7ce2547112b14a47f";
linux-riscv64 = "87b21c06573617842ca9e00b954bc9f534066736a0778eae594ac54b45a9e8b7";
linux-s390x = "be7338df8e5d5472dfa307b0df2b446d85d001b0a2a3cdb1a14048d751b70481";
};
}

View File

@@ -0,0 +1,27 @@
{ callPackage }:
callPackage ./binary.nix {
version = "1.22.12";
hashes = {
# Use `print-hashes.sh ${version}` to generate the list below
darwin-amd64 = "e7bbe07e96f0bd3df04225090fe1e7852ed33af37c43a23e16edbbb3b90a5b7c";
darwin-arm64 = "416c35218edb9d20990b5d8fc87be655d8b39926f15524ea35c66ee70273050d";
freebsd-386 = "85b00f8646e84be6ce51c753d22b68a5f4d5bbfc6a82c8ca9e7489c0c5a619d8";
freebsd-amd64 = "a8c77e76859db3e6f3322cbe11deea5faf779e374f45df7554d2cb484ffa492a";
freebsd-arm64 = "f56d3b2d26acd9e720f8be503d92bb7bb5d921462ff7c92463d0fa550507ed93";
freebsd-armv6l = "dac691ce62ac6b9c78f45a0058d7656abedbe5665b3d49910cbd6ba12e20c2fb";
freebsd-riscv64 = "d147c0c8faaffed65240f3b4fe5e44e573928827b9292fb873c9712d567fa986";
linux-386 = "40d4c297bc2e964e9c96fe79bb323dce79b77b8b103fc7cc52e0a87c7849890f";
linux-amd64 = "4fa4f869b0f7fc6bb1eb2660e74657fbf04cdd290b5aef905585c86051b34d43";
linux-arm64 = "fd017e647ec28525e86ae8203236e0653242722a7436929b1f775744e26278e7";
linux-armv6l = "bcd678461bb74cda217fb5aa3cc914b2021be6d828f0c6fb4e3a36c3d7312acb";
linux-loong64 = "ef1644676782354369210ed6cd839ff872de886c38f287d29ac69377928edec1";
linux-mips = "993c685dad0a59f9f15f76a2eb9146f741ef36d808f38985bc6748b38000746d";
linux-mips64 = "d8aa3dea17e0175d6a57dfdf9b3b29a911ebe8c5ddbefd808eab61a842c00229";
linux-mips64le = "2d473895f9c1dc8c86d51eb13f8ca49b7eea46010759fd71efed3eecacf5335b";
linux-mipsle = "d4ba5f6215643a1d64dc159869663f71dd339598e99678e97e1c5300bb46d46d";
linux-ppc64 = "ab0b6dc2aa1096f256224398d4a34eac5257289146cdc2f3a62b9fc17709a3c5";
linux-ppc64le = "9573d30003b0796717a99d9e2e96c48fddd4fc0f29d840f212c503b03d7de112";
linux-riscv64 = "f03a084aabc812fdc15b29acd5e1ee18e13b3c80be22aec43990119afcaf4947";
linux-s390x = "e1b20935cc790fdc4c48c0e3e6dd11be57ac09e4eb302ba2cdf146276468b346";
};
}

View File

@@ -0,0 +1,26 @@
diff --git a/src/cmd/go/internal/modload/import.go b/src/cmd/go/internal/modload/import.go
index a3105b6b6d..0e10154a70 100644
--- a/src/cmd/go/internal/modload/import.go
+++ b/src/cmd/go/internal/modload/import.go
@@ -345,7 +345,7 @@ func importFromModules(ctx context.Context, path string, rs *Requirements, mg *M
// vendor/modules.txt does not exist or the user manually added directories to the vendor directory.
// Go 1.23 and later require vendored packages to be present in modules.txt to be imported.
_, ok := vendorPkgModule[path]
- if ok || (gover.Compare(MainModules.GoVersion(), gover.ExplicitModulesTxtImportVersion) < 0) {
+ if ok || (gover.Compare(MainModules.GoVersion(), gover.ExplicitModulesTxtImportVersion) < 0) || os.Getenv("GO_NO_VENDOR_CHECKS") == "1" {
mods = append(mods, vendorPkgModule[path])
dirs = append(dirs, dir)
roots = append(roots, vendorDir)
diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go
index b2cb44100e..05bf3829d5 100644
--- a/src/cmd/go/internal/modload/vendor.go
+++ b/src/cmd/go/internal/modload/vendor.go
@@ -159,7 +159,7 @@ func checkVendorConsistency(indexes []*modFileIndex, modFiles []*modfile.File, m
panic(fmt.Errorf("not in workspace mode but number of indexes is %v, not 1", len(indexes)))
}
index := indexes[0]
- if gover.Compare(index.goVersion, "1.14") < 0 {
+ if gover.Compare(index.goVersion, "1.14") < 0 || (os.Getenv("GO_NO_VENDOR_CHECKS") == "1" && len(vendorMeta) == 0) {
// Go versions before 1.14 did not include enough information in
// vendor/modules.txt to check for consistency.
// If we know that we're on an earlier version, relax the consistency check.

View File

@@ -0,0 +1,26 @@
diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go
index 8030e3d99e..5a7472d933 100644
--- a/src/net/lookup_unix.go
+++ b/src/net/lookup_unix.go
@@ -21,7 +21,7 @@ var onceReadProtocols sync.Once
// readProtocols loads contents of /etc/protocols into protocols map
// for quick access.
func readProtocols() {
- file, err := open("/etc/protocols")
+ file, err := open("@iana@/etc/protocols")
if err != nil {
return
}
diff --git a/src/net/port_unix.go b/src/net/port_unix.go
index a9a96a2323..0df6efe9e5 100644
--- a/src/net/port_unix.go
+++ b/src/net/port_unix.go
@@ -17,7 +17,7 @@ import (
var onceReadServices sync.Once
func readServices() {
- file, err := open("/etc/services")
+ file, err := open("@iana@/etc/services")
if err != nil {
return
}

View File

@@ -0,0 +1,26 @@
diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go
index 7416cb01f8..62722cab14 100644
--- a/src/net/lookup_unix.go
+++ b/src/net/lookup_unix.go
@@ -15,7 +15,7 @@ import (
// readProtocolsOnce loads contents of /etc/protocols into protocols map
// for quick access.
var readProtocolsOnce = sync.OnceFunc(func() {
- file, err := open("/etc/protocols")
+ file, err := open("@iana@/etc/protocols")
if err != nil {
return
}
diff --git a/src/net/port_unix.go b/src/net/port_unix.go
index df73dbabb3..a5dcf2ca1c 100644
--- a/src/net/port_unix.go
+++ b/src/net/port_unix.go
@@ -16,7 +16,7 @@ import (
var onceReadServices sync.Once
func readServices() {
- file, err := open("/etc/services")
+ file, err := open("@iana@/etc/services")
if err != nil {
return
}

View File

@@ -0,0 +1,12 @@
diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go
index f954bc8a1f..06d897bfbf 100644
--- a/src/mime/type_unix.go
+++ b/src/mime/type_unix.go
@@ -26,6 +26,7 @@ var mimeGlobs = []string{
// Common locations for mime.types files on unix.
var typeFiles = []string{
+ "@mailcap@/etc/mime.types",
"/etc/mime.types",
"/etc/apache2/mime.types",
"/etc/apache/mime.types",

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
# shellcheck shell=bash
set -euo pipefail
BASEURL=https://go.dev/dl/
VERSION=${1:-}
if [[ -z ${VERSION} ]]; then
echo "No version supplied"
exit 1
fi
curl -s "${BASEURL}?mode=json&include=all" |
jq '.[] | select(.version == "go'"${VERSION}"'")' |
jq -r '.files[] | select(.kind == "archive" and (.os == "linux" or .os == "darwin" or .os == "freebsd")) | (.os + "-" + .arch + " = \"" + .sha256 + "\";")'

View File

@@ -0,0 +1,35 @@
diff --git a/src/go/build/build.go b/src/go/build/build.go
index b68a712..b60bf19 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -1708,7 +1708,7 @@ func init() {
}
// ToolDir is the directory containing build tools.
-var ToolDir = getToolDir()
+var ToolDir = runtime.GOTOOLDIR()
// IsLocalImport reports whether the import path is
// a local import path, like ".", "..", "./foo", or "../foo".
diff --git a/src/runtime/extern.go b/src/runtime/extern.go
index 7171b13..18a942c 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -229,6 +229,17 @@ func GOROOT() string {
return sys.DefaultGoroot
}
+// GOTOOLDIR returns the root of the Go tree.
+// It uses the GOTOOLDIR environment variable, if set,
+// or else the root used during the Go build.
+func GOTOOLDIR() string {
+ s := gogetenv("GOTOOLDIR")
+ if s != "" {
+ return s
+ }
+ return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH
+}
+
// Version returns the Go tree's version string.
// It is either the commit hash and date at the time of the build or,
// when possible, a release tag like "go1.3".

View File

@@ -0,0 +1,12 @@
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index 67b8beb47b..5cd1fb1759 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -18,6 +18,7 @@ import (
// Many systems use /usr/share/zoneinfo, Solaris 2 has
// /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
var platformZoneSources = []string{
+ "@tzdata@/share/zoneinfo/",
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",