Skip to content

Commit

Permalink
Support name prefixes in go
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Jun 3, 2024
1 parent cb5ece7 commit 82e7485
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion codegen/jennies/gotypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ type CUEGoConfig struct {
}

// TODO(kgz): what to do with `maxNamingDepth`?
// TODO(kgz): handle `cfg.NamePrefix`
func GoTypesFromCUE(v cue.Value, cfg CUEGoConfig, maxNamingDepth int) ([]byte, error) {

Check warning on line 159 in codegen/jennies/gotypes.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'maxNamingDepth' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 159 in codegen/jennies/gotypes.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

unused-parameter: parameter 'maxNamingDepth' seems to be unused, consider removing or renaming it as _ (revive)
codegenOpts := []cog.SingleSchemaOption{
cog.CUEValue(cfg.PackageName, v, cog.ForceEnvelope(cfg.Name)),
cog.GoTypes(),
cog.SchemaTransformations(cog.PrefixObjectsNames(cfg.NamePrefix)),
}

if cfg.AddKubernetesOpenAPIGenComment {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
cuelang.org/go v0.8.2
github.com/getkin/kin-openapi v0.123.0
github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d
github.com/grafana/cog v0.0.0-20240529130920-083c489f684f
github.com/grafana/cog v0.0.0-20240603130906-42de25f609a6
github.com/grafana/thema v0.0.0-20230511182720-3146087fcc26
github.com/hashicorp/go-multierror v1.1.1
github.com/matryer/moq v0.3.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d h1:hrXbGJ5jgp6yNITzs5o+zXq0V5yT3siNJ+uM8LGwWKk=
github.com/grafana/codejen v0.0.4-0.20230321061741-77f656893a3d/go.mod h1:zmwwM/DRyQB7pfuBjTWII3CWtxcXh8LTwAYGfDfpR6s=
github.com/grafana/cog v0.0.0-20240529130920-083c489f684f h1:GBywjeAKDSdEZuchYJ6U4qNbfXaUOxXo9jIWVDRDoDw=
github.com/grafana/cog v0.0.0-20240529130920-083c489f684f/go.mod h1:A+ggqoURW2MB0Y5bxfi7DZOtxKYqwLuugRfMI+sT/0w=
github.com/grafana/cog v0.0.0-20240603130906-42de25f609a6 h1:WWQFmxHrAyYepeRYLmzGb1SsknCT7ZUbhgZ2/4JSzPQ=
github.com/grafana/cog v0.0.0-20240603130906-42de25f609a6/go.mod h1:A+ggqoURW2MB0Y5bxfi7DZOtxKYqwLuugRfMI+sT/0w=
github.com/grafana/thema v0.0.0-20230511182720-3146087fcc26 h1:HX927q4X1n451pnGb8U0wq74i8PCzuxVjzv7TyD10kc=
github.com/grafana/thema v0.0.0-20230511182720-3146087fcc26/go.mod h1:Pn9nfzCk7nV0mvNgwusgCjCROZP6nm4GpwTnmEhLT24=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/codejen v0.0.3/go.mod h1:zmwwM/DRyQB7pfuBjTWII3CWtxcXh8LTwAYGfDfpR6s=
github.com/grafana/cog v0.0.0-20240529130920-083c489f684f/go.mod h1:A+ggqoURW2MB0Y5bxfi7DZOtxKYqwLuugRfMI+sT/0w=
github.com/grafana/cuetsy v0.1.10/go.mod h1:Ix97+CPD8ws9oSSxR3/Lf4ahU1I4Np83kjJmDVnLZvc=
github.com/grafana/grafana-plugin-sdk-go v0.222.0/go.mod h1:0lYONo3rJrjIoJNOQP0h2NXmOaF5rFIuH/rwSVSeIrQ=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
Expand Down

0 comments on commit 82e7485

Please sign in to comment.