Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion v2/generator/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"strings"

"golang.org/x/tools/imports"

"k8s.io/gengo/v2/namer"
"k8s.io/gengo/v2/types"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -114,7 +115,13 @@ func assembleGoFile(w io.Writer, f *File) {
}

func importsWrapper(src []byte) ([]byte, error) {
return imports.Process("", src, nil)
opt := imports.Options{
Comments: true,
TabIndent: true,
TabWidth: 8,
FormatOnly: true, // Disable the insertion and deletion of imports
}
return imports.Process("", src, &opt)
}

func NewGoFile() *DefaultFileType {
Expand Down