Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Jul 1, 2024
1 parent ca71182 commit 0087010
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions codegen/jennies/gotypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"cuelang.org/go/cue"
"github.com/grafana/codejen"
"github.com/grafana/cog"

"github.com/grafana/grafana-app-sdk/codegen"
)

Expand Down Expand Up @@ -155,20 +156,20 @@ type CUEGoConfig struct {
}

func GoTypesFromCUE(v cue.Value, cfg CUEGoConfig, maxNamingDepth int) ([]byte, error) {
nameFunc := func(value cue.Value, path cue.Path) string {
nameFunc := func(value cue.Value, definitionPath cue.Path) string {
i := 0
for ; i < len(path.Selectors()) && i < len(v.Path().Selectors()); i++ {
for ; i < len(definitionPath.Selectors()) && i < len(v.Path().Selectors()); i++ {
if maxNamingDepth > 0 && i >= maxNamingDepth {
break
}
if !SelEq(path.Selectors()[i], v.Path().Selectors()[i]) {
if !SelEq(definitionPath.Selectors()[i], v.Path().Selectors()[i]) {
break
}
}
if i > 0 {
path = cue.MakePath(path.Selectors()[i:]...)
definitionPath = cue.MakePath(definitionPath.Selectors()[i:]...)
}
return strings.Trim(path.String(), "?#")
return strings.Trim(definitionPath.String(), "?#")
}

codegenPipeline := cog.TypesFromSchema().
Expand Down

0 comments on commit 0087010

Please sign in to comment.