diff --git a/.gitignore b/.gitignore index 24b24b618b2..a92e38f7306 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ dist .vscode test/Note.md .ossutil_checkpoint +bin +.run diff --git a/.golangci.yml b/.golangci.yml index ed78a75446c..97741b0beb5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,7 @@ linters: enable: - gofmt - goimports - - golint + - revive - stylecheck - goconst - gosimple diff --git a/cmd/cloud.go b/cmd/cloud.go index ea93ca22949..f31ca23aa8b 100644 --- a/cmd/cloud.go +++ b/cmd/cloud.go @@ -18,6 +18,8 @@ import ( "fmt" "os" + "github.com/fanux/sealos/pkg/logger" + "github.com/fanux/sealgate/cloud" "github.com/spf13/cobra" @@ -32,6 +34,7 @@ var cloudCmd = &cobra.Command{ Short: "sealos on cloud", Long: `sealos will create vms vpc switch security group on cloud and install kubernetes on it`, Run: func(cmd *cobra.Command, args []string) { + logger.Fatal("the cloud feature not support") fmt.Println("install kubernetes on cloud...") var key, sec string if key = os.Getenv("ACCESS_KEY_ID"); key != "" { diff --git a/cmd/delete.go b/cmd/delete.go index 6d25d9461af..bb5f6ee7c01 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -17,6 +17,8 @@ package cmd import ( "os" + "github.com/fanux/sealos/pkg/logger" + "github.com/spf13/cobra" "github.com/fanux/sealos/install" @@ -48,6 +50,7 @@ var deleteCmd = &cobra.Command{ _ = appmanager.DeleteApp(cfg, cfgFile) }, PreRun: func(cmd *cobra.Command, args []string) { + logger.Fatal("the delete app feature not support") if install.ExitDeleteCase(AppURL) { _ = cmd.Help() os.Exit(install.ErrorExitOSCase) diff --git a/cmd/install.go b/cmd/install.go index eced7d6d0cf..b654677d194 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -17,6 +17,8 @@ package cmd import ( "os" + "github.com/fanux/sealos/pkg/logger" + "github.com/spf13/cobra" "github.com/fanux/sealos/cert" @@ -26,7 +28,7 @@ import ( var ( AppURL string - installExample string = ` + installExample = ` # when usr -f flag , you need add something to config file. # Apply the configuration in values.yaml to a kubernetes Cluster. sealos install --pkg-url /root/dashboard.tar -f values.yaml @@ -51,6 +53,7 @@ var installCmd = &cobra.Command{ _ = appmanager.InstallApp(cfg, cfgFile) }, PreRun: func(cmd *cobra.Command, args []string) { + logger.Fatal("the install app feature not support") if install.ExitInstallCase(AppURL) { _ = cmd.Help() os.Exit(install.ErrorExitOSCase) diff --git a/cmd/version.go b/cmd/version.go index 5f479d52d20..da7f0dbd1d6 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -27,9 +27,7 @@ func init() { // see also https://github.com/LinuxSuRen/cobra-extension/issues/6 const name = "sealos" verCmd := extver.NewVersionCmd("fanux", name, name, func(ver string) string { - if strings.HasPrefix(ver, "v") { - ver = strings.TrimPrefix(ver, "v") - } + ver = strings.TrimPrefix(ver, "v") return fmt.Sprintf("https://github.com/fanux/sealos/releases/download/v%s/%s_%s_%s_%s.tar.gz", ver, name, ver, runtime.GOOS, runtime.GOARCH) }) diff --git a/docs/v3.0-playbook.md b/docs/v2.0.md similarity index 100% rename from docs/v3.0-playbook.md rename to docs/v2.0.md diff --git a/install/cloud.go b/install/cloud.go index 89cdda8c7d1..b22eb6474b0 100644 --- a/install/cloud.go +++ b/install/cloud.go @@ -155,9 +155,7 @@ func getLocalURL(version string) string { func newCommand(c *Cluster) string { //TODO should download it on master0 and copy to other nodes version := extver.GetVersion() - if strings.HasPrefix(version, "v") { - version = strings.TrimPrefix(version, "v") - } + version = strings.TrimPrefix(version, "v") releaseURL := fmt.Sprintf("https://github.com/fanux/sealos/releases/download/v%s/sealos_%s_linux_amd64.tar.gz", version, version) cmd := fmt.Sprintf("wget %s -O -| tar -xz && chmod +x sealos", releaseURL) diff --git a/install/utils.go b/install/utils.go index 576065d50d9..ed2f91a32fd 100644 --- a/install/utils.go +++ b/install/utils.go @@ -173,7 +173,7 @@ func IPFormat(host string) string { // RandString 生成随机字符串 func RandString(len int) string { - var r *rand.Rand = rand.New(rand.NewSource(time.Now().Unix())) + var r = rand.New(rand.NewSource(time.Now().Unix())) bytes := make([]byte, len) for i := 0; i < len; i++ { b := r.Intn(26) + 65 diff --git a/pkg/logger/log.go b/pkg/logger/log.go index a64d1e3c4a5..bd92e9c09af 100755 --- a/pkg/logger/log.go +++ b/pkg/logger/log.go @@ -153,7 +153,7 @@ func (r *LocalLogger) SetLogger(adapterName string, configs ...string) error { } config := append(configs, "{}")[0] - var num int = -1 + var num = -1 var i int var l *nameLogger for i, l = range r.outputs {