Skip to content

Commit

Permalink
Enable gocritic during linting (#20715)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhendrixMSFT authored Apr 28, 2023
1 parent 163dbda commit e8167a2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions eng/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ run:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
timeout: 10m

linters:
enable:
- gocritic

linters-settings:
gocritic:
enabled-checks:
- evalOrder
2 changes: 1 addition & 1 deletion eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
GoLintCLIVersion: 'v1.51.1'
GoLintCLIVersion: 'v1.52.2'
Package.EnableSBOMSigning: true
# Enable go native component governance detection
# https://docs.opensource.microsoft.com/tools/cg/index.html
Expand Down
4 changes: 3 additions & 1 deletion sdk/storage/azblob/blockblob/mmf_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func newMMB(size int64) (mmb, error) {
if err != nil {
return nil, os.NewSyscallError("CreateFileMapping", err)
}
defer syscall.CloseHandle(hMMF)
defer func() {
_ = syscall.CloseHandle(hMMF)
}()

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

0 comments on commit e8167a2

Please sign in to comment.