Skip to content

Commit

Permalink
build: fix linter install on windows (#24523)
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi authored and qinglin89 committed Aug 22, 2022
1 parent d130c0e commit f8e2104
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,17 @@ func downloadLinter(cachedir string) string {

csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
if arch == "arm" {
ext := ".tar.gz"

if runtime.GOOS == "windows" {
ext = ".zip"
}
if arch == "arm" {
arch += "v" + os.Getenv("GOARM")
}
base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, arch)
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s.tar.gz", version, base)
archivePath := filepath.Join(cachedir, base+".tar.gz")
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s%s", version, base, ext)
archivePath := filepath.Join(cachedir, base+ext)
if err := csdb.DownloadFile(url, archivePath); err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/build/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (db *ChecksumDB) Verify(path string) error {
}
fileHash := hex.EncodeToString(h.Sum(nil))
if !db.findHash(filepath.Base(path), fileHash) {
return fmt.Errorf("invalid file hash %s", fileHash)
return fmt.Errorf("invalid file hash %s for %s", fileHash, filepath.Base(path))
}
return nil
}
Expand Down

0 comments on commit f8e2104

Please sign in to comment.