feat(generator): generate nav file
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Prepare GO cache (pull_request) Successful in 4m57s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 13m22s
CI Workflow / CI run build and linting (pull_request) Successful in 17m32s
CI Workflow / Code coverage report (pull_request) Successful in 12s
CI Workflow / CI run tests (pull_request) Failing after 19m11s

This commit is contained in:
Marcel S. Henselin 2026-03-13 10:24:51 +01:00
parent f173fd54fe
commit 49ed600f7f
7 changed files with 307 additions and 10 deletions

View file

@ -8,10 +8,11 @@ import (
"go/token"
"log/slog"
"os"
"os/exec"
"path"
"regexp"
"strings"
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/generator/cmd/tools"
)
type Builder struct {
@ -276,20 +277,14 @@ func handleLine(line string) (string, error) {
}
func (b *Builder) determineRoot() error {
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
out, err := cmd.Output()
root, err := tools.GetGitRoot()
if err != nil {
return err
}
lines := strings.Split(string(out), "\n")
if lines[0] == "" {
return fmt.Errorf("unable to determine root directory from git")
}
b.rootDir = lines[0]
b.rootDir = root
if b.Verbose {
slog.Info(" ... using root", "dir", b.rootDir)
}
return nil
}