generate func at early days

This commit is contained in:
谢小军
2020-01-04 22:06:43 +08:00
parent f1dd6a7632
commit 9a0ac52273
6 changed files with 128 additions and 19 deletions

View File

@@ -76,17 +76,19 @@ func (s *GenStruct) SetStructName(name string) {
// SetNotes set the notes.设置注释
func (s *GenStruct) SetNotes(notes string) {
if len(notes) > 0 {
notes = s.Name + " " + notes
if len(notes) == 0 {
notes = "[...]" // default of struct notes(for export ).struct 默认注释(为了导出注释)
}
notes = s.Name + " " + notes
a := strings.Split(notes, "\n")
var text []string
for _, v := range a {
if len(v) > 0 {
text = append(text, "// "+v)
}
// if len(v) > 0 {
text = append(text, "// "+v)
// }
}
s.Notes = strings.Join(text, "\r\n")
}
@@ -159,6 +161,12 @@ func (p *GenPackage) Generate() string {
}
// -----------end
// add func
for _, v := range p.FuncStrList {
pa.Add(v)
}
// -----------end
// output.输出
strOut := ""
for _, v := range pa.Generates() {