Skip to content

Commit f327cc3

Browse files
authored
[codegen] Fix empty manifest package for legacy non-manifestdata manifest go file (#1117)
## What Changed? Why? For legacy non-`manifestdata`-package generated manifest go files, the package was being supplied as empty from the CLI, which is invalid. This fixes it to use the basename of the `--gogenpath`. ### How was it tested? Tested in an existing project. ### Where did you document your changes? N/A - bugfix ### Notes to Reviewers
1 parent e104d3f commit f327cc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/grafana-app-sdk/generate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,12 @@ func generateKindsCue(modFS fs.FS, cfg kindGenConfig, selectors ...string) (code
271271
}
272272
}
273273

274+
manifestPkg := filepath.Base(cfg.ManifestPath)
275+
if cfg.ManifestPath == "" {
276+
manifestPkg = filepath.Base(cfg.GoGenBasePath)
277+
}
274278
// Manifest
275-
goManifestFiles, err := generatorForManifest.Generate(cuekind.ManifestGoGenerator(filepath.Base(cfg.ManifestPath), cfg.ManifestIncludeSchemas, cfg.GoModuleName, cfg.GoModuleGenBasePath, cfg.ManifestPath, cfg.GroupKinds), selectors...)
279+
goManifestFiles, err := generatorForManifest.Generate(cuekind.ManifestGoGenerator(manifestPkg, cfg.ManifestIncludeSchemas, cfg.GoModuleName, cfg.GoModuleGenBasePath, cfg.ManifestPath, cfg.GroupKinds), selectors...)
276280
if err != nil {
277281
return nil, err
278282
}

0 commit comments

Comments
 (0)