diff --git a/_xtool/internal/parser/parser.go b/_xtool/internal/parser/parser.go index 7fb3cf736..adab0f294 100644 --- a/_xtool/internal/parser/parser.go +++ b/_xtool/internal/parser/parser.go @@ -604,7 +604,7 @@ func (ct *Converter) ProcessMethodAttributes(cursor clang.Cursor, fn *ast.FuncDe } func (ct *Converter) ProcessEnumType(cursor clang.Cursor) *ast.EnumType { - items := make([]*ast.EnumItem, 0) + items := []*ast.EnumItem{} clangutils.VisitChildren(cursor, func(cursor, parent clang.Cursor) clang.ChildVisitResult { if cursor.Kind == clang.CursorEnumConstantDecl { @@ -737,7 +737,7 @@ func (ct *Converter) ProcessFieldList(cursor clang.Cursor) *ast.FieldList { // Note:Public Method is considered func (ct *Converter) ProcessMethods(cursor clang.Cursor) []*ast.FuncDecl { - methods := make([]*ast.FuncDecl, 0) + methods := []*ast.FuncDecl{} clangutils.VisitChildren(cursor, func(subcsr, parent clang.Cursor) clang.ChildVisitResult { if isMethod(subcsr) && subcsr.CXXAccessSpecifier() == clang.CXXPublic { method := ct.ProcessFuncDecl(subcsr) diff --git a/cmd/llcppcfg/gen/cfg.go b/cmd/llcppcfg/gen/cfg.go index f0993bab3..228ccaee4 100644 --- a/cmd/llcppcfg/gen/cfg.go +++ b/cmd/llcppcfg/gen/cfg.go @@ -108,7 +108,7 @@ func findDepSlice(lines []string) ([]string, string) { } func getClangArgs(cflags string, relpath string) []string { - args := make([]string, 0) + var args []string cflagsField := strings.Fields(cflags) args = append(args, cflagsField...) args = append(args, "-MM") diff --git a/cmd/llcppgtest/llcppgtest.go b/cmd/llcppgtest/llcppgtest.go index 77765ce9d..b486f4f23 100644 --- a/cmd/llcppgtest/llcppgtest.go +++ b/cmd/llcppgtest/llcppgtest.go @@ -73,7 +73,7 @@ func RunCommand(name string, args ...string) { } func PkgList(r io.Reader) []string { - pkgs := make([]string, 0) + var pkgs []string scan := bufio.NewScanner(r) for scan.Scan() { lineBuf := bytes.NewBufferString(scan.Text()) @@ -150,7 +150,7 @@ func runPkgs(pkgs []string, cfg *RunConfig) { if cfg.runMode&withSymgVerbose != 0 { llcppgArg = append(llcppgArg, fmt.Sprintf("-%s", VsymgFlagName)) } - runs := make([]string, 0) + var runs []string for _, pkg := range pkgs { dir := "./out/" + pkg RunCommand("mkdir", "-p", dir)