Skip to content

Commit e8167a2

Browse files
authored
Enable gocritic during linting (#20715)
Enabled gocritic's evalOrder to catch dependencies on undefined behavior on return statements. Updated to latest version of golangci-lint. Fixed issue in azblob flagged by latest linter.
1 parent 163dbda commit e8167a2

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

eng/.golangci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@ run:
33
# default is true. Enables skipping of directories:
44
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
55
skip-dirs-use-default: true
6+
timeout: 10m
7+
8+
linters:
9+
enable:
10+
- gocritic
11+
12+
linters-settings:
13+
gocritic:
14+
enabled-checks:
15+
- evalOrder

eng/pipelines/templates/variables/globals.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
GoLintCLIVersion: 'v1.51.1'
2+
GoLintCLIVersion: 'v1.52.2'
33
Package.EnableSBOMSigning: true
44
# Enable go native component governance detection
55
# https://docs.opensource.microsoft.com/tools/cg/index.html

sdk/storage/azblob/blockblob/mmf_windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ func newMMB(size int64) (mmb, error) {
2626
if err != nil {
2727
return nil, os.NewSyscallError("CreateFileMapping", err)
2828
}
29-
defer syscall.CloseHandle(hMMF)
29+
defer func() {
30+
_ = syscall.CloseHandle(hMMF)
31+
}()
3032

3133
addr, err := syscall.MapViewOfFile(hMMF, access, 0, 0, uintptr(size))
3234
if err != nil {

0 commit comments

Comments
 (0)