Skip to content

Commit

Permalink
Fix getting go version
Browse files Browse the repository at this point in the history
  • Loading branch information
vsliouniaev committed Oct 29, 2019
1 parent de87001 commit e5f3250
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eox pipefail
. .cicd/env.sh

build() {
ldflags="-X $mod/core.Version=$vers -X $mod/core.BuildTime=$buildTime -X \"$mod/core.GoVersion=$goVersion\""
ldflags="-X $mod/core.Version=$vers -X $mod/core.BuildTime=$buildTime"
docker run --rm \
-v "$(pwd):/go/src/$mod" \
-w "/go/src/$mod" \
Expand Down
1 change: 0 additions & 1 deletion .cicd/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export mod="github.com/jet/kube-webhook-certgen" #"$(head -n 1 go.mod | cut -f 2
export rev=$(git rev-parse HEAD)
export tag=$(git tag --points-at HEAD)
export buildTime=$(date -u +%FT%TZ)
export goVersion=$(go version)
export DOCKER_CLI_EXPERIMENTAL=enabled

# This will break if there are multiple tags set to the same commit, which is what we want
Expand Down
3 changes: 2 additions & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"runtime"

"github.com/jet/kube-webhook-certgen/core"
"github.com/spf13/cobra"
Expand All @@ -16,7 +17,7 @@ var version = &cobra.Command{
func versionCmdRun(cmd *cobra.Command, args []string) {
fmt.Printf("%s\n", core.Version)
fmt.Printf("build %s\n", core.BuildTime)
fmt.Printf("%s\n", core.GoVersion)
fmt.Printf("%s\n", runtime.Version())
}

func init() {
Expand Down
2 changes: 0 additions & 2 deletions core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ var (
Version = "0.0.1-dev"
// BuildTime is the timestamp (ISO-8601) of the build
BuildTime = "0001-01-01T00:00:00Z"
// GoVersion is the version of Go this was built with
GoVersion = "go version unknown"
)

0 comments on commit e5f3250

Please sign in to comment.