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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 32 deletions

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 {

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 {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of AccessPolicy.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Dashboard.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Folder.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of LibraryPanel.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Playlist.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Preferences.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of PublicDashboard.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Role.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of RoleBinding.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {

View File

@ -30,7 +30,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
}
}
// Resource is the wire representation of Team.
// It currently will soon be merged into the k8s flavor (TODO be better)
type Resource struct {