gofimports/internal/imports/formatter_option.go

22 lines
394 B
Go
Raw Normal View History

2022-11-24 17:14:47 +00:00
package imports
type FormatterOptionFn func(*Formatter)
2022-11-24 17:21:59 +00:00
func FormatterWithList(isList bool) FormatterOptionFn {
2022-11-24 17:14:47 +00:00
return func(f *Formatter) {
2022-11-24 17:21:59 +00:00
f.isList = isList
2022-11-24 17:14:47 +00:00
}
}
2022-11-24 17:21:59 +00:00
func FormatterWithWrite(isWrite bool) FormatterOptionFn {
2022-11-24 17:14:47 +00:00
return func(f *Formatter) {
2022-11-24 17:21:59 +00:00
f.isWrite = isWrite
2022-11-24 17:14:47 +00:00
}
}
2022-11-24 17:21:59 +00:00
func FormatterWithDiff(isDiff bool) FormatterOptionFn {
2022-11-24 17:14:47 +00:00
return func(f *Formatter) {
2022-11-24 17:21:59 +00:00
f.isDiff = isDiff
2022-11-24 17:14:47 +00:00
}
}