Skip to content

Commit

Permalink
Use revision
Browse files Browse the repository at this point in the history
  • Loading branch information
kzys committed Jan 9, 2020
1 parent 11cd5eb commit 1265ce2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all: agent

agent: *.go $(GOMOD) $(GOSUM)
ifneq ($(STATIC_AGENT),)
CGO_ENABLED=0 go build -installsuffix cgo -a -ldflags "-s -X main.version=$(VERSION)" $(EXTRAGOARGS) -o agent
CGO_ENABLED=0 go build -installsuffix cgo -a -ldflags "-s -X main.revision=$(REVISION)" $(EXTRAGOARGS) -o agent
else
go build $(EXTRAGOARGS) -ldflags "-X main.version=$(VERSION)" -o agent
endif
Expand Down
12 changes: 6 additions & 6 deletions agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ const (
)

var (
version string
revision string
)

func main() {
var (
port int
debug bool
port int
debug bool
version bool
)

Expand Down Expand Up @@ -169,7 +169,7 @@ func main() {
}

func showVersion() {
// After Go 1.12, We can use runtime/debug.BuildInfo instead.
// https://github.com/golang/go/issues/22147
fmt.Printf("containerd Firecracker agent %s\n", version)
// Once https://github.com/golang/go/issues/29814 is resolved,
// we can use runtime/debug.BuildInfo instead of calling git(1) from Makefile
fmt.Printf("containerd Firecracker agent %s\n", revision)
}

0 comments on commit 1265ce2

Please sign in to comment.