소스 검색

fix spelling (#551)

anqiansong 3 년 전
부모
커밋
60c7edf8f8

+ 2 - 2
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()))

+ 2 - 2
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 {

+ 5 - 5
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 {

+ 1 - 1
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")

+ 3 - 3
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

+ 3 - 3
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() {

+ 2 - 2
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{}
 }

+ 3 - 3
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

+ 1 - 1
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 (

+ 1 - 1
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 {

+ 1 - 1
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
 }

+ 2 - 2
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

+ 1 - 1
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"