go-zero/tools/goctl/pkg/golang/format.go
Kevin Wan 555c4ecd1a
fix: quickstart wrong package when go.mod exists in parent dir (#2048)
* chore: fix typo

* fix: quickstart in dir with go.mod

* fix: runner failed

* chore: refine code

* chore: simplify quickstart mono
2022-06-26 22:37:15 +08:00

13 lines
183 B
Go

package golang
import goformat "go/format"
func FormatCode(code string) string {
ret, err := goformat.Source([]byte(code))
if err != nil {
return code
}
return string(ret)
}