From 59ab8dfd539c6ad5fac953869b5528a30c364ecf Mon Sep 17 00:00:00 2001 From: hhyasdf <552483776@qq.com> Date: Tue, 18 Jul 2023 14:00:34 +0800 Subject: [PATCH] chore: remove useless code --- cmd/image-syncer.go | 4 +--- pkg/client/config.go | 2 +- pkg/task/rule.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/image-syncer.go b/cmd/image-syncer.go index b890e3d..4c20c5e 100644 --- a/cmd/image-syncer.go +++ b/cmd/image-syncer.go @@ -11,7 +11,7 @@ import ( ) var ( - logPath, configFile, authFile, imageFile, defaultRegistry, defaultNamespace string + logPath, configFile, authFile, imageFile, defaultRegistry string procNum, retries int @@ -50,8 +50,6 @@ func init() { RootCmd.PersistentFlags().StringVar(&logPath, "log", "", "log file path (default in os.Stderr)") RootCmd.PersistentFlags().StringVar(&defaultRegistry, "registry", os.Getenv("DEFAULT_REGISTRY"), "default destination registry url when destination registry is not given in the config file, can also be set with DEFAULT_REGISTRY environment value") - RootCmd.PersistentFlags().StringVar(&defaultNamespace, "namespace", os.Getenv("DEFAULT_NAMESPACE"), - "default destination namespace when destination namespace is not given in the config file, can also be set with DEFAULT_NAMESPACE environment value") RootCmd.PersistentFlags().IntVarP(&procNum, "proc", "p", 5, "numbers of working goroutines") RootCmd.PersistentFlags().IntVarP(&retries, "retries", "r", 2, "times to retry failed task") RootCmd.PersistentFlags().StringArrayVar(&osFilterList, "os", []string{}, "os list to filter source tags, not works for docker v2 schema1 and OCI media") diff --git a/pkg/client/config.go b/pkg/client/config.go index c4630fa..3f9eb1b 100644 --- a/pkg/client/config.go +++ b/pkg/client/config.go @@ -25,7 +25,7 @@ type Config struct { // only images with selected architecture can be sync archFilterList []string - // If the destination registry and namespace is not provided, + // If the destination is not provided, // the source image will be synchronized to defaultDestRegistry with origin repo name and tag. defaultDestRegistry string } diff --git a/pkg/task/rule.go b/pkg/task/rule.go index ab0d7b5..1ee9cac 100644 --- a/pkg/task/rule.go +++ b/pkg/task/rule.go @@ -47,7 +47,7 @@ func (r *RuleTask) Run() ([]Task, string, error) { r.destination = r.defaultDestRegistry + "/" + sourceURLs[0].GetRepo() } else { - return nil, "", fmt.Errorf("the default registry and namespace should not be nil if you want to use them") + return nil, "", fmt.Errorf("the default registry should not be nil if you want to use them") } }