-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TonyTVu
authored and
TonyTVu
committed
Dec 6, 2022
1 parent
72292a9
commit 7a75192
Showing
4 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"archive/tar" | ||
"compress/gzip" | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
func getGolangCiLint(version, output string) error { | ||
os := runtime.GOOS + "-" + runtime.GOARCH | ||
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/golangci-lint-%s-%s.tar.gz", | ||
version, version, | ||
os, | ||
) | ||
|
||
fd, _, err := fetchFile(url) | ||
if err != nil { | ||
return fmt.Errorf("fetch: %w", err) | ||
} | ||
defer fd.Close() | ||
|
||
gzr, err := gzip.NewReader(fd) | ||
if err != nil { | ||
return fmt.Errorf("deflate: %w", err) | ||
} | ||
defer gzr.Close() | ||
|
||
r := tar.NewReader(gzr) | ||
|
||
err = extractFromTar(r, "*/golangci-lint", output, true) | ||
if err != nil { | ||
return fmt.Errorf("extract: %w", err) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1.50.1 | ||
1.50.1 |