diff --git a/Makefile b/Makefile index 95d6f95f7b..f06842cdf2 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ fmt: @echo "gofmt (simplify)" @gofmt -s -l -w $(FILES) 2>&1 @echo "goimports (if installed)" - $(shell gimports -w $(FILES) 2>/dev/null) + $(shell goimports -w $(FILES) 2>/dev/null) tools/bin/errcheck: tools/check/go.mod cd tools/check; \ diff --git a/cmd/mirror.go b/cmd/mirror.go index 58330cf9a8..68a5ea07cb 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -352,7 +352,7 @@ func newMirrorPublishCmd() *cobra.Command { publishInfo.Stand = &standalone publishInfo.Hide = &hidden } else if flagSet.Exist("standalone") || flagSet.Exist("hide") { - fmt.Println("This is not a new component, --standalone and --hide flag will be omited") + fmt.Println("This is not a new component, --standalone and --hide flag will be omitted") } m = repository.UpdateManifestForPublish(m, component, version, entry, goos, goarch, desc, v1manifest.FileHash{ diff --git a/components/bench/ycsb.go b/components/bench/ycsb.go index 997c1bbab4..62292f3ace 100644 --- a/components/bench/ycsb.go +++ b/components/bench/ycsb.go @@ -16,6 +16,9 @@ package main import ( "context" "fmt" + "runtime" + "strings" + "github.com/magiconair/properties" _ "github.com/pingcap/go-ycsb/db/tikv" "github.com/pingcap/go-ycsb/pkg/client" @@ -23,8 +26,6 @@ import ( _ "github.com/pingcap/go-ycsb/pkg/workload" "github.com/pingcap/go-ycsb/pkg/ycsb" "github.com/spf13/cobra" - "runtime" - "strings" ) type ycsbConfig struct { diff --git a/components/cluster/command/deploy.go b/components/cluster/command/deploy.go index 7c1ec4e728..c7fe46d199 100644 --- a/components/cluster/command/deploy.go +++ b/components/cluster/command/deploy.go @@ -28,7 +28,6 @@ import ( "github.com/pingcap/tiup/pkg/errutil" telemetry2 "github.com/pingcap/tiup/pkg/telemetry" "github.com/pingcap/tiup/pkg/utils" - tiuputils "github.com/pingcap/tiup/pkg/utils" "github.com/spf13/cobra" ) @@ -47,7 +46,7 @@ var ( func newDeploy() *cobra.Command { opt := cluster.DeployOptions{ - IdentityFile: path.Join(tiuputils.UserHome(), ".ssh", "id_rsa"), + IdentityFile: path.Join(utils.UserHome(), ".ssh", "id_rsa"), } cmd := &cobra.Command{ Use: "deploy ", @@ -92,7 +91,7 @@ func newDeploy() *cobra.Command { }, } - cmd.Flags().StringVarP(&opt.User, "user", "u", tiuputils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") + cmd.Flags().StringVarP(&opt.User, "user", "u", utils.CurrentUser(), "The user name to login via SSH. The user must has root (or sudo) privilege.") cmd.Flags().BoolVarP(&opt.SkipCreateUser, "skip-create-user", "", false, "Skip creating the user specified in topology (experimental).") cmd.Flags().StringVarP(&opt.IdentityFile, "identity_file", "i", opt.IdentityFile, "The path of the SSH identity file. If specified, public key authentication will be used.") cmd.Flags().BoolVarP(&opt.UsePassword, "password", "p", false, "Use password of target hosts. If specified, password authentication will be used.") diff --git a/components/playground/instance/process.go b/components/playground/instance/process.go index 1e2390c9f6..58ffd2d646 100644 --- a/components/playground/instance/process.go +++ b/components/playground/instance/process.go @@ -24,7 +24,7 @@ type Process interface { Cmd() *exec.Cmd } -// process implementes Process +// process implements Process type process struct { cmd *exec.Cmd startTime time.Time diff --git a/pkg/cluster/module/shell.go b/pkg/cluster/module/shell.go index 8023ff5ea1..63fca224d1 100644 --- a/pkg/cluster/module/shell.go +++ b/pkg/cluster/module/shell.go @@ -22,7 +22,7 @@ import ( // ShellModuleConfig is the configurations used to initialize a TiOpsModuleSystemd type ShellModuleConfig struct { Command string // the command to run - Sudo bool // whether use root priviledge to run the command + Sudo bool // whether use root privilege to run the command Chdir string // change working directory before running the command UseShell bool // whether use shell to invoke the command } diff --git a/pkg/cluster/module/systemd.go b/pkg/cluster/module/systemd.go index 86b7d0ece3..ce5e849926 100644 --- a/pkg/cluster/module/systemd.go +++ b/pkg/cluster/module/systemd.go @@ -57,7 +57,7 @@ func NewSystemdModule(config SystemdModuleConfig) *SystemdModule { switch config.Scope { case SystemdScopeUser: - sudo = false // `--user` scope does not need root priviledge + sudo = false // `--user` scope does not need root privilege fallthrough case SystemdScopeGlobal: systemctl = fmt.Sprintf("%s --%s", systemctl, config.Scope) diff --git a/pkg/cluster/operation/operation.go b/pkg/cluster/operation/operation.go index 645a80269c..89735a5a10 100644 --- a/pkg/cluster/operation/operation.go +++ b/pkg/cluster/operation/operation.go @@ -28,7 +28,7 @@ type Options struct { Force bool // Option for upgrade subcommand SSHTimeout uint64 // timeout in seconds when connecting an SSH server OptTimeout uint64 // timeout in seconds for operations that support it, not to confuse with SSH timeout - APITimeout uint64 // timeout in seconds for API operations that support it, like transfering store leader + APITimeout uint64 // timeout in seconds for API operations that support it, like transferring store leader IgnoreConfigCheck bool // should we ignore the config check result after init config NativeSSH bool // should use native ssh client or builtin easy ssh (deprecated, shoule use SSHType) SSHType executor.SSHType // the ssh type: 'builtin', 'system', 'none' diff --git a/pkg/cluster/spec/server_config.go b/pkg/cluster/spec/server_config.go index f657d59eda..f279602269 100644 --- a/pkg/cluster/spec/server_config.go +++ b/pkg/cluster/spec/server_config.go @@ -40,7 +40,7 @@ const ( migrateLockName = "tiup-migrate.lck" ) -// ErrorCheckConfig represent error occured in config check stage +// ErrorCheckConfig represent error occurred in config check stage var ErrorCheckConfig = errors.New("check config failed") // strKeyMap tries to convert `map[interface{}]interface{}` to `map[string]interface{}` diff --git a/pkg/cluster/spec/validate_test.go b/pkg/cluster/spec/validate_test.go index 634cf02fa6..ee867ce8b1 100644 --- a/pkg/cluster/spec/validate_test.go +++ b/pkg/cluster/spec/validate_test.go @@ -678,7 +678,7 @@ tikv_servers: err = CheckTiKVLabels([]string{"zone", "host"}, &topo) c.Assert(err, IsNil) - // 2 tikv on the same host with diffrent config style + // 2 tikv on the same host with different config style topo = Specification{} err = yaml.Unmarshal([]byte(` tikv_servers: diff --git a/pkg/cluster/template/install/local_install.sh.go b/pkg/cluster/template/install/local_install.sh.go index 93466173bf..f37e9d475b 100644 --- a/pkg/cluster/template/install/local_install.sh.go +++ b/pkg/cluster/template/install/local_install.sh.go @@ -73,7 +73,7 @@ chmod 755 "$bin_dir/tiup" bold=$(tput bold 2>/dev/null) sgr0=$(tput sgr0 2>/dev/null) -# Refrence: https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix +# Reference: https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix shell=$(echo $SHELL | awk 'BEGIN {FS="/";} { print $NF }') echo "Detected shell: ${bold}$shell${sgr0}" if [ -f "${HOME}/.${shell}_profile" ]; then diff --git a/pkg/meta/err.go b/pkg/meta/err.go index 6a35a6a402..19f463524e 100644 --- a/pkg/meta/err.go +++ b/pkg/meta/err.go @@ -53,7 +53,7 @@ func (e *ValidateErr) Is(target error) bool { return false } - // check for interface Value seperately + // check for interface Value separately if e.Value != nil && t.Value != nil && (!reflect.ValueOf(e.Value).IsValid() && !reflect.ValueOf(t.Value).IsValid()) { return false diff --git a/pkg/repository/v1manifest/repo.go b/pkg/repository/v1manifest/repo.go index cc461f8d2f..00ee893112 100644 --- a/pkg/repository/v1manifest/repo.go +++ b/pkg/repository/v1manifest/repo.go @@ -461,9 +461,6 @@ func SignManifest(role ValidManifest, keys ...*KeyInfo) (*Manifest, error) { if err != nil { return nil, errors.Trace(err) } - if err != nil { - return nil, errors.Trace(err) - } signs = append(signs, Signature{ KeyID: id, Sig: sign, diff --git a/pkg/utils/diff.go b/pkg/utils/diff.go index 2c7e7dc3ed..2ea867d754 100644 --- a/pkg/utils/diff.go +++ b/pkg/utils/diff.go @@ -28,7 +28,7 @@ const ( validateTagEditable = "editable" validateTagIgnore = "ignore" // r3labs/diff drops everything after the first ',' in the tag value, so we use a different - // seperator for the tag value and its options + // separator for the tag value and its options validateTagSeperator = ":" ) diff --git a/pkg/utils/diff_test.go b/pkg/utils/diff_test.go index 24539e20bf..7323f22f6b 100644 --- a/pkg/utils/diff_test.go +++ b/pkg/utils/diff_test.go @@ -70,7 +70,7 @@ strs: err = ValidateSpecDiff(d1, d2) c.Assert(err, IsNil) - // add editable element (without specifing alias) + // add editable element (without specifying alias) err = yaml.Unmarshal([]byte(` ints: [11, 13, 12] strs: diff --git a/server/handler/error.go b/server/handler/error.go index 404406043d..bb78deb079 100644 --- a/server/handler/error.go +++ b/server/handler/error.go @@ -54,7 +54,7 @@ var ( ErrorManifestMissing = newHandlerError(http.StatusNotFound, "MANIFEST NOT FOUND", "that component doesn't have manifest yet") // ErrorInvalidTarball indicates that the tarball is not valid (eg. too large) ErrorInvalidTarball = newHandlerError(http.StatusBadRequest, "INVALID TARBALL", "the tarball content is not valid") - // ErrorInvalidManifest indicates that the manfiest is not valid + // ErrorInvalidManifest indicates that the manifest is not valid ErrorInvalidManifest = newHandlerError(http.StatusBadRequest, "INVALID MANIFEST", "the manifest content is not valid") // ErrorInternalError indicates that an internal error happened ErrorInternalError = newHandlerError(http.StatusInternalServerError, "INTERNAL ERROR", "an internal error happened") diff --git a/server/handler/handler.go b/server/handler/handler.go index db45ff22a1..85b4902f37 100644 --- a/server/handler/handler.go +++ b/server/handler/handler.go @@ -36,7 +36,7 @@ func init() { Message: e.Error(), } } - log.Debugf("Unknow error occured: %s", err.Error()) + log.Debugf("Unknow error occurred: %s", err.Error()) return &errorMessage{ Status: "UNKNOWN_ERROR", Message: "make sure your request is valid",