Skip to content
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_unit_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func Test_Build_Single_VarMap(t *testing.T) {

t.Assert(gfile.Exists(binaryPath), false)
_, err = f.Index(ctx, cBuildInput{
VarMap: map[string]interface{}{
VarMap: map[string]any{
"a": "1",
"b": "2",
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/gf/internal/cmd/gendao/gendao_do.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ func generateDo(ctx context.Context, in CGenDaoInternalInput) {
IsDo: true,
})
)
// replace all types to interface{}.
// replace all types to any.
structDefinition, _ = gregex.ReplaceStringFuncMatch(
"([A-Z]\\w*?)\\s+([\\w\\*\\.]+?)\\s+(//)",
structDefinition,
func(match []string) string {
// If the type is already a pointer/slice/map, it does nothing.
if !gstr.HasPrefix(match[2], "*") && !gstr.HasPrefix(match[2], "[]") && !gstr.HasPrefix(match[2], "map") {
return fmt.Sprintf(`%s interface{} %s`, match[1], match[3])
return fmt.Sprintf(`%s any %s`, match[1], match[3])
}
return match[0]
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/gf/internal/cmd/genenums/genenums_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ func (p *EnumsParser) ParsePackage(pkg *packages.Package) {
}

func (p *EnumsParser) Export() string {
var typeEnumMap = make(map[string][]interface{})
var typeEnumMap = make(map[string][]any)
for _, enum := range p.enums {
if typeEnumMap[enum.Type] == nil {
typeEnumMap[enum.Type] = make([]interface{}, 0)
typeEnumMap[enum.Type] = make([]any, 0)
}
var value interface{}
var value any
switch enum.Kind {
case constant.Int:
value = gconv.Int64(enum.Value)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/genpb/genpb_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c CGenPb) tagCommentIntoListMap(comment string, lineTagMap *gmap.ListMap)

func (c CGenPb) listMapToStructTag(lineTagMap *gmap.ListMap) string {
var tag string
lineTagMap.Iterator(func(key, value interface{}) bool {
lineTagMap.Iterator(func(key, value any) bool {
if tag != "" {
tag += " "
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (c CGenService) generateType(generatedContent *bytes.Buffer, srcStructFunct
generatedContent.WriteString("type(")
generatedContent.WriteString("\n")

srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
var (
funcContents = make([]string, 0)
funcContent string
Expand Down Expand Up @@ -71,7 +71,7 @@ func (c CGenService) generateVar(generatedContent *bytes.Buffer, srcStructFuncti
// Generating variable and register definitions.
var variableContent string

srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
structName := key.(string)
variableContent += gstr.Trim(gstr.ReplaceByMap(consts.TemplateGenServiceContentVariable, g.MapStrStr{
"{StructName}": structName,
Expand All @@ -93,7 +93,7 @@ func (c CGenService) generateVar(generatedContent *bytes.Buffer, srcStructFuncti
// See: const.TemplateGenServiceContentRegister
func (c CGenService) generateFunc(generatedContent *bytes.Buffer, srcStructFunctions *gmap.ListMap) {
// Variable register function definitions.
srcStructFunctions.Iterator(func(key, value interface{}) bool {
srcStructFunctions.Iterator(func(key, value any) bool {
structName := key.(string)
generatedContent.WriteString(gstr.Trim(gstr.ReplaceByMap(consts.TemplateGenServiceContentRegister, g.MapStrStr{
"{StructName}": structName,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ func (s *sArticle) T3(ctx context.Context, b *gdbas.Model) (c, d *gdbas.Model, e
* random comment
*/

// func (s *sArticle) T4(i interface{}) interface{}
// func (s *sArticle) T4(i any) any
// # $ % ^ & * ( ) _ + - = { } | [ ] \ : " ; ' < > ? , . /
func (s *sArticle) T4(i interface{}) interface{} {
func (s *sArticle) T4(i any) any {
return nil
}

/**
* func (s *sArticle) T4(i interface{}) interface{} {
* func (s *sArticle) T4(i any) any {
* return nil
* }
*/
4 changes: 2 additions & 2 deletions cmd/gf/internal/cmd/testdata/genservice/service/article.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/2572/model/do/user_3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/2572/model/do/user_4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/2616/model/do/user_3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/2616/model/do/user_4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/3749/model/do/table_user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions cmd/gf/internal/utility/mlog/mlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,26 @@ func SetHeaderPrint(enabled bool) {
}
}

func Print(v ...interface{}) {
func Print(v ...any) {
logger.Print(ctx, v...)
}

func Printf(format string, v ...interface{}) {
func Printf(format string, v ...any) {
logger.Printf(ctx, format, v...)
}

func Fatal(v ...interface{}) {
func Fatal(v ...any) {
logger.Fatal(ctx, v...)
}

func Fatalf(format string, v ...interface{}) {
func Fatalf(format string, v ...any) {
logger.Fatalf(ctx, format, v...)
}

func Debug(v ...interface{}) {
func Debug(v ...any) {
logger.Debug(ctx, v...)
}

func Debugf(format string, v ...interface{}) {
func Debugf(format string, v ...any) {
logger.Debugf(ctx, format, v...)
}
Loading
Loading