Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deps #396

Merged
merged 2 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions cmd/aws-iam-authenticator/version.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import (
"encoding/json"
"fmt"
"os"

"github.com/spf13/cobra"
goversion "go.hein.dev/go-version"
"gopkg.in/yaml.v2"
"sigs.k8s.io/aws-iam-authenticator/pkg"
)

Expand All @@ -17,8 +19,22 @@ var (
Short: "Version will output the current build information",
Long: ``,
Run: func(_ *cobra.Command, _ []string) {
resp := goversion.FuncWithOutput(shortened, pkg.Version, pkg.CommitID, pkg.BuildDate, output)
fmt.Print(resp)
ver := struct {
Version string `json:"Version,omitempty"`
Commit string `json:"Commit,omitempty"`
Date string `json:"Date,omitempty"`
}{pkg.Version, pkg.CommitID, date}

switch {
case shortened:
fmt.Println(pkg.Version)
case output == "json":
json.NewEncoder(os.Stdout).Encode(ver)
case output == "yaml":
yaml.NewEncoder(os.Stdout).Encode(ver)
default:
fmt.Fprintln(os.Stderr, "unknown version option")
}
return
},
}
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.0
go.hein.dev/go-version v0.1.0
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.22.1
k8s.io/apiextensions-apiserver v0.22.1 // indirect
k8s.io/apimachinery v0.22.1
k8s.io/client-go v0.22.1
k8s.io/code-generator v0.22.1
Expand Down
449 changes: 70 additions & 379 deletions go.sum

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion vendor/go.hein.dev/go-version/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions vendor/go.hein.dev/go-version/.travis.yml

This file was deleted.

36 changes: 0 additions & 36 deletions vendor/go.hein.dev/go-version/CHANGELOG.md

This file was deleted.

31 changes: 0 additions & 31 deletions vendor/go.hein.dev/go-version/CONTRIBUTING.adoc

This file was deleted.

201 changes: 0 additions & 201 deletions vendor/go.hein.dev/go-version/LICENSE.txt

This file was deleted.

38 changes: 0 additions & 38 deletions vendor/go.hein.dev/go-version/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion vendor/go.hein.dev/go-version/VERSION

This file was deleted.

Loading