Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
01e8e2905e | |||
d0a43019bc |
4
gobuf.go
4
gobuf.go
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user