diff --git a/gen/pbscheme/gen_dir.go b/gen/pbscheme/gen_dir.go index 683bb3f..39c0303 100644 --- a/gen/pbscheme/gen_dir.go +++ b/gen/pbscheme/gen_dir.go @@ -5,10 +5,8 @@ import ( "github.com/davyxu/protoplus/codegen" "github.com/davyxu/protoplus/gen" "github.com/davyxu/protoplus/model" - "io/ioutil" "path/filepath" "sort" - "strings" ) const protoDirCodeTemplate = `// Generated by github.com/davyxu/protoplus @@ -104,26 +102,26 @@ func GenProtoDir(ctx *gen.Context) error { rootDS := &PBDescriptorSet{DescriptorSet: *ctx.DescriptorSet} - var sb strings.Builder + //var sb strings.Builder var srcNameList []string for srcName, ds := range rootDS.DescriptorSetBySource() { srcNameList = append(srcNameList, srcName) - gen := codegen.NewCodeGen("dirproto"). + generator := codegen.NewCodeGen("dirproto"). RegisterTemplateFunc(codegen.UsefulFunc). RegisterTemplateFunc(UsefulFunc). ParseTemplate(protoDirCodeTemplate, ds) - if gen.Error() != nil { - fmt.Println(string(gen.Data())) - return gen.Error() + if generator.Error() != nil { + fmt.Println(string(generator.Data())) + return generator.Error() } fullPathName := filepath.Join(ctx.OutputFileName, srcName) - err := gen.WriteOutputFile(fullPathName).Error() + err := generator.WriteOutputFile(fullPathName).Error() if err != nil { return err } @@ -131,11 +129,11 @@ func GenProtoDir(ctx *gen.Context) error { sort.Strings(srcNameList) - for _, d := range srcNameList { - fmt.Fprintf(&sb, "%s ", d) - } - - err := ioutil.WriteFile(filepath.Join(ctx.OutputFileName, "filelist.txt"), []byte(sb.String()), 0666) + //for _, d := range srcNameList { + // fmt.Fprintf(&sb, "%s ", d) + //} + // + //err := ioutil.WriteFile(filepath.Join(ctx.OutputFileName, "filelist.txt"), []byte(sb.String()), 0666) - return err + return nil }