Skip to content

Commit

Permalink
make go installer use .exe suffix on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <will.murphy@anchore.com>
  • Loading branch information
willmurphyscode committed May 20, 2024
1 parent 1be4a48 commit 7d1623d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tool/goinstall/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"text/template"

Expand Down Expand Up @@ -43,6 +44,10 @@ func (i Installer) InstallTo(version, destDir string) (string, error) {
fields := strings.Split(path, "/")
binName := fields[len(fields)-1]
binPath := filepath.Join(destDir, binName)
// TODO: probably refactor this somewhere
if runtime.GOOS == "windows" {
binPath = binPath + ".exe"

Check failure on line 49 in tool/goinstall/installer.go

View workflow job for this annotation

GitHub Actions / Validations

assignOp: replace `binPath = binPath + ".exe"` with `binPath += ".exe"` (gocritic)
}

spec := fmt.Sprintf("%s@%s", path, version)
if strings.HasPrefix(i.config.Module, ".") || strings.HasPrefix(i.config.Module, "/") {
Expand Down

0 comments on commit 7d1623d

Please sign in to comment.