Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-20 16:21:45 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-20 16:49:34 +0300
commit7be5e5c23152778b32a6b9859085724acb6a549d (patch)
tree1469726d746cefab63aa3a74c45779131db20141 /internal/version
parent1bda3d3d6792db060b5abf2b404e3af3cf4369ef (diff)
version: Make builds deterministic by dropping build time
Before converting to the new `WithGoBuildInformation()` monitoring option in the preceding commit we always exposed the build time. We have stopped doing that now and instead only expose information that Go puts into the binary itself. As a result, we can now drop the infrastructure to embed the build time into the binary. This has the advantage that it significantly improves incremental build times: previously we'd basically have to rebuild all binaries every single time, as the embedded build time changes every second. As we stop doing that we can in many cases skip this step. On my machine this leads to a 3.5x build speedup. Benchmark 1: make Time (mean ± σ): 12.163 s ± 0.148 s [User: 16.677 s, System: 3.496 s] Range (min … max): 12.044 s … 12.328 s 3 runs Benchmark 2: make GO_LDFLAGS= Time (mean ± σ): 3.469 s ± 0.060 s [User: 5.593 s, System: 1.880 s] Range (min … max): 3.433 s … 3.539 s 3 runs Summary 'make GO_LDFLAGS=' ran 3.51 ± 0.07 times faster than 'make' This has been benchmarked with the preceding commit which still embedded the build time into the binary. By stubbing out the `GO_LDFLAGS`, which is how we put the build time into the resulting binary, we are able to emulate the new behaviour with this commit. But besides the quality-of-life improvements for developers another significant advantage is that we now have reproducible builds. Changelog: fixed
Diffstat (limited to 'internal/version')
-rw-r--r--internal/version/version.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/internal/version/version.go b/internal/version/version.go
index 2d4fa67f3..a9db344bf 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -4,10 +4,7 @@ import (
"fmt"
)
-var (
- version string
- buildtime string
-)
+var version string
// GetVersionString returns a standard version header
func GetVersionString(binary string) string {
@@ -18,8 +15,3 @@ func GetVersionString(binary string) string {
func GetVersion() string {
return version
}
-
-// GetBuildTime returns the time at which the build took place
-func GetBuildTime() string {
- return buildtime
-}