omit go's buildvcs for more reproducible builds

This commit is contained in:
Evan Wallace
2026-04-02 00:01:30 -04:00
parent 7406b09273
commit b71e7acdd8
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ PATH_SEPARATOR = $(shell if uname | grep -qE "MINGW|WIN32|CYGWIN"; then echo ";"
GO_COMPILER = PATH="$(GO_DIR)/bin$(PATH_SEPARATOR)$(PATH)" GOROOT="$(GO_DIR)" CGO_ENABLED=0
# Strip debug info and clear the build id for reproducible builds
GO_FLAGS += "-ldflags=-s -w -buildid="
GO_FLAGS += "-ldflags=-s -w -buildid=" -buildvcs=false
# Avoid embedding the build path in the executable for more reproducible builds
GO_FLAGS += -trimpath
+2 -1
View File
@@ -134,6 +134,7 @@ exports.buildWasmLib = async (esbuildPath) => {
'build',
'-o', path.join(npmWasmDir, 'esbuild.wasm'),
'-ldflags=-s -w -buildid=', // This removes ~0.14mb of unnecessary WebAssembly code
'-buildvcs=false',
'-trimpath',
path.join(repoDir, 'cmd', 'esbuild'),
],
@@ -278,7 +279,7 @@ exports.writeFileAtomic = (where, contents) => {
}
exports.buildBinary = () => {
childProcess.execFileSync('go', ['build', '-ldflags=-s -w -buildid=', '-trimpath', './cmd/esbuild'], { cwd: repoDir, stdio: 'ignore' })
childProcess.execFileSync('go', ['build', '-ldflags=-s -w -buildid=', '-buildvcs=false', '-trimpath', './cmd/esbuild'], { cwd: repoDir, stdio: 'ignore' })
return path.join(repoDir, process.platform === 'win32' ? 'esbuild.exe' : 'esbuild')
}