Compare commits

...

2 Commits

Author SHA1 Message Date
01e8e2905e
fix: create file protobuf content 2024-03-22 00:07:09 +08:00
d0a43019bc
fix: receive method to function 2024-03-20 23:45:19 +08:00

View File

@ -36,7 +36,7 @@ func NewParser(file string) (*Parser, error) {
}, nil
}
func (parser *Parser) CreateFile(filename string) error {
func CreateFile(filename string) error {
// 检查文件是否存在
if _, err := os.Stat(filename); err == nil {
return nil
@ -53,7 +53,7 @@ func (parser *Parser) CreateFile(filename string) error {
}
// 写入基础的protobuf内容此步骤会创建文件
baseContent := []byte("syntax = \"proto3\";\npackage proto.v1;\noption go_package = \"projects/gen;genv1\";\n")
baseContent := []byte("syntax = \"proto3\";\n\npackage proto.v1;\n\noption go_package = \"projects/gen;genv1\";\n")
if err := os.WriteFile(filename, baseContent, os.ModePerm); err != nil {
return err
}