MCPcopy
hub / github.com/davyxu/cellnet / formatCode

Function formatCode

protoc-gen-msg/file.go:129–146  ·  view source on GitHub ↗
(bf *bytes.Buffer)

Source from the content-addressed store, hash-verified

127}
128
129func formatCode(bf *bytes.Buffer) error {
130 // Reformat generated code.
131 fset := token.NewFileSet()
132
133 ast, err := parser.ParseFile(fset, "", bf, parser.ParseComments)
134 if err != nil {
135 return err
136 }
137
138 bf.Reset()
139
140 err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(bf, fset, ast)
141 if err != nil {
142 return err
143 }
144
145 return nil
146}

Callers 1

printFileFunction · 0.85

Calls 1

ResetMethod · 0.45

Tested by

no test coverage detected