Skip to content

Commit f85017b

Browse files
committed
fix
1 parent 6c5d3fb commit f85017b

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

actionsdotnetactcompat/action_cache.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type ActionCacheBase struct {
3131
}
3232

3333
// GetTarArchive implements runner.ActionCache.
34-
func (cache *ActionCacheBase) GetTarArchive(ctx context.Context, cacheDir string, sha string, includePrefix string) (io.ReadCloser, error) {
34+
func (cache *ActionCacheBase) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error) {
3535
pr, pw := io.Pipe()
3636
cleanIncludePrefix := path.Clean(includePrefix)
3737
go func() {
@@ -77,7 +77,7 @@ func (cache *ActionCacheBase) GetTarArchive(ctx context.Context, cacheDir string
7777
_ = pw.CloseWithError(err)
7878
return
7979
}
80-
_, err = io.Copy(writer, treader)
80+
_, err = io.Copy(writer, treader) //nolint:gosec
8181
if err != nil {
8282
_ = pw.CloseWithError(err)
8383
return
@@ -87,15 +87,16 @@ func (cache *ActionCacheBase) GetTarArchive(ctx context.Context, cacheDir string
8787
return pr, nil
8888
}
8989

90-
func fetchAction(ctx context.Context, target string, owner string, name string, resolvedSha string, tarURL string, token string, httpClient *http.Client) (targetFile string, reterr error) {
90+
func fetchAction(ctx context.Context, target, owner, name, resolvedSha, tarURL, token string, httpClient *http.Client,
91+
) (targetFile string, reterr error) {
9192
logger := common.Logger(ctx)
9293
cachedTar := filepath.Join(target, owner+"."+name+"."+resolvedSha+".tar")
9394
defer func() {
9495
if reterr != nil {
9596
_ = os.Remove(cachedTar)
9697
}
9798
}()
98-
if fr, err := os.Open(cachedTar); err == nil {
99+
if fr, err := os.Open(cachedTar); err == nil { //nolint:gosec
99100
defer func() { _ = fr.Close() }()
100101
if logger != nil {
101102
logger.Infof("Found cache for action %v/%v (sha:%v) from %v", owner, name, resolvedSha, cachedTar)
@@ -124,7 +125,7 @@ func fetchAction(ctx context.Context, target string, owner string, name string,
124125
_, _ = io.Copy(buf, rsp.Body)
125126
return "", fmt.Errorf("failed to download action from %v response %v", tarURL, buf.String())
126127
}
127-
fo, err := os.Create(cachedTar)
128+
fo, err := os.Create(cachedTar) //nolint:gosec
128129
if err != nil {
129130
return "", err
130131
}

actionsdotnetactcompat/launch_action_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type LaunchActionCache struct {
1919
}
2020

2121
// Fetch implements runner.ActionCache.
22-
func (cache *LaunchActionCache) Fetch(ctx context.Context, cacheDir string, url string, ref string, token string) (string, error) {
22+
func (cache *LaunchActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) {
2323
actionList := &launch.ActionReferenceRequestList{}
2424
actionurl := strings.Split(url, "/")
2525
actionurl = actionurl[len(actionurl)-2:]
@@ -40,7 +40,7 @@ func (cache *LaunchActionCache) Fetch(ctx context.Context, cacheDir string, url
4040
return "", err
4141
}
4242

43-
for _, v := range actionDownloadInfo.Actions {
43+
for _, v := range actionDownloadInfo.Actions { //nolint:dupl
4444
token := cache.GHToken
4545
if v.Authentication != nil && v.Authentication.Token != "" {
4646
token = v.Authentication.Token

actionsdotnetactcompat/vss_action_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type VssActionCache struct {
1616
}
1717

1818
// Fetch implements runner.ActionCache.
19-
func (cache *VssActionCache) Fetch(ctx context.Context, cacheDir string, url string, ref string, token string) (string, error) {
19+
func (cache *VssActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) {
2020
actionList := &protocol.ActionReferenceList{}
2121
actionurl := strings.Split(url, "/")
2222
actionurl = actionurl[len(actionurl)-2:]
@@ -32,7 +32,7 @@ func (cache *VssActionCache) Fetch(ctx context.Context, cacheDir string, url str
3232
if err != nil {
3333
return "", err
3434
}
35-
for _, v := range actionDownloadInfo.Actions {
35+
for _, v := range actionDownloadInfo.Actions { //nolint:dupl
3636
token := cache.GHToken
3737
if v.Authentication != nil && v.Authentication.Token != "" {
3838
token = v.Authentication.Token

0 commit comments

Comments
 (0)