Skip to content

Commit bbf47c6

Browse files
committed
Inject version to correct package
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 31c1515 commit bbf47c6

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Version := $(shell git describe --tags --dirty)
22
GitCommit := $(shell git rev-parse HEAD)
33
LDFLAGS := "-s -w -X github.com/alexellis/kubetrim/pkg.Version=$(Version) -X github.com/alexellis/kubetrim/pkg.GitCommit=$(GitCommit)"
4-
PLATFORM := $(shell ./hack/platform-tag.sh)
54
SOURCE_DIRS = cmd pkg main.go
65
export GO111MODULE=on
76

@@ -20,10 +19,6 @@ gofmt:
2019
test:
2120
CGO_ENABLED=0 go test $(shell go list ./... | grep -v /vendor/|xargs echo) -cover
2221

23-
.PHONY: e2e
24-
e2e:
25-
CGO_ENABLED=0 go test github.com/alexellis/kubetrim/pkg/get -cover --tags e2e -v
26-
2722
.PHONY: dist
2823
dist:
2924
mkdir -p bin

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kubetrim
22
====================================================
33

4-
Tidy up any old or broken Kubernetes clusters and contexts from your kubeconfig.
4+
Tidy up old Kubernetes clusters from kubeconfig.
55

66
kubetrim tries to connect to each cluster in the current kubeconfig file, and removes any that are unreachable, or which error.
77

main.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path/filepath"
99
"time"
1010

11+
"github.com/alexellis/kubetrim/pkg"
1112
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1213
"k8s.io/client-go/kubernetes"
1314
_ "k8s.io/client-go/plugin/pkg/client/auth/azure"
@@ -22,12 +23,6 @@ import (
2223
)
2324

2425
var (
25-
// Version is the version of the tool
26-
Version = "dev"
27-
28-
// GitCommit is the git commit of the tool
29-
GitCommit = ""
30-
3126
writeFile bool
3227
)
3328

@@ -36,7 +31,9 @@ func main() {
3631
// set usage:
3732

3833
flag.Usage = func() {
39-
fmt.Printf("kubetrim Copyright Alex Ellis (c) 2024\n\n")
34+
35+
fmt.Printf("kubetrim (%s %s) Copyright Alex Ellis (c) 2024\n\n", pkg.Version, pkg.GitCommit)
36+
fmt.Print("Sponsor Alex on GitHub: https://github.com/sponsors/alexellis\n\n")
4037
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
4138
fmt.Fprintf(flag.CommandLine.Output(), "kubetrim removes contexts & clusters from your kubeconfig if they are not accessible.\n\n")
4239
fmt.Fprintf(flag.CommandLine.Output(), "Set the kubeconfig file to use through the KUBECONFIG environment variable\n")
@@ -62,7 +59,7 @@ func main() {
6259
os.Exit(1)
6360
}
6461

65-
fmt.Printf("kubetrim (%s %s) by Alex Ellis \n\nLoaded: %s. Checking..\n", Version, GitCommit, kubeconfig)
62+
fmt.Printf("kubetrim (%s %s) by Alex Ellis \n\nLoaded: %s. Checking..\n", pkg.Version, pkg.GitCommit, kubeconfig)
6663

6764
st := time.Now()
6865
// List of contexts to be deleted

pkg/version.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package pkg
2+
3+
var (
4+
// Version is the version of the tool
5+
Version = "dev"
6+
7+
// GitCommit is the git commit of the tool
8+
GitCommit = ""
9+
)

0 commit comments

Comments
 (0)