diff --git a/core/executors/bulkexecutor_test.go b/core/executors/bulkexecutor_test.go index e634c63b..f3cfa8d6 100644 --- a/core/executors/bulkexecutor_test.go +++ b/core/executors/bulkexecutor_test.go @@ -78,7 +78,7 @@ func TestBulkExecutorFlush(t *testing.T) { wait.Wait() } -func TestBuldExecutorFlushSlowTasks(t *testing.T) { +func TestBulkExecutorFlushSlowTasks(t *testing.T) { const total = 1500 lock := new(sync.Mutex) result := make([]any, 0, 10000) diff --git a/core/executors/periodicalexecutor_test.go b/core/executors/periodicalexecutor_test.go index 60582c69..d9d0d39b 100644 --- a/core/executors/periodicalexecutor_test.go +++ b/core/executors/periodicalexecutor_test.go @@ -168,23 +168,23 @@ func TestPeriodicalExecutor_FlushPanic(t *testing.T) { func TestPeriodicalExecutor_Wait(t *testing.T) { var lock sync.Mutex - executer := NewBulkExecutor(func(tasks []any) { + executor := NewBulkExecutor(func(tasks []any) { lock.Lock() defer lock.Unlock() time.Sleep(10 * time.Millisecond) }, WithBulkTasks(1), WithBulkInterval(time.Second)) for i := 0; i < 10; i++ { - executer.Add(1) + executor.Add(1) } - executer.Flush() - executer.Wait() + executor.Flush() + executor.Wait() } func TestPeriodicalExecutor_WaitFast(t *testing.T) { const total = 3 var cnt int var lock sync.Mutex - executer := NewBulkExecutor(func(tasks []any) { + executor := NewBulkExecutor(func(tasks []any) { defer func() { cnt++ }() @@ -193,10 +193,10 @@ func TestPeriodicalExecutor_WaitFast(t *testing.T) { time.Sleep(10 * time.Millisecond) }, WithBulkTasks(1), WithBulkInterval(10*time.Millisecond)) for i := 0; i < total; i++ { - executer.Add(2) + executor.Add(2) } - executer.Flush() - executer.Wait() + executor.Flush() + executor.Wait() assert.Equal(t, total, cnt) } diff --git a/core/fs/temps.go b/core/fs/temps.go index 30bee2a8..66b57950 100644 --- a/core/fs/temps.go +++ b/core/fs/temps.go @@ -11,29 +11,29 @@ import ( // The file is kept as open, the caller should close the file handle, // and remove the file by name. func TempFileWithText(text string) (*os.File, error) { - tmpfile, err := os.CreateTemp(os.TempDir(), hash.Md5Hex([]byte(text))) + tmpFile, err := os.CreateTemp(os.TempDir(), hash.Md5Hex([]byte(text))) if err != nil { return nil, err } - if err := os.WriteFile(tmpfile.Name(), []byte(text), os.ModeTemporary); err != nil { + if err := os.WriteFile(tmpFile.Name(), []byte(text), os.ModeTemporary); err != nil { return nil, err } - return tmpfile, nil + return tmpFile, nil } // TempFilenameWithText creates the file with the given content, // and returns the filename (full path). // The caller should remove the file after use. func TempFilenameWithText(text string) (string, error) { - tmpfile, err := TempFileWithText(text) + tmpFile, err := TempFileWithText(text) if err != nil { return "", err } - filename := tmpfile.Name() - if err = tmpfile.Close(); err != nil { + filename := tmpFile.Name() + if err = tmpFile.Close(); err != nil { return "", err } diff --git a/core/iox/read_test.go b/core/iox/read_test.go index 56d1b359..8ab2dd59 100644 --- a/core/iox/read_test.go +++ b/core/iox/read_test.go @@ -40,11 +40,11 @@ b`, for _, test := range tests { t.Run(test.input, func(t *testing.T) { - tmpfile, err := fs.TempFilenameWithText(test.input) + tmpFile, err := fs.TempFilenameWithText(test.input) assert.Nil(t, err) - defer os.Remove(tmpfile) + defer os.Remove(tmpFile) - content, err := ReadText(tmpfile) + content, err := ReadText(tmpFile) assert.Nil(t, err) assert.Equal(t, test.expect, content) }) @@ -59,9 +59,9 @@ func TestReadTextLines(t *testing.T) { #a 3` - tmpfile, err := fs.TempFilenameWithText(text) + tmpFile, err := fs.TempFilenameWithText(text) assert.Nil(t, err) - defer os.Remove(tmpfile) + defer os.Remove(tmpFile) tests := []struct { options []TextReadOption @@ -87,7 +87,7 @@ func TestReadTextLines(t *testing.T) { for _, test := range tests { t.Run(stringx.Rand(), func(t *testing.T) { - lines, err := ReadTextLines(tmpfile, test.options...) + lines, err := ReadTextLines(tmpFile, test.options...) assert.Nil(t, err) assert.Equal(t, test.expectLines, len(lines)) }) diff --git a/tools/goctl/api/parser/g4/ast/ast.go b/tools/goctl/api/parser/g4/ast/ast.go index 63a4f6aa..f4174d18 100644 --- a/tools/goctl/api/parser/g4/ast/ast.go +++ b/tools/goctl/api/parser/g4/ast/ast.go @@ -250,11 +250,11 @@ func EqualDoc(spec1, spec2 Spec) bool { } func (v *ApiVisitor) getDoc(t TokenStream) []Expr { - return v.getHiddenTokensToLeft(t, api.COMEMNTS, false) + return v.getHiddenTokensToLeft(t, api.COMMENTS, false) } func (v *ApiVisitor) getComment(t TokenStream) Expr { - list := v.getHiddenTokensToRight(t, api.COMEMNTS) + list := v.getHiddenTokensToRight(t, api.COMMENTS) if len(list) == 0 { return nil } diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go index 568ce2b8..d790240e 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go @@ -237,4 +237,4 @@ const ( ApiParserLexerLetterOrDigit = 25 ) -const COMEMNTS = 88 +const COMMENTS = 88 diff --git a/tools/goctl/api/parser/g4/gen/api/baseparser.go b/tools/goctl/api/parser/g4/gen/api/baseparser.go index 41f486f1..fb34930a 100644 --- a/tools/goctl/api/parser/g4/gen/api/baseparser.go +++ b/tools/goctl/api/parser/g4/gen/api/baseparser.go @@ -175,7 +175,7 @@ func isNormal(p *ApiParserParser) bool { return len(list) > 1 } -// MatchTag returns a Boolean value, which returns true if it does matched, otherwise returns fase +// MatchTag returns a Boolean value, which returns true if it does matched, otherwise returns false func MatchTag(v string) bool { return matchRegex(v, tagRegex) }