mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
Format go resource (#71370)
* Format Go resource * Format tabs * use format library * Undo template change * Apply suggestion
This commit is contained in:
parent
850a7a7d39
commit
8b419f624f
@ -3,6 +3,7 @@ package codegen
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"go/format"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
@ -57,7 +58,13 @@ func (ag *ResourceGoTypesJenny) Generate(kind kindsys.Kind) (*codejen.File, erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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 {
|
type SubresourceGoTypesJenny struct {
|
||||||
|
@ -21,7 +21,6 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of {{ .KindName }}.
|
// Resource is the wire representation of {{ .KindName }}.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of AccessPolicy.
|
// Resource is the wire representation of AccessPolicy.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Dashboard.
|
// Resource is the wire representation of Dashboard.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Folder.
|
// Resource is the wire representation of Folder.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of LibraryPanel.
|
// Resource is the wire representation of LibraryPanel.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Playlist.
|
// Resource is the wire representation of Playlist.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Preferences.
|
// Resource is the wire representation of Preferences.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of PublicDashboard.
|
// Resource is the wire representation of PublicDashboard.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Role.
|
// Resource is the wire representation of Role.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of RoleBinding.
|
// Resource is the wire representation of RoleBinding.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ func NewK8sResource(name string, s *Spec) K8sResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource is the wire representation of Team.
|
// Resource is the wire representation of Team.
|
||||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Metadata Metadata `json:"metadata"`
|
Metadata Metadata `json:"metadata"`
|
||||||
Spec Spec `json:"spec"`
|
Spec Spec `json:"spec"`
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user