Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all the imports to github.com/tofuutils/tenv/v2 module path #178

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/atmos/atmos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 5 additions & 4 deletions cmd/tenv/subcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions cmd/tenv/tenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/terragrunt/terragrunt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions cmd/tf/tf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/tofu/tofu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/check/binary/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/check/cosign/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/check/cosign/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion pkg/check/pgp/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/check/sha256/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/download/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions pkg/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions pkg/lockfile/lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/lockfile/lockfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/reversecmp/reverse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/zip/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()
Expand Down
22 changes: 11 additions & 11 deletions versionmanager/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 10 additions & 10 deletions versionmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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))
}
Expand Down
8 changes: 4 additions & 4 deletions versionmanager/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}
Expand Down
Loading
Loading