Skip to content

Commit

Permalink
chore: Clean up repeated package import (argoproj#13685)
Browse files Browse the repository at this point in the history
Signed-off-by: Zechun Chen <zechun.chen@daocloud.io>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
2 people authored and tesla59 committed Dec 16, 2023
1 parent 5b59717 commit 92af7f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
13 changes: 6 additions & 7 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
clusterpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster"
projectpkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/project"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/settings"
settingspkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/settings"
argoappv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
repoapiclient "github.com/argoproj/argo-cd/v2/reposerver/apiclient"
"github.com/argoproj/argo-cd/v2/reposerver/repository"
Expand Down Expand Up @@ -547,7 +546,7 @@ func appURLDefault(acdClient argocdclient.Client, appName string) string {
func appURL(ctx context.Context, acdClient argocdclient.Client, appName string) string {
conn, settingsIf := acdClient.NewSettingsClientOrDie()
defer argoio.Close(conn)
argoSettings, err := settingsIf.Get(ctx, &settingspkg.SettingsQuery{})
argoSettings, err := settingsIf.Get(ctx, &settings.SettingsQuery{})
errors.CheckError(err)

if argoSettings.URL != "" {
Expand Down Expand Up @@ -955,7 +954,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
errors.CheckError(err)
conn, settingsIf := clientset.NewSettingsClientOrDie()
defer argoio.Close(conn)
argoSettings, err := settingsIf.Get(ctx, &settingspkg.SettingsQuery{})
argoSettings, err := settingsIf.Get(ctx, &settings.SettingsQuery{})
errors.CheckError(err)
diffOption := &DifferenceOption{}
if revision != "" {
Expand Down Expand Up @@ -1020,7 +1019,7 @@ type DifferenceOption struct {
}

// findandPrintDiff ... Prints difference between application current state and state stored in git or locally, returns boolean as true if difference is found else returns false
func findandPrintDiff(ctx context.Context, app *argoappv1.Application, proj *argoappv1.AppProject, resources *application.ManagedResourcesResponse, argoSettings *settingspkg.Settings, appName string, diffOptions *DifferenceOption) bool {
func findandPrintDiff(ctx context.Context, app *argoappv1.Application, proj *argoappv1.AppProject, resources *application.ManagedResourcesResponse, argoSettings *settings.Settings, appName string, diffOptions *DifferenceOption) bool {
var foundDiffs bool
liveObjs, err := cmdutil.LiveObjects(resources.Items)
errors.CheckError(err)
Expand Down Expand Up @@ -1680,7 +1679,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co

errors.CheckError(err)
conn, settingsIf := acdClient.NewSettingsClientOrDie()
argoSettings, err := settingsIf.Get(ctx, &settingspkg.SettingsQuery{})
argoSettings, err := settingsIf.Get(ctx, &settings.SettingsQuery{})
errors.CheckError(err)
argoio.Close(conn)

Expand Down Expand Up @@ -1756,7 +1755,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
errors.CheckError(err)
conn, settingsIf := acdClient.NewSettingsClientOrDie()
defer argoio.Close(conn)
argoSettings, err := settingsIf.Get(ctx, &settingspkg.SettingsQuery{})
argoSettings, err := settingsIf.Get(ctx, &settings.SettingsQuery{})
errors.CheckError(err)
foundDiffs := false
fmt.Printf("====== Previewing differences between live and desired state of application %s ======\n", appQualifiedName)
Expand Down Expand Up @@ -2366,7 +2365,7 @@ func NewApplicationManifestsCommand(clientOpts *argocdclient.ClientOptions) *cob

settingsConn, settingsIf := clientset.NewSettingsClientOrDie()
defer argoio.Close(settingsConn)
argoSettings, err := settingsIf.Get(context.Background(), &settingspkg.SettingsQuery{})
argoSettings, err := settingsIf.Get(context.Background(), &settings.SettingsQuery{})
errors.CheckError(err)

clusterConn, clusterIf := clientset.NewClusterClientOrDie()
Expand Down
3 changes: 1 addition & 2 deletions cmd/argocd/commands/initialize/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package initialize
import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
flag "github.com/spf13/pflag"

"github.com/argoproj/argo-cd/v2/util/cli"
)

func RetrieveContextIfChanged(contextFlag *flag.Flag) string {
func RetrieveContextIfChanged(contextFlag *pflag.Flag) string {
if contextFlag != nil && contextFlag.Changed {
return contextFlag.Value.String()
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/argocd/commands/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"

"github.com/argoproj/argo-cd/v2/cmd/argocd/commands/headless"
Expand Down Expand Up @@ -454,7 +453,7 @@ func modifyResourcesList(list *[]metav1.GroupKind, add bool, listDesc string, gr
}
}
fmt.Printf("Group '%s' and kind '%s' is added to %s resources\n", group, kind, listDesc)
*list = append(*list, v1.GroupKind{Group: group, Kind: kind})
*list = append(*list, metav1.GroupKind{Group: group, Kind: kind})
return true
} else {
index := -1
Expand Down

0 comments on commit 92af7f4

Please sign in to comment.