Skip to content

Commit

Permalink
upgrade golangci/golangci-lint-action to v1.54
Browse files Browse the repository at this point in the history
  • Loading branch information
umagnus committed Nov 20, 2023
1 parent cd1f2b1 commit 3333934
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.51
version: v1.54
args: -E=gofmt,deadcode,unused,varcheck,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,dupl,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
linters-settings:
depguard:
rules:
main:
files:
- $all
- "!$test"
allow:
- $gostd
- k8s.io
- sigs.k8s.io
- github.com
6 changes: 3 additions & 3 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (ac *Azcopy) GetAzcopyJob(dstFileshare string) (AzcopyJobState, string, err
klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, AzcopyJobError)
return AzcopyJobError, "", fmt.Errorf("couldn't list jobs in azcopy %v", err)
}
jobid, jobState, err := parseAzcopyJobList(out, dstFileshare)
jobid, jobState, err := parseAzcopyJobList(out)
if err != nil || jobState == AzcopyJobError {
klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, jobState)
return AzcopyJobError, "", fmt.Errorf("couldn't parse azcopy job list in azcopy %v", err)
Expand All @@ -153,8 +153,8 @@ func (ac *Azcopy) GetAzcopyJob(dstFileshare string) (AzcopyJobState, string, err
return jobState, percent, nil
}

// parseAzcopyJobList parse command azcopy jobs list, get jobid and state from joblist containing dstFileShareName
func parseAzcopyJobList(joblist string, dstFileShareName string) (string, AzcopyJobState, error) {
// parseAzcopyJobList parse command azcopy jobs list, get jobid and state from joblist
func parseAzcopyJobList(joblist string) (string, AzcopyJobState, error) {
jobid := ""
jobSegments := strings.Split(joblist, "JobId: ")
if len(jobSegments) < 2 {
Expand Down
3 changes: 1 addition & 2 deletions pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ func TestParseAzcopyJobList(t *testing.T) {
}

for _, test := range tests {
dstFileShare := "dstFileShare"
jobid, jobState, err := parseAzcopyJobList(test.str, dstFileShare)
jobid, jobState, err := parseAzcopyJobList(test.str)
if jobid != test.expectedJobid || jobState != test.expectedJobState || !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("test[%s]: unexpected jobid: %v, jobState: %v, err: %v, expected jobid: %v, jobState: %v, err: %v", test.desc, jobid, jobState, err, test.expectedJobid, test.expectedJobState, test.expectedErr)
}
Expand Down

0 comments on commit 3333934

Please sign in to comment.