From d3f88dfe767645577db50cf91524a9753b74ccc8 Mon Sep 17 00:00:00 2001 From: Artiom Diomin Date: Thu, 20 Jun 2024 00:21:57 +0300 Subject: [PATCH] Change all the imports to github.com/tofuutils/tenv/v2 module path (#178) * Change all the imports to github.com/tofuutils/tenv/v2 module path * Regroup project imports Signed-off-by: Artiom Diomin --- cmd/atmos/atmos.go | 6 ++--- cmd/tenv/subcmd.go | 9 ++++---- cmd/tenv/tenv.go | 11 +++++----- cmd/terraform/terraform.go | 6 ++--- cmd/terragrunt/terragrunt.go | 6 ++--- cmd/tf/tf.go | 8 +++---- cmd/tofu/tofu.go | 6 ++--- config/config.go | 3 ++- pkg/check/binary/check_test.go | 2 +- pkg/check/cosign/check.go | 5 +++-- pkg/check/cosign/check_test.go | 4 ++-- pkg/check/pgp/check_test.go | 2 +- pkg/check/sha256/check_test.go | 2 +- pkg/download/download_test.go | 2 +- pkg/github/github.go | 4 ++-- pkg/github/github_test.go | 4 ++-- pkg/lockfile/lockfile.go | 5 +++-- pkg/lockfile/lockfile_test.go | 8 +++---- pkg/reversecmp/reverse_test.go | 2 +- pkg/zip/zip.go | 6 ++--- versionmanager/builder/builder.go | 22 +++++++++---------- versionmanager/manager.go | 20 ++++++++--------- versionmanager/proxy/proxy.go | 8 +++---- .../retriever/atmos/atmosretriever.go | 19 ++++++++-------- .../retriever/html/htmlretriever.go | 9 ++++---- .../retriever/terraform/terraformretriever.go | 15 +++++++------ .../terraform/terraformretriever_test.go | 2 +- .../terragrunt/terragruntretriever.go | 19 ++++++++-------- .../retriever/tofu/tofuretriever.go | 19 ++++++++-------- versionmanager/semantic/finder/finder_test.go | 2 +- .../semantic/parser/flat/flatparser.go | 6 ++--- .../semantic/parser/terragrunt/gruntparser.go | 7 +++--- versionmanager/semantic/parser/tf/tfparser.go | 5 +++-- .../semantic/parser/toml/tomlparser.go | 7 +++--- versionmanager/semantic/semantic.go | 9 ++++---- versionmanager/semantic/semantic_test.go | 2 +- versionmanager/semantic/types/types.go | 4 ++-- versionmanager/semantic/walker.go | 4 ++-- 38 files changed, 147 insertions(+), 133 deletions(-) diff --git a/cmd/atmos/atmos.go b/cmd/atmos/atmos.go index cda4bae3..7ab854b3 100644 --- a/cmd/atmos/atmos.go +++ b/cmd/atmos/atmos.go @@ -19,9 +19,9 @@ package main import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/builder" - "github.com/tofuutils/tenv/versionmanager/proxy" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + "github.com/tofuutils/tenv/v2/versionmanager/proxy" ) func main() { diff --git a/cmd/tenv/subcmd.go b/cmd/tenv/subcmd.go index 1c50687c..a613e6cf 100644 --- a/cmd/tenv/subcmd.go +++ b/cmd/tenv/subcmd.go @@ -24,12 +24,13 @@ import ( "strconv" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/tofuutils/tenv/v2/versionmanager" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" + "github.com/spf13/cobra" "github.com/spf13/pflag" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" - "github.com/tofuutils/tenv/versionmanager" - "github.com/tofuutils/tenv/versionmanager/semantic" ) const deprecationMsg = "Direct usage of this subcommand on tenv is deprecated, you should use tofu subcommand instead.\n\n" diff --git a/cmd/tenv/tenv.go b/cmd/tenv/tenv.go index 8f4a4b05..ee41be6d 100644 --- a/cmd/tenv/tenv.go +++ b/cmd/tenv/tenv.go @@ -24,11 +24,12 @@ import ( "path/filepath" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + terragruntparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/terragrunt" + "github.com/spf13/cobra" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager" - "github.com/tofuutils/tenv/versionmanager/builder" - terragruntparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/terragrunt" ) const ( @@ -182,7 +183,7 @@ func newUpdatePathCmd() *cobra.Command { if gha { pathfilePath := os.Getenv("GITHUB_PATH") if pathfilePath != "" { - pathfile, err := os.OpenFile(pathfilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + pathfile, err := os.OpenFile(pathfilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644) if err != nil { return err } diff --git a/cmd/terraform/terraform.go b/cmd/terraform/terraform.go index 765e9b6b..8647d837 100644 --- a/cmd/terraform/terraform.go +++ b/cmd/terraform/terraform.go @@ -19,9 +19,9 @@ package main import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/builder" - "github.com/tofuutils/tenv/versionmanager/proxy" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + "github.com/tofuutils/tenv/v2/versionmanager/proxy" ) func main() { diff --git a/cmd/terragrunt/terragrunt.go b/cmd/terragrunt/terragrunt.go index 7dbef383..b1921fbe 100644 --- a/cmd/terragrunt/terragrunt.go +++ b/cmd/terragrunt/terragrunt.go @@ -19,9 +19,9 @@ package main import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/builder" - "github.com/tofuutils/tenv/versionmanager/proxy" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + "github.com/tofuutils/tenv/v2/versionmanager/proxy" ) func main() { diff --git a/cmd/tf/tf.go b/cmd/tf/tf.go index e7cefd08..89f11a0e 100644 --- a/cmd/tf/tf.go +++ b/cmd/tf/tf.go @@ -22,10 +22,10 @@ import ( "fmt" "os" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/builder" - "github.com/tofuutils/tenv/versionmanager/proxy" - terragruntparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/terragrunt" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + "github.com/tofuutils/tenv/v2/versionmanager/proxy" + terragruntparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/terragrunt" ) func main() { diff --git a/cmd/tofu/tofu.go b/cmd/tofu/tofu.go index 525ad774..cf13337d 100644 --- a/cmd/tofu/tofu.go +++ b/cmd/tofu/tofu.go @@ -19,9 +19,9 @@ package main import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/builder" - "github.com/tofuutils/tenv/versionmanager/proxy" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/builder" + "github.com/tofuutils/tenv/v2/versionmanager/proxy" ) func main() { diff --git a/config/config.go b/config/config.go index 77e8b158..161fbb10 100644 --- a/config/config.go +++ b/config/config.go @@ -26,9 +26,10 @@ import ( "runtime" "strconv" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/fatih/color" "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/pkg/loghelper" "gopkg.in/yaml.v3" ) diff --git a/pkg/check/binary/check_test.go b/pkg/check/binary/check_test.go index 78be7b4f..303254b1 100644 --- a/pkg/check/binary/check_test.go +++ b/pkg/check/binary/check_test.go @@ -21,7 +21,7 @@ package bincheck_test import ( "testing" - bincheck "github.com/tofuutils/tenv/pkg/check/binary" + bincheck "github.com/tofuutils/tenv/v2/pkg/check/binary" ) func TestTextFileCheck(t *testing.T) { diff --git a/pkg/check/cosign/check.go b/pkg/check/cosign/check.go index 14a5fd24..18610054 100644 --- a/pkg/check/cosign/check.go +++ b/pkg/check/cosign/check.go @@ -24,8 +24,9 @@ import ( "os/exec" "strings" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/pkg/loghelper" ) const ( @@ -92,7 +93,7 @@ func tempFile(name string, data []byte) (string, func(), error) { } tmpFileName := tmpFile.Name() - if err = os.WriteFile(tmpFileName, data, 0600); err != nil { + if err = os.WriteFile(tmpFileName, data, 0o600); err != nil { return "", nil, err } diff --git a/pkg/check/cosign/check_test.go b/pkg/check/cosign/check_test.go index fc526715..88ac80e0 100644 --- a/pkg/check/cosign/check_test.go +++ b/pkg/check/cosign/check_test.go @@ -22,8 +22,8 @@ import ( _ "embed" "testing" - cosigncheck "github.com/tofuutils/tenv/pkg/check/cosign" - "github.com/tofuutils/tenv/pkg/loghelper" + cosigncheck "github.com/tofuutils/tenv/v2/pkg/check/cosign" + "github.com/tofuutils/tenv/v2/pkg/loghelper" ) const ( diff --git a/pkg/check/pgp/check_test.go b/pkg/check/pgp/check_test.go index 2a9c9832..89161931 100644 --- a/pkg/check/pgp/check_test.go +++ b/pkg/check/pgp/check_test.go @@ -22,7 +22,7 @@ import ( _ "embed" "testing" - pgpcheck "github.com/tofuutils/tenv/pkg/check/pgp" + pgpcheck "github.com/tofuutils/tenv/v2/pkg/check/pgp" ) //go:embed testdata/terraform_1.6.6_SHA256SUMS diff --git a/pkg/check/sha256/check_test.go b/pkg/check/sha256/check_test.go index 1c751b3c..0f936401 100644 --- a/pkg/check/sha256/check_test.go +++ b/pkg/check/sha256/check_test.go @@ -22,7 +22,7 @@ import ( _ "embed" "testing" - sha256check "github.com/tofuutils/tenv/pkg/check/sha256" + sha256check "github.com/tofuutils/tenv/v2/pkg/check/sha256" ) //go:embed testdata/hello.txt diff --git a/pkg/download/download_test.go b/pkg/download/download_test.go index 8c615328..4a9c93b2 100644 --- a/pkg/download/download_test.go +++ b/pkg/download/download_test.go @@ -21,7 +21,7 @@ package download_test import ( "testing" - "github.com/tofuutils/tenv/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/download" ) func TestUrlTransformer(t *testing.T) { diff --git a/pkg/github/github.go b/pkg/github/github.go index c306fbfc..94d5f506 100644 --- a/pkg/github/github.go +++ b/pkg/github/github.go @@ -26,8 +26,8 @@ import ( "net/url" "strconv" - "github.com/tofuutils/tenv/pkg/apimsg" - versionfinder "github.com/tofuutils/tenv/versionmanager/semantic/finder" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + versionfinder "github.com/tofuutils/tenv/v2/versionmanager/semantic/finder" ) const ( diff --git a/pkg/github/github_test.go b/pkg/github/github_test.go index 05efb9af..70d30880 100644 --- a/pkg/github/github_test.go +++ b/pkg/github/github_test.go @@ -24,8 +24,8 @@ import ( "slices" "testing" - "github.com/tofuutils/tenv/pkg/apimsg" - "github.com/tofuutils/tenv/versionmanager/semantic" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" ) // empty marker. diff --git a/pkg/lockfile/lockfile.go b/pkg/lockfile/lockfile.go index 65001672..4db557ae 100644 --- a/pkg/lockfile/lockfile.go +++ b/pkg/lockfile/lockfile.go @@ -25,8 +25,9 @@ import ( "sync" "time" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/pkg/loghelper" ) const ( @@ -39,7 +40,7 @@ const ( func Write(dirPath string, displayer loghelper.Displayer) func() { lockPath := filepath.Join(dirPath, ".lock") for logLevel := hclog.Warn; true; logLevel = hclog.Info { - f, err := os.OpenFile(lockPath, os.O_CREATE|os.O_EXCL, 0644) //nolint + f, err := os.OpenFile(lockPath, os.O_CREATE|os.O_EXCL, 0o644) //nolint if err == nil { f.Close() break diff --git a/pkg/lockfile/lockfile_test.go b/pkg/lockfile/lockfile_test.go index f4148acf..4d45cd40 100644 --- a/pkg/lockfile/lockfile_test.go +++ b/pkg/lockfile/lockfile_test.go @@ -26,8 +26,8 @@ import ( "testing" "time" - "github.com/tofuutils/tenv/pkg/lockfile" - "github.com/tofuutils/tenv/pkg/loghelper" + "github.com/tofuutils/tenv/v2/pkg/lockfile" + "github.com/tofuutils/tenv/v2/pkg/loghelper" ) //go:embed testdata/data1.txt @@ -52,7 +52,7 @@ func TestParallelWriteRead(t *testing.T) { os.RemoveAll(parallelDirPath) }() - if err = os.MkdirAll(parallelDirPath, 0755); err != nil { + if err = os.MkdirAll(parallelDirPath, 0o755); err != nil { t.Fatal("Unexpected error during test init (2) :", err) } @@ -95,7 +95,7 @@ func writeReadFile(dirPath string, filePath string, data []byte, displayer loghe deleteLock := lockfile.Write(dirPath, displayer) defer deleteLock() - if err := os.WriteFile(filePath, data, 0644); err != nil { + if err := os.WriteFile(filePath, data, 0o644); err != nil { return nil, err } diff --git a/pkg/reversecmp/reverse_test.go b/pkg/reversecmp/reverse_test.go index b6817fd3..9246b4d1 100644 --- a/pkg/reversecmp/reverse_test.go +++ b/pkg/reversecmp/reverse_test.go @@ -22,7 +22,7 @@ import ( "cmp" "testing" - "github.com/tofuutils/tenv/pkg/reversecmp" + "github.com/tofuutils/tenv/v2/pkg/reversecmp" ) func TestReverserFalse(t *testing.T) { diff --git a/pkg/zip/zip.go b/pkg/zip/zip.go index 40b75c72..33179853 100644 --- a/pkg/zip/zip.go +++ b/pkg/zip/zip.go @@ -27,12 +27,12 @@ import ( "path/filepath" "strings" - bincheck "github.com/tofuutils/tenv/pkg/check/binary" + bincheck "github.com/tofuutils/tenv/v2/pkg/check/binary" ) // ensure the directory exists with a MkdirAll call. func UnzipToDir(dataZip []byte, dirPath string) error { - err := os.MkdirAll(dirPath, 0755) + err := os.MkdirAll(dirPath, 0o755) if err != nil { return err } @@ -81,7 +81,7 @@ func copyZipFileToDir(zipFile *zip.File, dirPath string) error { if destPath[len(destPath)-1] == '/' { // trailing slash indicates a directory - return os.MkdirAll(destPath, 0755) + return os.MkdirAll(destPath, 0o755) } reader, err := zipFile.Open() diff --git a/versionmanager/builder/builder.go b/versionmanager/builder/builder.go index d399e534..74b91bc2 100644 --- a/versionmanager/builder/builder.go +++ b/versionmanager/builder/builder.go @@ -19,17 +19,17 @@ package builder import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager" - atmosretriever "github.com/tofuutils/tenv/versionmanager/retriever/atmos" - terraformretriever "github.com/tofuutils/tenv/versionmanager/retriever/terraform" - terragruntretriever "github.com/tofuutils/tenv/versionmanager/retriever/terragrunt" - tofuretriever "github.com/tofuutils/tenv/versionmanager/retriever/tofu" - "github.com/tofuutils/tenv/versionmanager/semantic" - flatparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/flat" - terragruntparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/terragrunt" - tomlparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/toml" - "github.com/tofuutils/tenv/versionmanager/semantic/types" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager" + atmosretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/atmos" + terraformretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/terraform" + terragruntretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/terragrunt" + tofuretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/tofu" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" + flatparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/flat" + terragruntparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/terragrunt" + tomlparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/toml" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" ) func BuildAtmosManager(conf *config.Config, gruntParser terragruntparser.TerragruntParser) versionmanager.VersionManager { diff --git a/versionmanager/manager.go b/versionmanager/manager.go index bca1a966..bb687a1a 100644 --- a/versionmanager/manager.go +++ b/versionmanager/manager.go @@ -27,15 +27,16 @@ import ( "slices" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/lockfile" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/tofuutils/tenv/v2/pkg/reversecmp" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" + flatparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/flat" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-version" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/lockfile" - "github.com/tofuutils/tenv/pkg/loghelper" - "github.com/tofuutils/tenv/pkg/reversecmp" - "github.com/tofuutils/tenv/versionmanager/semantic" - flatparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/flat" - "github.com/tofuutils/tenv/versionmanager/semantic/types" ) var ( @@ -117,7 +118,6 @@ func (m VersionManager) Evaluate(requestedVersion string, proxyCall bool) (strin m.conf.Displayer.Display("No compatible version found locally, search a remote one...") if m.conf.NoInstall { version, err := m.searchInstallRemote(predicateInfo, m.conf.NoInstall, proxyCall) - if err != nil { m.conf.Displayer.Flush(proxyCall) return "", errNoCompatibleLocally @@ -157,7 +157,7 @@ func (m VersionManager) Install(requestedVersion string) error { func (m VersionManager) InstallPath() (string, error) { dir := filepath.Join(m.conf.RootPath, m.FolderName) - return dir, os.MkdirAll(dir, 0755) + return dir, os.MkdirAll(dir, 0o755) } func (m VersionManager) ListLocal(reverseOrder bool) ([]string, error) { @@ -413,7 +413,7 @@ func removeFile(filePath string, conf *config.Config) error { } func writeFile(filePath string, content string, conf *config.Config) error { - err := os.WriteFile(filePath, []byte(content), 0644) + err := os.WriteFile(filePath, []byte(content), 0o644) if err == nil { conf.Displayer.Display(loghelper.Concat("Written ", content, " in ", filePath)) } diff --git a/versionmanager/proxy/proxy.go b/versionmanager/proxy/proxy.go index df2c360b..548ea66d 100644 --- a/versionmanager/proxy/proxy.go +++ b/versionmanager/proxy/proxy.go @@ -30,9 +30,9 @@ import ( "strconv" "strings" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager" - terragruntparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/terragrunt" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager" + terragruntparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/terragrunt" ) var errDelimiter = errors.New("key and value should not contains delimiter") @@ -126,7 +126,7 @@ func initIO(cmd *exec.Cmd, execName string, pExitCode *int) (func(int), error) { } outputPath := os.Getenv("GITHUB_OUTPUT") - outputFile, err := os.OpenFile(outputPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + outputFile, err := os.OpenFile(outputPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644) if err != nil { return nil, err } diff --git a/versionmanager/retriever/atmos/atmosretriever.go b/versionmanager/retriever/atmos/atmosretriever.go index 0b0439da..09d4d2cd 100644 --- a/versionmanager/retriever/atmos/atmosretriever.go +++ b/versionmanager/retriever/atmos/atmosretriever.go @@ -25,14 +25,15 @@ import ( "runtime" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + sha256check "github.com/tofuutils/tenv/v2/pkg/check/sha256" + "github.com/tofuutils/tenv/v2/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/github" + "github.com/tofuutils/tenv/v2/pkg/winbin" + htmlretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/html" + "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/apimsg" - sha256check "github.com/tofuutils/tenv/pkg/check/sha256" - "github.com/tofuutils/tenv/pkg/download" - "github.com/tofuutils/tenv/pkg/github" - "github.com/tofuutils/tenv/pkg/winbin" - htmlretriever "github.com/tofuutils/tenv/versionmanager/retriever/html" ) const ( @@ -106,12 +107,12 @@ func (r AtmosRetriever) InstallRelease(versionStr string, targetPath string) err return err } - err = os.MkdirAll(targetPath, 0755) + err = os.MkdirAll(targetPath, 0o755) if err != nil { return err } - return os.WriteFile(filepath.Join(targetPath, winbin.GetBinaryName(config.AtmosName)), data, 0755) + return os.WriteFile(filepath.Join(targetPath, winbin.GetBinaryName(config.AtmosName)), data, 0o755) } func (r AtmosRetriever) ListReleases() ([]string, error) { diff --git a/versionmanager/retriever/html/htmlretriever.go b/versionmanager/retriever/html/htmlretriever.go index 7bed24b5..268f1892 100644 --- a/versionmanager/retriever/html/htmlretriever.go +++ b/versionmanager/retriever/html/htmlretriever.go @@ -21,11 +21,12 @@ package htmlretriever import ( "net/url" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/htmlquery" + versionfinder "github.com/tofuutils/tenv/v2/versionmanager/semantic/finder" + "github.com/PuerkitoBio/goquery" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/download" - "github.com/tofuutils/tenv/pkg/htmlquery" - versionfinder "github.com/tofuutils/tenv/versionmanager/semantic/finder" ) func BuildAssetURLs(baseAssetURL string, assetNames ...string) ([]string, error) { diff --git a/versionmanager/retriever/terraform/terraformretriever.go b/versionmanager/retriever/terraform/terraformretriever.go index d9a9c68c..7535f1a8 100644 --- a/versionmanager/retriever/terraform/terraformretriever.go +++ b/versionmanager/retriever/terraform/terraformretriever.go @@ -27,14 +27,15 @@ import ( "runtime" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + pgpcheck "github.com/tofuutils/tenv/v2/pkg/check/pgp" + sha256check "github.com/tofuutils/tenv/v2/pkg/check/sha256" + "github.com/tofuutils/tenv/v2/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/zip" + htmlretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/html" + "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/apimsg" - pgpcheck "github.com/tofuutils/tenv/pkg/check/pgp" - sha256check "github.com/tofuutils/tenv/pkg/check/sha256" - "github.com/tofuutils/tenv/pkg/download" - "github.com/tofuutils/tenv/pkg/zip" - htmlretriever "github.com/tofuutils/tenv/versionmanager/retriever/html" ) const ( diff --git a/versionmanager/retriever/terraform/terraformretriever_test.go b/versionmanager/retriever/terraform/terraformretriever_test.go index cade1494..2285a82a 100644 --- a/versionmanager/retriever/terraform/terraformretriever_test.go +++ b/versionmanager/retriever/terraform/terraformretriever_test.go @@ -24,7 +24,7 @@ import ( "slices" "testing" - "github.com/tofuutils/tenv/versionmanager/semantic" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" ) //go:embed testdata/release.json diff --git a/versionmanager/retriever/terragrunt/terragruntretriever.go b/versionmanager/retriever/terragrunt/terragruntretriever.go index 4fb34784..b613797a 100644 --- a/versionmanager/retriever/terragrunt/terragruntretriever.go +++ b/versionmanager/retriever/terragrunt/terragruntretriever.go @@ -25,14 +25,15 @@ import ( "runtime" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + sha256check "github.com/tofuutils/tenv/v2/pkg/check/sha256" + "github.com/tofuutils/tenv/v2/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/github" + "github.com/tofuutils/tenv/v2/pkg/winbin" + htmlretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/html" + "github.com/hashicorp/go-hclog" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/apimsg" - sha256check "github.com/tofuutils/tenv/pkg/check/sha256" - "github.com/tofuutils/tenv/pkg/download" - "github.com/tofuutils/tenv/pkg/github" - "github.com/tofuutils/tenv/pkg/winbin" - htmlretriever "github.com/tofuutils/tenv/versionmanager/retriever/html" ) const ( @@ -103,12 +104,12 @@ func (r TerragruntRetriever) InstallRelease(versionStr string, targetPath string return err } - err = os.MkdirAll(targetPath, 0755) + err = os.MkdirAll(targetPath, 0o755) if err != nil { return err } - return os.WriteFile(filepath.Join(targetPath, winbin.GetBinaryName(config.TerragruntName)), data, 0755) + return os.WriteFile(filepath.Join(targetPath, winbin.GetBinaryName(config.TerragruntName)), data, 0o755) } func (r TerragruntRetriever) ListReleases() ([]string, error) { diff --git a/versionmanager/retriever/tofu/tofuretriever.go b/versionmanager/retriever/tofu/tofuretriever.go index 561ca4a5..4c36e2ea 100644 --- a/versionmanager/retriever/tofu/tofuretriever.go +++ b/versionmanager/retriever/tofu/tofuretriever.go @@ -24,17 +24,18 @@ import ( "runtime" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/apimsg" + cosigncheck "github.com/tofuutils/tenv/v2/pkg/check/cosign" + pgpcheck "github.com/tofuutils/tenv/v2/pkg/check/pgp" + sha256check "github.com/tofuutils/tenv/v2/pkg/check/sha256" + "github.com/tofuutils/tenv/v2/pkg/download" + "github.com/tofuutils/tenv/v2/pkg/github" + "github.com/tofuutils/tenv/v2/pkg/zip" + htmlretriever "github.com/tofuutils/tenv/v2/versionmanager/retriever/html" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-version" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/apimsg" - cosigncheck "github.com/tofuutils/tenv/pkg/check/cosign" - pgpcheck "github.com/tofuutils/tenv/pkg/check/pgp" - sha256check "github.com/tofuutils/tenv/pkg/check/sha256" - "github.com/tofuutils/tenv/pkg/download" - "github.com/tofuutils/tenv/pkg/github" - "github.com/tofuutils/tenv/pkg/zip" - htmlretriever "github.com/tofuutils/tenv/versionmanager/retriever/html" ) const ( diff --git a/versionmanager/semantic/finder/finder_test.go b/versionmanager/semantic/finder/finder_test.go index 088016a6..9cc6c4ee 100644 --- a/versionmanager/semantic/finder/finder_test.go +++ b/versionmanager/semantic/finder/finder_test.go @@ -21,7 +21,7 @@ package versionfinder_test import ( "testing" - versionfinder "github.com/tofuutils/tenv/versionmanager/semantic/finder" + versionfinder "github.com/tofuutils/tenv/v2/versionmanager/semantic/finder" ) func TestFindVersionAlphaSlash(t *testing.T) { diff --git a/versionmanager/semantic/parser/flat/flatparser.go b/versionmanager/semantic/parser/flat/flatparser.go index b98c2213..9c80a883 100644 --- a/versionmanager/semantic/parser/flat/flatparser.go +++ b/versionmanager/semantic/parser/flat/flatparser.go @@ -24,9 +24,9 @@ import ( "io/fs" "os" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" - "github.com/tofuutils/tenv/versionmanager/semantic/types" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" ) func RetrieveVersion(filePath string, conf *config.Config) (string, error) { diff --git a/versionmanager/semantic/parser/terragrunt/gruntparser.go b/versionmanager/semantic/parser/terragrunt/gruntparser.go index cae24581..4e0740e9 100644 --- a/versionmanager/semantic/parser/terragrunt/gruntparser.go +++ b/versionmanager/semantic/parser/terragrunt/gruntparser.go @@ -23,12 +23,13 @@ import ( "io/fs" "os" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hclparse" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" - "github.com/tofuutils/tenv/versionmanager/semantic/types" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/versionmanager/semantic/parser/tf/tfparser.go b/versionmanager/semantic/parser/tf/tfparser.go index 60c13c21..fdc33bb6 100644 --- a/versionmanager/semantic/parser/tf/tfparser.go +++ b/versionmanager/semantic/parser/tf/tfparser.go @@ -22,11 +22,12 @@ import ( "os" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hclparse" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/versionmanager/semantic/parser/toml/tomlparser.go b/versionmanager/semantic/parser/toml/tomlparser.go index 339ab2ef..40ee499d 100644 --- a/versionmanager/semantic/parser/toml/tomlparser.go +++ b/versionmanager/semantic/parser/toml/tomlparser.go @@ -23,10 +23,11 @@ import ( "io/fs" "os" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" + "github.com/BurntSushi/toml" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" - "github.com/tofuutils/tenv/versionmanager/semantic/types" ) const versionName = "version" diff --git a/versionmanager/semantic/semantic.go b/versionmanager/semantic/semantic.go index b17d68c0..661a911d 100644 --- a/versionmanager/semantic/semantic.go +++ b/versionmanager/semantic/semantic.go @@ -22,12 +22,13 @@ import ( "regexp" "strings" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" + tfparser "github.com/tofuutils/tenv/v2/versionmanager/semantic/parser/tf" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-version" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" - tfparser "github.com/tofuutils/tenv/versionmanager/semantic/parser/tf" - "github.com/tofuutils/tenv/versionmanager/semantic/types" ) const ( diff --git a/versionmanager/semantic/semantic_test.go b/versionmanager/semantic/semantic_test.go index e2f2ca25..8ed98a95 100644 --- a/versionmanager/semantic/semantic_test.go +++ b/versionmanager/semantic/semantic_test.go @@ -22,7 +22,7 @@ import ( "slices" "testing" - "github.com/tofuutils/tenv/versionmanager/semantic" + "github.com/tofuutils/tenv/v2/versionmanager/semantic" ) func TestCmpVersion(t *testing.T) { diff --git a/versionmanager/semantic/types/types.go b/versionmanager/semantic/types/types.go index bd10a0a6..590cabd7 100644 --- a/versionmanager/semantic/types/types.go +++ b/versionmanager/semantic/types/types.go @@ -19,8 +19,8 @@ package types import ( - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/pkg/loghelper" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/pkg/loghelper" ) type ConstraintInfo interface { diff --git a/versionmanager/semantic/walker.go b/versionmanager/semantic/walker.go index 305a004f..9047992c 100644 --- a/versionmanager/semantic/walker.go +++ b/versionmanager/semantic/walker.go @@ -22,8 +22,8 @@ import ( "os" "path/filepath" - "github.com/tofuutils/tenv/config" - "github.com/tofuutils/tenv/versionmanager/semantic/types" + "github.com/tofuutils/tenv/v2/config" + "github.com/tofuutils/tenv/v2/versionmanager/semantic/types" ) func RetrieveVersion(versionFiles []types.VersionFile, conf *config.Config) (string, error) {