Format go resource (#71370)

* Format Go resource

* Format tabs

* use format library

* Undo template change

* Apply suggestion
This commit is contained in:
Selene
2023-07-11 16:41:18 +02:00
committed by GitHub
parent 850a7a7d39
commit 8b419f624f
12 changed files with 28 additions and 32 deletions
+8 -1
View File
@@ -3,6 +3,7 @@ package codegen
import (
"bytes"
"fmt"
"go/format"
"strings"
"cuelang.org/go/cue"
@@ -57,7 +58,13 @@ func (ag *ResourceGoTypesJenny) Generate(kind kindsys.Kind) (*codejen.File, erro
if err != nil {
return nil, err
}
return codejen.NewFile(fmt.Sprintf("pkg/kinds/%s/%s_gen.go", mname, mname), buf.Bytes(), ag), nil
content, err := format.Source(buf.Bytes())
if err != nil {
return nil, err
}
return codejen.NewFile(fmt.Sprintf("pkg/kinds/%s/%s_gen.go", mname, mname), content, ag), nil
}
type SubresourceGoTypesJenny struct {
-1
View File
@@ -21,7 +21,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of {{ .KindName }}.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {