From 60c7edf8f80cebca88fdb123af78043c306da23e Mon Sep 17 00:00:00 2001 From: anqiansong Date: Mon, 8 Mar 2021 18:23:12 +0800 Subject: [PATCH] fix spelling (#551) --- tools/goctl/api/parser/g4/ast/api.go | 4 ++-- tools/goctl/api/parser/g4/ast/service.go | 4 ++-- tools/goctl/api/parser/g4/ast/type.go | 10 +++++----- tools/goctl/api/tsgen/gen.go | 2 +- tools/goctl/model/sql/gen/keys.go | 6 +++--- tools/goctl/tpl/templates.go | 6 +++--- tools/goctl/util/console/console.go | 4 ++-- tools/goctl/util/file.go | 6 +++--- tools/goctl/util/format/format.go | 2 +- tools/goctl/util/path.go | 2 +- tools/goctl/util/stringx/string.go | 2 +- tools/goctl/util/templatex.go | 4 ++-- tools/goctl/vars/settings.go | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tools/goctl/api/parser/g4/ast/api.go b/tools/goctl/api/parser/g4/ast/api.go index 3b95a694..45a12c3d 100644 --- a/tools/goctl/api/parser/g4/ast/api.go +++ b/tools/goctl/api/parser/g4/ast/api.go @@ -33,7 +33,7 @@ func (v *ApiVisitor) VisitApi(ctx *api.ApiContext) interface{} { for _, each := range ctx.AllSpec() { root := each.Accept(v).(*Api) v.acceptSyntax(root, &final) - v.accetpImport(root, &final) + v.acceptImport(root, &final) v.acceptInfo(root, &final) v.acceptType(root, &final) v.acceptService(root, &final) @@ -133,7 +133,7 @@ func (v *ApiVisitor) acceptInfo(root *Api, final *Api) { } } -func (v *ApiVisitor) accetpImport(root *Api, final *Api) { +func (v *ApiVisitor) acceptImport(root *Api, final *Api) { for _, imp := range root.Import { if _, ok := final.importM[imp.Value.Text()]; ok { v.panic(imp.Import, fmt.Sprintf("duplicate import '%s'", imp.Value.Text())) diff --git a/tools/goctl/api/parser/g4/ast/service.go b/tools/goctl/api/parser/g4/ast/service.go index 3ac7ae4b..ab4ba7b8 100644 --- a/tools/goctl/api/parser/g4/ast/service.go +++ b/tools/goctl/api/parser/g4/ast/service.go @@ -50,7 +50,7 @@ type AtDoc struct { Kv []*KvExpr } -// AtHandler describes service hander ast for api syntax +// AtHandler describes service handler ast for api syntax type AtHandler struct { AtHandlerToken Expr Name Expr @@ -630,7 +630,7 @@ func (s *Service) Equal(v interface{}) bool { return s.ServiceApi.Equal(service.ServiceApi) } -// Get returns the tergate KV by specified key +// Get returns the target KV by specified key func (kv KV) Get(key string) Expr { for _, each := range kv { if each.Key.Text() == key { diff --git a/tools/goctl/api/parser/g4/ast/type.go b/tools/goctl/api/parser/g4/ast/type.go index ffad1c52..b105419c 100644 --- a/tools/goctl/api/parser/g4/ast/type.go +++ b/tools/goctl/api/parser/g4/ast/type.go @@ -17,7 +17,7 @@ type ( NameExpr() Expr } - // TypeAlias describes alias ast for api syatax + // TypeAlias describes alias ast for api syntax TypeAlias struct { Name Expr Assign Expr @@ -26,7 +26,7 @@ type ( CommentExpr Expr } - // TypeStruct describes structure ast for api syatax + // TypeStruct describes structure ast for api syntax TypeStruct struct { Name Expr Struct Expr @@ -225,7 +225,7 @@ func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) interfa alias.DocExpr = v.getDoc(ctx) alias.CommentExpr = v.getComment(ctx) // todo: reopen if necessary - v.panic(alias.Name, "unsupport alias") + v.panic(alias.Name, "unsupported alias") return &alias } @@ -238,7 +238,7 @@ func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) interface{} { alias.DocExpr = v.getDoc(ctx) alias.CommentExpr = v.getComment(ctx) // todo: reopen if necessary - v.panic(alias.Name, "unsupport alias") + v.panic(alias.Name, "unsupported alias") return &alias } @@ -319,7 +319,7 @@ func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) interface{} { if ctx.GetTime() != nil { // todo: reopen if it is necessary timeExpr := v.newExprWithToken(ctx.GetTime()) - v.panic(timeExpr, "unsupport time.Time") + v.panic(timeExpr, "unsupported time.Time") return &Time{Literal: timeExpr} } if ctx.PointerType() != nil { diff --git a/tools/goctl/api/tsgen/gen.go b/tools/goctl/api/tsgen/gen.go index 7fbb2a30..01e2d395 100644 --- a/tools/goctl/api/tsgen/gen.go +++ b/tools/goctl/api/tsgen/gen.go @@ -11,7 +11,7 @@ import ( "github.com/urfave/cli" ) -// TsCommand provides the entry to generting typescript codes +// TsCommand provides the entry to generate typescript codes func TsCommand(c *cli.Context) error { apiFile := c.String("api") dir := c.String("dir") diff --git a/tools/goctl/model/sql/gen/keys.go b/tools/goctl/model/sql/gen/keys.go index b7930072..212cce79 100644 --- a/tools/goctl/model/sql/gen/keys.go +++ b/tools/goctl/model/sql/gen/keys.go @@ -11,15 +11,15 @@ import ( // Key describes cache key type Key struct { - // VarLeft describes the varible of cache key expression which likes cacheUserIdPrefix + // VarLeft describes the variable of cache key expression which likes cacheUserIdPrefix VarLeft string // VarRight describes the value of cache key expression which likes "cache#user#id#" VarRight string // VarExpression describes the cache key expression which likes cacheUserIdPrefix = "cache#user#id#" VarExpression string - // KeyLeft describes the varible of key definiation expression which likes userKey + // KeyLeft describes the variable of key definition expression which likes userKey KeyLeft string - // KeyRight describes the value of key definiation expression which likes fmt.Sprintf("%s%v", cacheUserPrefix, user) + // KeyRight describes the value of key definition expression which likes fmt.Sprintf("%s%v", cacheUserPrefix, user) KeyRight string // DataKeyRight describes data key likes fmt.Sprintf("%s%v", cacheUserPrefix, data.User) DataKeyRight string diff --git a/tools/goctl/tpl/templates.go b/tools/goctl/tpl/templates.go index ce38b7a0..05b38ab4 100644 --- a/tools/goctl/tpl/templates.go +++ b/tools/goctl/tpl/templates.go @@ -16,7 +16,7 @@ import ( const templateParentPath = "/" -// GenTemplates wtites the latest template text into file which is not exists +// GenTemplates writes the latest template text into file which is not exists func GenTemplates(ctx *cli.Context) error { if err := errorx.Chain( func() error { @@ -70,8 +70,8 @@ func CleanTemplates(_ *cli.Context) error { return nil } -// UpdateTemplates wtites the latest template text into file, -// it will delete the oldler templates if there are exists +// UpdateTemplates writes the latest template text into file, +// it will delete the older templates if there are exists func UpdateTemplates(ctx *cli.Context) (err error) { category := ctx.String("category") defer func() { diff --git a/tools/goctl/util/console/console.go b/tools/goctl/util/console/console.go index a420e7b0..c20fde6a 100644 --- a/tools/goctl/util/console/console.go +++ b/tools/goctl/util/console/console.go @@ -9,7 +9,7 @@ import ( type ( // Console wraps from the fmt.Sprintf, - // by default, it implemented the colorConsole to provide the colorful output to the consle + // by default, it implemented the colorConsole to provide the colorful output to the console // and the ideaConsole to output with prefix for the plugin of intellij Console interface { Success(format string, a ...interface{}) @@ -81,7 +81,7 @@ func (c *colorConsole) Must(err error) { } } -// NewIdeaConsole returns a instace of ideaConsole +// NewIdeaConsole returns a instance of ideaConsole func NewIdeaConsole() Console { return &ideaConsole{} } diff --git a/tools/goctl/util/file.go b/tools/goctl/util/file.go index 6603497f..cb820a6a 100644 --- a/tools/goctl/util/file.go +++ b/tools/goctl/util/file.go @@ -27,7 +27,7 @@ func CreateIfNotExist(file string) (*os.File, error) { return os.Create(file) } -// RemoveIfExist deletes the specficed file if it is exists +// RemoveIfExist deletes the specified file if it is exists func RemoveIfExist(filename string) error { if !FileExists(filename) { return nil @@ -36,7 +36,7 @@ func RemoveIfExist(filename string) error { return os.Remove(filename) } -// RemoveOrQuit deletes the specficed file if read a permit command from stdin +// RemoveOrQuit deletes the specified file if read a permit command from stdin func RemoveOrQuit(filename string) error { if !FileExists(filename) { return nil @@ -49,7 +49,7 @@ func RemoveOrQuit(filename string) error { return os.Remove(filename) } -// FileExists returns true if the specficed file is exists +// FileExists returns true if the specified file is exists func FileExists(file string) bool { _, err := os.Stat(file) return err == nil diff --git a/tools/goctl/util/format/format.go b/tools/goctl/util/format/format.go index 039f7e81..e69640a3 100644 --- a/tools/goctl/util/format/format.go +++ b/tools/goctl/util/format/format.go @@ -18,7 +18,7 @@ const ( upper ) -// ErrNamingFormat defines an error for unknown fomat +// ErrNamingFormat defines an error for unknown format var ErrNamingFormat = errors.New("unsupported format") type ( diff --git a/tools/goctl/util/path.go b/tools/goctl/util/path.go index 3092b749..a1e07181 100644 --- a/tools/goctl/util/path.go +++ b/tools/goctl/util/path.go @@ -33,7 +33,7 @@ func MkdirIfNotExist(dir string) error { return nil } -// PathFromGoSrc returns the path whihout slash where has been trim the prefix $GOPATH +// PathFromGoSrc returns the path without slash where has been trim the prefix $GOPATH func PathFromGoSrc() (string, error) { dir, err := os.Getwd() if err != nil { diff --git a/tools/goctl/util/stringx/string.go b/tools/goctl/util/stringx/string.go index 3df98449..bbfc8203 100644 --- a/tools/goctl/util/stringx/string.go +++ b/tools/goctl/util/stringx/string.go @@ -6,7 +6,7 @@ import ( "unicode" ) -// String provides for coverting the source text into other spell case,like lower,snake,camel +// String provides for converting the source text into other spell case,like lower,snake,camel type String struct { source string } diff --git a/tools/goctl/util/templatex.go b/tools/goctl/util/templatex.go index 3feae08a..19942605 100644 --- a/tools/goctl/util/templatex.go +++ b/tools/goctl/util/templatex.go @@ -17,7 +17,7 @@ type DefaultTemplate struct { savePath string } -// With returns a instace of DefaultTemplate +// With returns a instance of DefaultTemplate func With(name string) *DefaultTemplate { return &DefaultTemplate{ name: name, @@ -30,7 +30,7 @@ func (t *DefaultTemplate) Parse(text string) *DefaultTemplate { return t } -// GoFmt sets the value to goFmt and marks the generated codes will be formated or not +// GoFmt sets the value to goFmt and marks the generated codes will be formatted or not func (t *DefaultTemplate) GoFmt(format bool) *DefaultTemplate { t.goFmt = format return t diff --git a/tools/goctl/vars/settings.go b/tools/goctl/vars/settings.go index fdc18fc3..0e255f3d 100644 --- a/tools/goctl/vars/settings.go +++ b/tools/goctl/vars/settings.go @@ -3,7 +3,7 @@ package vars const ( // ProjectName the const value of zero ProjectName = "zero" - // ProjectOpenSourceURL the githb url of go-zero + // ProjectOpenSourceURL the github url of go-zero ProjectOpenSourceURL = "github.com/tal-tech/go-zero" // OsWindows windows os OsWindows = "windows"