mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -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 (
|
||||
"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 {
|
||||
|
@ -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 {
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ 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 {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user