Skip to content

Commit

Permalink
more .exe suffixes, and lint fix
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed May 20, 2024
1 parent 7d1623d commit ec21045
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/cli/trait_assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"encoding/json"
"github.com/google/go-cmp/cmp"
"os"
"os/exec"
"path/filepath"
Expand All @@ -11,6 +10,7 @@ import (
"testing"

"github.com/acarl005/stripansi"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion tool/goinstall/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (i Installer) InstallTo(version, destDir string) (string, error) {
binPath := filepath.Join(destDir, binName)
// TODO: probably refactor this somewhere
if runtime.GOOS == "windows" {
binPath = binPath + ".exe"
binPath = fmt.Sprintf("%s.exe", binPath)
}

spec := fmt.Sprintf("%s@%s", path, version)
Expand Down
7 changes: 6 additions & 1 deletion tool/goinstall/installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package goinstall
import (
"fmt"
"os"
"runtime"
"strings"
"testing"

Expand Down Expand Up @@ -114,7 +115,11 @@ func TestInstaller_InstallTo(t *testing.T) {
if !tt.wantErr(t, err, fmt.Sprintf("InstallTo(%v, %v)", tt.args.version, tt.args.destDir)) {
return
}
assert.Equalf(t, tt.want, got, "InstallTo(%v, %v)", tt.args.version, tt.args.destDir)
wantPath := tt.want
if runtime.GOOS == "windows" {
wantPath = fmt.Sprintf("%s.exe", wantPath)
}
assert.Equalf(t, wantPath, got, "InstallTo(%v, %v)", tt.args.version, tt.args.destDir)
})
}
}

0 comments on commit ec21045

Please sign in to comment.