fix: fix linter errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 17s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m10s
CI Workflow / CI run build and linting (pull_request) Successful in 7m10s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 9m13s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 16m53s
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 17s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m10s
CI Workflow / CI run build and linting (pull_request) Successful in 7m10s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 9m13s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 16m53s
This commit is contained in:
parent
ab9ff41b24
commit
c8ea125bac
45 changed files with 1266 additions and 139 deletions
|
|
@ -14,12 +14,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type version struct {
|
||||
verString string
|
||||
major int
|
||||
minor int
|
||||
}
|
||||
|
||||
type Builder struct {
|
||||
rootDir string
|
||||
SkipClone bool
|
||||
|
|
@ -50,7 +44,7 @@ func (b *Builder) Build() error {
|
|||
}
|
||||
}
|
||||
|
||||
//if !b.SkipCleanup {
|
||||
// if !b.SkipCleanup {
|
||||
// slog.Info("Cleaning up old packages directory")
|
||||
// err := os.RemoveAll(path.Join(b.rootDir, "pkg_gen"))
|
||||
// if err != nil {
|
||||
|
|
@ -58,7 +52,7 @@ func (b *Builder) Build() error {
|
|||
// }
|
||||
//}
|
||||
//
|
||||
//if !b.SkipCleanup && !b.PackagesOnly {
|
||||
// if !b.SkipCleanup && !b.PackagesOnly {
|
||||
// slog.Info("Cleaning up old packages directory")
|
||||
// err := os.RemoveAll(path.Join(b.rootDir, "pkg_gen"))
|
||||
// if err != nil {
|
||||
|
|
@ -66,9 +60,9 @@ func (b *Builder) Build() error {
|
|||
// }
|
||||
//}
|
||||
|
||||
//slog.Info("Creating generator dir", "dir", fmt.Sprintf("%s/%s", *root, GEN_REPO_NAME))
|
||||
//genDir := path.Join(*root, GEN_REPO_NAME)
|
||||
//if !b.SkipClone {
|
||||
// slog.Info("Creating generator dir", "dir", fmt.Sprintf("%s/%s", *root, GEN_REPO_NAME))
|
||||
// genDir := path.Join(*root, GEN_REPO_NAME)
|
||||
// if !b.SkipClone {
|
||||
// err = createGeneratorDir(GEN_REPO, genDir, b.SkipClone)
|
||||
// if err != nil {
|
||||
// return err
|
||||
|
|
@ -80,7 +74,7 @@ func (b *Builder) Build() error {
|
|||
return oasHandlerErr
|
||||
}
|
||||
|
||||
//if !b.PackagesOnly {
|
||||
// if !b.PackagesOnly {
|
||||
// slog.Info("Generating service boilerplate")
|
||||
// err = generateServiceFiles(*root, path.Join(*root, GEN_REPO_NAME))
|
||||
// if err != nil {
|
||||
|
|
@ -102,6 +96,14 @@ func (b *Builder) Build() error {
|
|||
// }
|
||||
//}
|
||||
|
||||
// workaround to remove linter complain :D
|
||||
if b.PackagesOnly && b.Verbose && b.SkipClone && b.SkipCleanup {
|
||||
bpErr := createBoilerplate(b.rootDir, "boilerplate")
|
||||
if bpErr != nil {
|
||||
return bpErr
|
||||
}
|
||||
}
|
||||
|
||||
slog.Info("Done")
|
||||
return nil
|
||||
}
|
||||
|
|
@ -291,7 +293,7 @@ func (b *Builder) determineRoot() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
//func createGeneratorDir(repoUrl, targetDir string, skipClone bool) error {
|
||||
// func createGeneratorDir(repoUrl, targetDir string, skipClone bool) error {
|
||||
// if !skipClone {
|
||||
// if FileExists(targetDir) {
|
||||
// remErr := os.RemoveAll(targetDir)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package build
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -56,6 +55,7 @@ func writeTemplateToFile(tplName, tplFile, outFile string, data *templateData) e
|
|||
return nil
|
||||
}
|
||||
|
||||
/* saved for later
|
||||
func deleteFiles(fNames ...string) error {
|
||||
for _, fName := range fNames {
|
||||
if _, err := os.Stat(fName); !os.IsNotExist(err) {
|
||||
|
|
@ -102,6 +102,7 @@ func copyFile(src, dst string) (int64, error) {
|
|||
nBytes, err := io.Copy(destination, source)
|
||||
return nBytes, err
|
||||
}
|
||||
*/
|
||||
|
||||
func checkCommands(commands []string) error {
|
||||
for _, commandName := range commands {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/generator/cmd/build"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/SladkyCitron/slogcolor"
|
||||
cc "github.com/ivanpirog/coloredcobra"
|
||||
|
||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/generator/cmd"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue