misc: drop Build variable
Makes builds reproducible. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
a4ad52e181
commit
6c73296012
3 changed files with 10 additions and 15 deletions
3
Makefile
3
Makefile
|
@ -22,8 +22,7 @@ $(BINS): $(DIRS) dep
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
GO111MODULE=on \
|
GO111MODULE=on \
|
||||||
go build -v -trimpath \
|
go build -v -trimpath \
|
||||||
-ldflags "-X main.Version=$(VERSION) \
|
-ldflags "-X main.Version=$(VERSION)" \
|
||||||
-X main.Build=$(BUILD)" \
|
|
||||||
-o $@ ./
|
-o $@ ./
|
||||||
|
|
||||||
$(DIRS):
|
$(DIRS):
|
||||||
|
|
2
misc.go
2
misc.go
|
@ -5,8 +5,6 @@ package main
|
||||||
const Prefix = "HTTP_GW"
|
const Prefix = "HTTP_GW"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Build is a timestamp set during gateway build.
|
|
||||||
Build = "now"
|
|
||||||
// Version is gateway version.
|
// Version is gateway version.
|
||||||
Version = "dev"
|
Version = "dev"
|
||||||
)
|
)
|
||||||
|
|
20
settings.go
20
settings.go
|
@ -64,9 +64,8 @@ const (
|
||||||
cfgPeers = "peers"
|
cfgPeers = "peers"
|
||||||
|
|
||||||
// Application.
|
// Application.
|
||||||
cfgApplicationName = "app.name"
|
cfgApplicationName = "app.name"
|
||||||
cfgApplicationVersion = "app.version"
|
cfgApplicationVersion = "app.version"
|
||||||
cfgApplicationBuildTime = "app.build_time"
|
|
||||||
|
|
||||||
// Command line args.
|
// Command line args.
|
||||||
cmdHelp = "help"
|
cmdHelp = "help"
|
||||||
|
@ -78,12 +77,11 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var ignore = map[string]struct{}{
|
var ignore = map[string]struct{}{
|
||||||
cfgApplicationName: {},
|
cfgApplicationName: {},
|
||||||
cfgApplicationVersion: {},
|
cfgApplicationVersion: {},
|
||||||
cfgApplicationBuildTime: {},
|
cfgPeers: {},
|
||||||
cfgPeers: {},
|
cmdHelp: {},
|
||||||
cmdHelp: {},
|
cmdVersion: {},
|
||||||
cmdVersion: {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (empty) Read([]byte) (int, error) { return 0, io.EOF }
|
func (empty) Read([]byte) (int, error) { return 0, io.EOF }
|
||||||
|
@ -164,7 +162,7 @@ func settings() *viper.Viper {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case help != nil && *help:
|
case help != nil && *help:
|
||||||
fmt.Printf("NeoFS HTTP Gateway %s (%s)\n", Version, Build)
|
fmt.Printf("NeoFS HTTP Gateway %s\n", Version)
|
||||||
flags.PrintDefaults()
|
flags.PrintDefaults()
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
@ -191,7 +189,7 @@ func settings() *viper.Viper {
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
case version != nil && *version:
|
case version != nil && *version:
|
||||||
fmt.Printf("NeoFS HTTP Gateway %s (%s)\n", Version, Build)
|
fmt.Printf("NeoFS HTTP Gateway %s\n", Version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue