Skip to content

Commit

Permalink
trivial. fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Apr 6, 2023
1 parent 6b37246 commit 073b86b
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 36 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ require (
github.com/google/uuid v1.3.0
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/openinfradev/tks-api v0.0.0-00010101000000-000000000000
github.com/openinfradev/tks-api v0.0.0-20230406025714-cfa98b05e0d3
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.7.0
golang.org/x/term v0.6.0
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.2.0
)
Expand Down Expand Up @@ -58,10 +58,10 @@ require (
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
go.mongodb.org/mongo-driver v1.10.2 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGV
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/openinfradev/tks-api v0.0.0-20230406025714-cfa98b05e0d3 h1:QD5HZvQShnhbZYrmXlMKFI3FUpxVX8UELkOuk+5PW4E=
github.com/openinfradev/tks-api v0.0.0-20230406025714-cfa98b05e0d3/go.mod h1:fTG0QJFcjqGFhuM2zleg9F94GRjJU73tbAR+XJs+/tk=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
Expand Down
2 changes: 0 additions & 2 deletions internal/commands/app-group-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func NewAppGroupCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
var (
name string
description string
creator string
clusterId string
appGroupType string
)
Expand Down Expand Up @@ -64,7 +63,6 @@ func NewAppGroupCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
command.Flags().StringVarP(&name, "name", "n", "", "the name of appGroup")

command.Flags().StringVarP(&description, "description", "d", "", "the description of appGroup")
command.Flags().StringVar(&creator, "creator", "", "the user's uuid for creating organization")
command.Flags().StringVarP(&appGroupType, "type", "t", "LMA", "the type of appgroup. ex) LMA, SERVICE_MESH")
helper.CheckError(command.MarkFlagRequired("type"))

Expand Down
2 changes: 0 additions & 2 deletions internal/commands/cluster-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func NewClusterCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
name string
organizationId string
description string
creator string
template string
region string
cloudSettingId string
Expand Down Expand Up @@ -76,7 +75,6 @@ func NewClusterCreateCommand(globalOpts *GlobalOptions) *cobra.Command {

command.Flags().StringVarP(&name, "name", "n", "", "the name of organization")
command.Flags().StringVarP(&description, "description", "d", "", "the description of organization")
command.Flags().StringVar(&creator, "creator", "", "the user's uuid for creating organization")
command.Flags().StringVar(&template, "template", "aws-reference", "the template for installation")

command.Flags().StringVar(&region, "region", "ap-northeast-2", "AWS region")
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/openinfradev/tks-client/internal/config"
"github.com/openinfradev/tks-client/internal/helper"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

func NewLoginCommand(globalOpts *GlobalOptions) *cobra.Command {
Expand Down Expand Up @@ -113,7 +113,7 @@ func PromptMessage(message, value string) string {
func PromptPassword(password string) string {
for password == "" {
fmt.Print("Password: ")
passwordRaw, err := terminal.ReadPassword(int(os.Stdin.Fd()))
passwordRaw, err := term.ReadPassword(int(os.Stdin.Fd()))
helper.CheckError(err)
password = string(passwordRaw)
fmt.Print("\n")
Expand Down
2 changes: 0 additions & 2 deletions internal/commands/organization-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func NewOrganizationCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
var (
name string
description string
creator string
)

var command = &cobra.Command{
Expand Down Expand Up @@ -56,7 +55,6 @@ func NewOrganizationCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
}
command.Flags().StringVar(&name, "name", "", "the name of organization")
command.Flags().StringVar(&description, "description", "", "the description of organization")
command.Flags().StringVar(&creator, "creator", "", "the user's uuid for creating organization")

return command
}
21 changes: 0 additions & 21 deletions internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

_apiClient "github.com/openinfradev/tks-api/pkg/api-client"
"github.com/openinfradev/tks-client/internal/config"
"github.com/openinfradev/tks-client/internal/helper"
)
Expand All @@ -24,17 +23,6 @@ type LocalConfig struct {
Token string `yaml:"token"`
}

var (
apiClient _apiClient.ApiClient
)

func init() {
cobra.OnInitialize(initConfig)
}

func initConfig() {
}

func NewCommand() *cobra.Command {
var (
opts GlobalOptions
Expand Down Expand Up @@ -89,15 +77,6 @@ func NewCommand() *cobra.Command {
return command
}

func contains(b []string, i string) bool {
for _, s := range b {
if s == i {
return true
}
}
return false
}

func CheckError(err error) {
if err != nil {
fmt.Println(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"strings"

"github.com/kballard/go-shellquote"
shellquote "github.com/kballard/go-shellquote"
)

var flags map[string]string
Expand Down
2 changes: 1 addition & 1 deletion internal/config/localconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path"
"strings"

"github.com/golang-jwt/jwt/v4"
jwt "github.com/golang-jwt/jwt/v4"
"sigs.k8s.io/yaml"
)

Expand Down
10 changes: 8 additions & 2 deletions internal/helper/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ func ModelToJson(in any) string {

func Transcode(in, out interface{}) {
buf := new(bytes.Buffer)
json.NewEncoder(buf).Encode(in)
json.NewDecoder(buf).Decode(out)
err := json.NewEncoder(buf).Encode(in)
if err != nil {
fmt.Println(err)
}
err = json.NewDecoder(buf).Decode(out)
if err != nil {
fmt.Println(err)
}
}

func CheckError(err error) {
Expand Down

0 comments on commit 073b86b

Please sign in to comment.