# README
goformat
Golang
代码/文件格式化
例子
var code = `func a( ) {return}`
out, err := ProcessCode([]byte(code), WithFragment(true))
xpanic.WhenError(err)
fmt.Println(string(out))
Output:
func a() { return }
# Functions
AtomicOptions return atomic *OptionsVisitor.
AtomicOptionsSet atomic setter for *Options.
InstallCallbackOnAtomicOptionsSet install callback.
InstallOptionsWatchDog the installed func will called when NewOptions called.
NewOptions new Options.
go:generate optiongen --option_with_struct_name=false --new_func=NewOptions --xconf=true --empty_composite_nil=true --usage_tag_name=usage.
Process 格式化文件或内容 filename 源文件路径 src 源码.
ProcessCode src 源码.
ProcessFile filename 源文件路径.
WithAllErrors 打印所有的语法错误到标准输出。如果不使用此标记,则只会打印不同行的前10个错误.
WithFragment 允许解析源文件片段代码.
WithRemoveBareReturns 移除无效的return.
# Interfaces
OptionsInterface visitor + ApplyOption interface for Options.
OptionsVisitor visitor interface for Options.
# Type aliases
Option option func.