Skip to content

Commit

Permalink
Change all the imports to github.com/tofuutils/tenv/v2 module path (#178
Browse files Browse the repository at this point in the history
)

* Change all the imports to github.com/tofuutils/tenv/v2 module path
* Regroup project imports

Signed-off-by: Artiom Diomin <kron82@gmail.com>
  • Loading branch information
kron4eg authored Jun 19, 2024
1 parent 5527cbb commit d3f88df
Show file tree
Hide file tree
Showing 38 changed files with 147 additions and 133 deletions.
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

0 comments on commit d3f88df

Please sign in to comment.