Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit df1c57e

Browse files
ulyssessouzandeloof
authored andcommitted
Remove build time in binary
Signed-off-by: Ulysses Souza <[email protected]>
1 parent 31e76df commit df1c57e

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
include vars.mk
22

3-
ifeq ($(BUILDTIME),)
4-
BUILDTIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null)
5-
endif
6-
ifeq ($(BUILDTIME),)
7-
BUILDTIME := unknown
8-
$(warning unable to set BUILDTIME. Set the value manually)
9-
endif
10-
113
LDFLAGS := "-s -w \
124
-X $(PKG_NAME)/internal.GitCommit=$(COMMIT) \
13-
-X $(PKG_NAME)/internal.Version=$(TAG) \
14-
-X $(PKG_NAME)/internal.BuildTime=$(BUILDTIME)"
5+
-X $(PKG_NAME)/internal.Version=$(TAG)"
156

167
EXEC_EXT :=
178
ifeq ($(OS),Windows_NT)

internal/version.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,22 @@ import (
44
"fmt"
55
"runtime"
66
"strings"
7-
"time"
87
)
98

109
var (
1110
// Version is the git tag that this was built from.
1211
Version = "unknown"
1312
// GitCommit is the commit that this was built from.
1413
GitCommit = "unknown"
15-
// BuildTime is the time at which the binary was built.
16-
BuildTime = "unknown"
1714
)
1815

1916
// FullVersion returns a string of version information.
2017
func FullVersion() string {
2118
res := []string{
2219
fmt.Sprintf("Version: %s", Version),
2320
fmt.Sprintf("Git commit: %s", GitCommit),
24-
fmt.Sprintf("Built: %s", reformatDate(BuildTime)),
2521
fmt.Sprintf("OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH),
2622
}
2723

2824
return strings.Join(res, "\n")
2925
}
30-
31-
// FIXME(chris-crone): use function in docker/cli/cli/command/system/version.go.
32-
func reformatDate(buildTime string) string {
33-
t, errTime := time.Parse(time.RFC3339Nano, buildTime)
34-
if errTime == nil {
35-
return t.Format(time.ANSIC)
36-
}
37-
return buildTime
38-
}

vars.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ifeq ($(SHELL),sh.exe)
1111
rm = del /F /Q $(subst /,\,$(1)) > nul 2>&1 || (exit 0)
1212
rmdir = rmdir /S /Q $(subst /,\,$(1)) > nul 2>&1 || (exit 0)
1313
chmod =
14-
BUILDTIME ?= unknown
1514
NULL := nul
1615
else
1716
# The no-op redirection forces make to shell out the commands instead of spawning a process as

0 commit comments

Comments
 (0)