From c3cee98fa407575f6c95f58bb3ec4f4068b4457b Mon Sep 17 00:00:00 2001 From: ginokent <29125616+ginokent@users.noreply.github.com> Date: Sun, 12 Nov 2023 03:08:49 +0900 Subject: [PATCH] fix: modify generated columns function names --- go.mod | 2 +- go.sum | 4 +- internal/arcgen/lang/go/extract_source.go | 9 +- internal/arcgen/lang/go/generate.go | 126 ++++++++++++-------- internal/arcgen/lang/go/generate_test.go | 116 ++++++++++++++++-- internal/arcgen/lang/go/parse.go | 6 +- internal/arcgen/lang/go/parse_test.go | 22 ++++ internal/arcgen/lang/go/source.go | 4 +- internal/arcgen/lang/go/tests/.gitignore | 2 +- internal/arcgen/lang/go/tests/common.golden | 6 +- internal/config/config.go | 18 +-- internal/config/method_prefix_global.go | 8 +- pkg/errors/errors.go | 4 +- 13 files changed, 234 insertions(+), 93 deletions(-) create mode 100644 internal/arcgen/lang/go/parse_test.go diff --git a/go.mod b/go.mod index 68d0cac..fdb0ab3 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/kunitsucom/arcgen go 1.21.4 -require github.com/kunitsucom/util.go v0.0.59-rc.6 +require github.com/kunitsucom/util.go v0.0.59-rc.7 diff --git a/go.sum b/go.sum index 9f8ecef..04993ab 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -github.com/kunitsucom/util.go v0.0.59-rc.6 h1:QJkGrG4ZlzbLcYCkbdOoUuJjFnCgUKfT7/58aeFVNbc= -github.com/kunitsucom/util.go v0.0.59-rc.6/go.mod h1:bYFf2JvRqVF1brBtpdt3xkkTGJBxmYBxZlItrc/lf7Y= +github.com/kunitsucom/util.go v0.0.59-rc.7 h1:hckWP+/z4mY14Fe304+8yvMQAyxXUMMG2yaccxnBlJY= +github.com/kunitsucom/util.go v0.0.59-rc.7/go.mod h1:bYFf2JvRqVF1brBtpdt3xkkTGJBxmYBxZlItrc/lf7Y= diff --git a/internal/arcgen/lang/go/extract_source.go b/internal/arcgen/lang/go/extract_source.go index c0ac853..4d10b1b 100644 --- a/internal/arcgen/lang/go/extract_source.go +++ b/internal/arcgen/lang/go/extract_source.go @@ -2,9 +2,11 @@ package arcgengo import ( "context" + "fmt" goast "go/ast" "go/token" "reflect" + "sort" "strings" errorz "github.com/kunitsucom/util.go/errors" @@ -32,7 +34,6 @@ func extractSource(_ context.Context, fset *token.FileSet, f *goast.File) (*ARCS logs.Debug.Printf("🔍: %s: type=%s", pos.String(), n.Name.Name) arcSrcMap[pos.String()] = &ARCSource{ Source: pos, - Package: f.Name, TypeSpec: typeSpec, StructType: structType, } @@ -67,7 +68,6 @@ func extractSource(_ context.Context, fset *token.FileSet, f *goast.File) (*ARCS logs.Debug.Printf("🖋️: %s: overwrite with comment group: type=%s", fset.Position(t.Pos()).String(), n.Name.Name) arcSrcMap[pos.String()] = &ARCSource{ Source: pos, - Package: f.Name, TypeSpec: typeSpec, StructType: structType, CommentGroup: commentGroup, @@ -101,6 +101,11 @@ func extractSource(_ context.Context, fset *token.FileSet, f *goast.File) (*ARCS return nil, errorz.Errorf("column-tag-go=%s: %w", config.ColumnTagGo(), apperr.ErrColumnTagGoAnnotationNotFoundInSource) } + sort.Slice(arcSrcSet.ARCSources, func(i, j int) bool { + return fmt.Sprintf("%s:%07d", arcSrcSet.ARCSources[i].Source.Filename, arcSrcSet.ARCSources[i].Source.Line) < + fmt.Sprintf("%s:%07d", arcSrcSet.ARCSources[j].Source.Filename, arcSrcSet.ARCSources[j].Source.Line) + }) + return arcSrcSet, nil } diff --git a/internal/arcgen/lang/go/generate.go b/internal/arcgen/lang/go/generate.go index 5ce41a6..5475308 100644 --- a/internal/arcgen/lang/go/generate.go +++ b/internal/arcgen/lang/go/generate.go @@ -5,7 +5,7 @@ import ( "context" "fmt" "go/ast" - "go/format" + "go/printer" "go/token" "io" "os" @@ -19,6 +19,7 @@ import ( "github.com/kunitsucom/arcgen/internal/arcgen/lang/util" "github.com/kunitsucom/arcgen/internal/config" "github.com/kunitsucom/arcgen/internal/logs" + "github.com/kunitsucom/arcgen/pkg/errors" ) //nolint:cyclop,funlen @@ -28,68 +29,87 @@ func Generate(ctx context.Context, src string) error { return errorz.Errorf("parse: %w", err) } - newFile := token.NewFileSet() + if err := generate(arcSrcSets); err != nil { + return errorz.Errorf("generate: %w", err) + } + + return nil +} +func generate(arcSrcSets ARCSourceSets) error { for _, arcSrcSet := range arcSrcSets { filePrefix := strings.TrimSuffix(arcSrcSet.Filename, fileSuffix) filename := fmt.Sprintf("%s.%s.gen%s", filePrefix, config.ColumnTagGo(), fileSuffix) - osFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644) + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644) if err != nil { return errorz.Errorf("os.OpenFile: %w", err) } - astFile := &ast.File{ - // package - Name: &ast.Ident{ - Name: arcSrcSet.PackageName, - }, - // methods - Decls: []ast.Decl{}, + if err := fprint(f, bytes.NewBuffer(nil), arcSrcSet); err != nil { + return errorz.Errorf("sprint: %w", err) } + } - for _, arcSrc := range arcSrcSet.ARCSources { - structName := arcSrc.TypeSpec.Name.Name - tableName := extractTableNameFromCommentGroup(arcSrc.CommentGroup) - columnNames := func() []string { - columnNames := make([]string, 0) - for _, field := range arcSrc.StructType.Fields.List { - if field.Tag != nil { - tag := reflect.StructTag(strings.Trim(field.Tag.Value, "`")) - switch columnName := tag.Get(config.ColumnTagGo()); columnName { - case "", "-": - logs.Trace.Printf("SKIP: %s: field.Names=%s, columnName=%q", arcSrc.Source.String(), field.Names, columnName) - // noop - default: - columnNames = append(columnNames, columnName) - } - } - } - return columnNames - }() + return nil +} - appendAST(astFile, structName, tableName, config.MethodPrefixGlobal(), config.MethodPrefixColumn(), columnNames) - } +type buffer interface { + io.Writer + fmt.Stringer +} - buf := bytes.NewBuffer(nil) - if err := format.Node(buf, newFile, astFile); err != nil { - return errorz.Errorf("format.Node: %w", err) +func fprint(osFile io.Writer, buf buffer, arcSrcSet *ARCSourceSet) error { + if arcSrcSet == nil || arcSrcSet.PackageName == "" { + return errors.ErrInvalidSourceSet + } + astFile := &ast.File{ + // package + Name: &ast.Ident{ + Name: arcSrcSet.PackageName, + }, + // methods + Decls: []ast.Decl{}, + } + + for _, arcSrc := range arcSrcSet.ARCSources { + structName := arcSrc.TypeSpec.Name.Name + tableName := extractTableNameFromCommentGroup(arcSrc.CommentGroup) + fieldNames, columnNames := make([]string, 0), make([]string, 0) + for _, field := range arcSrc.StructType.Fields.List { + if field.Tag != nil { + tag := reflect.StructTag(strings.Trim(field.Tag.Value, "`")) + switch columnName := tag.Get(config.ColumnTagGo()); columnName { + case "", "-": + logs.Trace.Printf("SKIP: %s: field.Names=%s, columnName=%q", arcSrc.Source.String(), field.Names, columnName) + // noop + default: + logs.Trace.Printf("%s: field.Names=%s, columnName=%q", arcSrc.Source.String(), field.Names, columnName) + fieldNames, columnNames = append(fieldNames, field.Names[0].Name), append(columnNames, columnName) + } + } } - // add header comment - content := "" + - "// Code generated by arcgen. DO NOT EDIT." + "\n" + - "//" + "\n" + - fmt.Sprintf("// source: %s", filepathz.Short(arcSrcSet.Source.Filename)) + "\n" + - "\n" + - buf.String() + appendAST(astFile, structName, tableName, config.MethodNameTable(), config.MethodPrefixColumn(), fieldNames, columnNames) + } - // add blank line between methods - content = strings.ReplaceAll(content, "\n}\nfunc ", "\n}\n\nfunc ") + if err := printer.Fprint(buf, token.NewFileSet(), astFile); err != nil { + return errorz.Errorf("printer.Fprint: %w", err) + } - // write to file - if _, err := io.WriteString(osFile, content); err != nil { - return errorz.Errorf("io.WriteString: %w", err) - } + // add header comment + content := "" + + "// Code generated by arcgen. DO NOT EDIT." + "\n" + + "//" + "\n" + + fmt.Sprintf("// source: %s", filepathz.Short(arcSrcSet.Source.Filename)) + "\n" + + "\n" + + buf.String() + + // add blank line between methods + content = strings.ReplaceAll(content, "\n}\nfunc ", "\n}\n\nfunc ") + + // write to file + if _, err := io.WriteString(osFile, content); err != nil { + return errorz.Errorf("io.WriteString: %w", err) } return nil @@ -99,7 +119,7 @@ func extractTableNameFromCommentGroup(commentGroup *ast.CommentGroup) string { if commentGroup != nil { for _, comment := range commentGroup.List { if matches := util.RegexIndexTableName.Regex.FindStringSubmatch(comment.Text); len(matches) > util.RegexIndexTableName.Index { - return matches[util.RegexIndexTableName.Index] + return strings.Trim(matches[util.RegexIndexTableName.Index], "`") } } } @@ -109,7 +129,7 @@ func extractTableNameFromCommentGroup(commentGroup *ast.CommentGroup) string { } //nolint:funlen -func appendAST(file *ast.File, structName string, tableName string, prefixGlobal string, prefixColumn string, columnNames []string) { +func appendAST(file *ast.File, structName string, tableName string, prefixGlobal string, prefixColumn string, fieldNames, columnNames []string) { if tableName != "" { file.Decls = append(file.Decls, &ast.FuncDecl{ Recv: &ast.FieldList{ @@ -157,13 +177,13 @@ func appendAST(file *ast.File, structName string, tableName string, prefixGlobal }) } - file.Decls = append(file.Decls, generateASTColumnMethods(structName, prefixGlobal, prefixColumn, columnNames)...) + file.Decls = append(file.Decls, generateASTColumnMethods(structName, prefixGlobal, prefixColumn, fieldNames, columnNames)...) return //nolint:gosimple } //nolint:funlen -func generateASTColumnMethods(structName string, prefixGlobal string, prefixColumn string, columnNames []string) []ast.Decl { +func generateASTColumnMethods(structName string, prefixGlobal string, prefixColumn string, fieldNames, columnNames []string) []ast.Decl { decls := make([]ast.Decl, 0) // all column names method @@ -225,7 +245,7 @@ func generateASTColumnMethods(structName string, prefixGlobal string, prefixColu }) // each column name methods - for _, columnName := range columnNames { + for i, columnName := range columnNames { decls = append(decls, &ast.FuncDecl{ Recv: &ast.FieldList{ List: []*ast.Field{ @@ -244,7 +264,7 @@ func generateASTColumnMethods(structName string, prefixGlobal string, prefixColu }, }, Name: &ast.Ident{ - Name: prefixGlobal + prefixColumn + columnName, + Name: prefixGlobal + prefixColumn + fieldNames[i], }, Type: &ast.FuncType{ Params: &ast.FieldList{}, diff --git a/internal/arcgen/lang/go/generate_test.go b/internal/arcgen/lang/go/generate_test.go index b47f1a8..c38def9 100644 --- a/internal/arcgen/lang/go/generate_test.go +++ b/internal/arcgen/lang/go/generate_test.go @@ -2,7 +2,9 @@ package arcgengo import ( + "bytes" "context" + goast "go/ast" "io" "os" "testing" @@ -12,6 +14,7 @@ import ( "github.com/kunitsucom/arcgen/internal/config" "github.com/kunitsucom/arcgen/internal/contexts" + "github.com/kunitsucom/arcgen/pkg/errors" ) //nolint:paralleltest @@ -20,7 +23,7 @@ func TestGenerate(t *testing.T) { ctx := contexts.WithArgs(context.Background(), []string{ "ddlgen", "--column-tag-go=dbtest", - "--method-prefix-global=Get", + "--method-name-table=Get", // "--src=tests/common.source", "--src=tests", }) @@ -55,7 +58,7 @@ func TestGenerate(t *testing.T) { ctx := contexts.WithArgs(context.Background(), []string{ "ddlgen", "--column-tag-go=dbtest", - "--method-prefix-global=Get", + "--method-name-table=Get", "--src=tests/no.errsource", }) @@ -66,14 +69,14 @@ func TestGenerate(t *testing.T) { require.NoError(t, err) fileSuffix = ".source" - require.ErrorsContains(t, Generate(ctx, config.Source()), "expected 'package', found 'EOF'") + require.ErrorContains(t, Generate(ctx, config.Source()), "expected 'package', found 'EOF'") }) t.Run("failure,no.errsource", func(t *testing.T) { ctx := contexts.WithArgs(context.Background(), []string{ "ddlgen", "--column-tag-go=dbtest", - "--method-prefix-global=Get", + "--method-name-table=Get", "--src=tests", }) @@ -84,14 +87,14 @@ func TestGenerate(t *testing.T) { require.NoError(t, err) fileSuffix = ".errsource" - require.ErrorsContains(t, Generate(ctx, config.Source()), "expected 'package', found 'EOF'") + require.ErrorContains(t, Generate(ctx, config.Source()), "expected 'package', found 'EOF'") }) t.Run("failure,no-such-file-or-directory", func(t *testing.T) { ctx := contexts.WithArgs(context.Background(), []string{ "ddlgen", "--column-tag-go=dbtest", - "--method-prefix-global=Get", + "--method-name-table=Get", "--src=tests/no-such-file-or-directory", }) @@ -102,14 +105,14 @@ func TestGenerate(t *testing.T) { require.NoError(t, err) fileSuffix = ".source" - require.ErrorsContains(t, Generate(ctx, config.Source()), "no such file or directory") + require.ErrorContains(t, Generate(ctx, config.Source()), "no such file or directory") }) t.Run("failure,directory.dir", func(t *testing.T) { ctx := contexts.WithArgs(context.Background(), []string{ "ddlgen", "--column-tag-go=dbtest", - "--method-prefix-global=Get", + "--method-name-table=Get", "--src=tests/directory.dir", }) @@ -120,6 +123,101 @@ func TestGenerate(t *testing.T) { require.NoError(t, err) fileSuffix = ".dir" - require.ErrorsContains(t, Generate(ctx, config.Source()), "is a directory") + require.ErrorContains(t, Generate(ctx, config.Source()), "is a directory") + }) +} + +var _ buffer = (*testBuffer)(nil) + +type testBuffer struct { + WriteFunc func(p []byte) (n int, err error) + StringFunc func() string +} + +func (w *testBuffer) Write(p []byte) (n int, err error) { + return w.WriteFunc(p) +} + +func (w *testBuffer) String() string { + return w.StringFunc() +} + +//nolint:paralleltest +func Test_generate(t *testing.T) { + t.Run("failure,os.OpenFile", func(t *testing.T) { + arcSrcSets := ARCSourceSets{ + &ARCSourceSet{ + Filename: "tests/invalid-source-set", + ARCSources: []*ARCSource{ + nil, + }, + }, + } + backup := fileSuffix + t.Cleanup(func() { fileSuffix = backup }) + fileSuffix = ".invalid-source-set" + err := generate(arcSrcSets) + require.ErrorIs(t, err, errors.ErrInvalidSourceSet) + }) +} + +func newTestARCSourceSet() *ARCSourceSet { + return &ARCSourceSet{ + PackageName: "testpkg", + ARCSources: []*ARCSource{ + { + TypeSpec: &goast.TypeSpec{ + Name: &goast.Ident{ + Name: "Test", + }, + }, + StructType: &goast.StructType{ + Fields: &goast.FieldList{ + List: []*goast.Field{ + { + Names: []*goast.Ident{ + { + Name: "ID", + }, + }, + Tag: &goast.BasicLit{ + Value: "`dbtest:\"id\"`", + }, + }, + }, + }, + }, + }, + }, + } +} + +func Test_sprint(t *testing.T) { + t.Parallel() + t.Run("failure,buffer", func(t *testing.T) { + t.Parallel() + buf := &testBuffer{ + WriteFunc: func(p []byte) (n int, err error) { + return 0, io.ErrClosedPipe + }, + StringFunc: func() string { + return "" + }, + } + arcSrcSet := newTestARCSourceSet() + err := fprint(nil, buf, arcSrcSet) + require.ErrorIs(t, err, io.ErrClosedPipe) + }) + + t.Run("failure,File", func(t *testing.T) { + t.Parallel() + f := &testBuffer{ + WriteFunc: func(p []byte) (n int, err error) { + return 0, io.ErrClosedPipe + }, + } + arcSrcSet := newTestARCSourceSet() + err := fprint(f, bytes.NewBuffer(nil), arcSrcSet) + require.ErrorIs(t, err, io.ErrClosedPipe) }) } diff --git a/internal/arcgen/lang/go/parse.go b/internal/arcgen/lang/go/parse.go index 7f2c0e7..dc90e75 100644 --- a/internal/arcgen/lang/go/parse.go +++ b/internal/arcgen/lang/go/parse.go @@ -25,9 +25,8 @@ func parse(ctx context.Context, src string) (ARCSourceSets, error) { return nil, errorz.Errorf("os.Stat: %w", err) } - arcSrcSets := make(ARCSourceSets, 0) - if info.IsDir() { + arcSrcSets := make(ARCSourceSets, 0) if err := filepath.WalkDir(sourceAbs, walkDirFn(ctx, &arcSrcSets)); err != nil { return nil, errorz.Errorf("filepath.WalkDir: %w", err) } @@ -40,8 +39,7 @@ func parse(ctx context.Context, src string) (ARCSourceSets, error) { return nil, errorz.Errorf("parseFile: file=%s: %v", sourceAbs, err) } - arcSrcSets = append(arcSrcSets, arcSrcSet) - return arcSrcSets, nil + return ARCSourceSets{arcSrcSet}, nil } //nolint:gochecknoglobals diff --git a/internal/arcgen/lang/go/parse_test.go b/internal/arcgen/lang/go/parse_test.go new file mode 100644 index 0000000..547caaa --- /dev/null +++ b/internal/arcgen/lang/go/parse_test.go @@ -0,0 +1,22 @@ +//nolint:testpackage +package arcgengo + +import ( + "context" + "os" + "testing" + + "github.com/kunitsucom/util.go/testing/require" +) + +func Test_walkDirFn(t *testing.T) { + t.Parallel() + + t.Run("failure,os.Stat", func(t *testing.T) { + t.Parallel() + + ctx := context.Background() + arcSrcSets := make(ARCSourceSets, 0) + require.ErrorIs(t, walkDirFn(ctx, &arcSrcSets)("tests", nil, os.ErrNotExist), os.ErrNotExist) + }) +} diff --git a/internal/arcgen/lang/go/source.go b/internal/arcgen/lang/go/source.go index 8317ad6..4803178 100644 --- a/internal/arcgen/lang/go/source.go +++ b/internal/arcgen/lang/go/source.go @@ -12,8 +12,8 @@ import ( type ( ARCSource struct { - Source token.Position // TODO: Unnecessary? - Package *ast.Ident + // Source for sorting + Source token.Position // TypeSpec is used to guess the table name if the CREATE TABLE annotation is not found. TypeSpec *ast.TypeSpec // StructType is used to determine the column name. If the tag specified by --column-tag-go is not found, the field name is used. diff --git a/internal/arcgen/lang/go/tests/.gitignore b/internal/arcgen/lang/go/tests/.gitignore index edf5b78..5c64952 100644 --- a/internal/arcgen/lang/go/tests/.gitignore +++ b/internal/arcgen/lang/go/tests/.gitignore @@ -1 +1 @@ -*.gen.source +*.gen.* diff --git a/internal/arcgen/lang/go/tests/common.golden b/internal/arcgen/lang/go/tests/common.golden index b2103d9..05a4c23 100644 --- a/internal/arcgen/lang/go/tests/common.golden +++ b/internal/arcgen/lang/go/tests/common.golden @@ -5,14 +5,14 @@ package main func (s *User) GetTableName() string { - return "`Users`" + return "Users" } func (s *User) GetColumnNames() []string { return []string{"Id", "Name", "Email", "Age"} } -func (s *User) GetColumnName_Id() string { +func (s *User) GetColumnName_ID() string { return "Id" } @@ -32,7 +32,7 @@ func (s *Group) GetColumnNames() []string { return []string{"Id", "Name"} } -func (s *Group) GetColumnName_Id() string { +func (s *Group) GetColumnName_ID() string { return "Id" } diff --git a/internal/config/config.go b/internal/config/config.go index 20f1b0b..80626d0 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -26,7 +26,7 @@ type config struct { // Golang ColumnTagGo string `json:"column_tag_go"` MethodPrefixColumn string `json:"column_method_prefix"` - MethodPrefixGlobal string `json:"global_method_prefix"` + MethodNameTable string `json:"method_table_name"` } //nolint:gochecknoglobals @@ -91,8 +91,8 @@ const ( _OptionColumnTagGo = "column-tag-go" _EnvKeyColumnTagGo = "ARCGEN_COLUMN_TAG_GO" - _OptionMethodPrefixGlobal = "method-prefix-global" - _EnvKeyMethodPrefixGlobal = "ARCGEN_METHOD_PREFIX_GLOBAL" + _OptionMethodNameTable = "method-name-table" + _EnvKeyMethodNameTable = "ARCGEN_METHOD_NAME_TABLE" _OptionMethodPrefixColumn = "method-prefix-column" _EnvKeyMethodPrefixColumn = "ARCGEN_METHOD_PREFIX_COLUMN" @@ -155,15 +155,15 @@ func load(ctx context.Context) (cfg *config, err error) { //nolint:unparam Default: cliz.Default("db"), }, &cliz.StringOption{ - Name: _OptionMethodPrefixGlobal, - Environment: _EnvKeyMethodPrefixGlobal, - Description: "global method prefix", - Default: cliz.Default(""), + Name: _OptionMethodNameTable, + Environment: _EnvKeyMethodNameTable, + Description: "method name for table", + Default: cliz.Default("TableName"), }, &cliz.StringOption{ Name: _OptionMethodPrefixColumn, Environment: _EnvKeyMethodPrefixColumn, - Description: "column method prefix", + Description: "method prefix for column name", Default: cliz.Default("ColumnName_"), }, }, @@ -182,7 +182,7 @@ func load(ctx context.Context) (cfg *config, err error) { //nolint:unparam Source: loadSource(ctx, cmd), // Golang ColumnTagGo: loadColumnTagGo(ctx, cmd), - MethodPrefixGlobal: loadMethodPrefixGlobal(ctx, cmd), + MethodNameTable: loadMethodNameTable(ctx, cmd), MethodPrefixColumn: loadMethodPrefixColumn(ctx, cmd), } diff --git a/internal/config/method_prefix_global.go b/internal/config/method_prefix_global.go index 53d25a3..2c61f56 100644 --- a/internal/config/method_prefix_global.go +++ b/internal/config/method_prefix_global.go @@ -6,13 +6,13 @@ import ( cliz "github.com/kunitsucom/util.go/exp/cli" ) -func loadMethodPrefixGlobal(_ context.Context, cmd *cliz.Command) string { - v, _ := cmd.GetOptionString(_OptionMethodPrefixGlobal) +func loadMethodNameTable(_ context.Context, cmd *cliz.Command) string { + v, _ := cmd.GetOptionString(_OptionMethodNameTable) return v } -func MethodPrefixGlobal() string { +func MethodNameTable() string { globalConfigMu.RLock() defer globalConfigMu.RUnlock() - return globalConfig.MethodPrefixGlobal + return globalConfig.MethodNameTable } diff --git a/pkg/errors/errors.go b/pkg/errors/errors.go index c3489c4..f99afcd 100644 --- a/pkg/errors/errors.go +++ b/pkg/errors/errors.go @@ -3,8 +3,6 @@ package errors import "errors" var ( - ErrUnknownError = errors.New("unknown error") - ErrNotSupported = errors.New("not supported") - ErrUnformattedFileIsNotSupported = errors.New("unformatted file is not supported") + ErrInvalidSourceSet = errors.New("invalid source set") ErrColumnTagGoAnnotationNotFoundInSource = errors.New("column-tag-go annotation not found in source") )