2022-11-26 17:51:18 +00:00
|
|
|
package imports
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
2023-01-17 04:45:17 +00:00
|
|
|
|
|
|
|
"github.com/dave/dst"
|
2022-11-26 17:51:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Wrap log.Printf with verbose flag
|
|
|
|
func (ft *Formatter) log(format string, v ...any) {
|
|
|
|
if ft.isVerbose {
|
|
|
|
log.Printf(format, v...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-17 04:45:17 +00:00
|
|
|
func (ft *Formatter) logDSTImportSpecs(logPrefix string, importSpecs []*dst.ImportSpec) {
|
2022-11-26 17:51:18 +00:00
|
|
|
if ft.isVerbose {
|
|
|
|
for _, importSpec := range importSpecs {
|
2023-01-17 04:45:17 +00:00
|
|
|
log.Printf("%s: [%s] [%s] before %v after %v\n", logPrefix, importSpec.Name, importSpec.Path.Value, importSpec.Decs.Before, importSpec.Decs.After)
|
2022-11-26 17:51:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|