Skip to content

Commit

Permalink
Use staticcheck instead of golint (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
puzpuzpuz authored Feb 27, 2022
1 parent ab3ed40 commit 446d9db
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 11 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-1.18.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build-1.18
on: [push]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.18.0-rc1]
name: Build with Go ${{ matrix.go-version }}
steps:
- uses: actions/[email protected]
- name: Install Go
uses: actions/setup-go@v2
with:
stable: false
go-version: ${{ matrix.go-version }}

- name: Run tests
run: go test -v ./...

- name: Run tests with race detector
run: go test -timeout 10m -race -v ./...
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.16.x, 1.17.x, 1.18.0-rc1]
go-version: [1.16.x, 1.17.x]
name: Build with Go ${{ matrix.go-version }}
steps:
- uses: actions/[email protected]
Expand All @@ -16,16 +16,16 @@ jobs:
stable: false
go-version: ${{ matrix.go-version }}

- name: Install golint
run: go get -u golang.org/x/lint/golint
- name: Install staticcheck
run: go get honnef.co/go/tools/cmd/staticcheck

- name: Run linters
run: |
go vet ./...
golint -set_exit_status=1 ./...
staticcheck ./...
- name: Run tests
run: go test -v ./...

- name: Run tests with race detector
run: go test -race -v ./...
run: go test -timeout 10m -race -v ./...
3 changes: 2 additions & 1 deletion counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type Counter struct {
}

type cstripe struct {
c int64
c int64
//lint:ignore U1000 prevents false sharing
pad [cacheLineSize - 8]byte
}

Expand Down
3 changes: 2 additions & 1 deletion map.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ type mapTable struct {
}

type counterStripe struct {
c int64
c int64
//lint:ignore U1000 prevents false sharing
pad [cacheLineSize - 8]byte
}

Expand Down
11 changes: 7 additions & 4 deletions mpmcqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ import (
// Based on the data structure from the following C++ library:
// https://github.com/rigtorp/MPMCQueue
type MPMCQueue struct {
cap uint64
head uint64
hpad [cacheLineSize - 8]byte
tail uint64
cap uint64
head uint64
//lint:ignore U1000 prevents false sharing
hpad [cacheLineSize - 8]byte
tail uint64
//lint:ignore U1000 prevents false sharing
tpad [cacheLineSize - 8]byte
slots []slot
}

type slot struct {
slotInternal
//lint:ignore U1000 prevents false sharing
pad [cacheLineSize - unsafe.Sizeof(slotInternal{})]byte
}

Expand Down
2 changes: 2 additions & 0 deletions rbmutex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func benchmarkRBMutex(b *testing.B, localWork, writeRatio int) {
foo++
if writeRatio > 0 && foo%writeRatio == 0 {
m.Lock()
//lint:ignore SA2001 critical section is empty in this benchmark
m.Unlock()
} else {
tk := m.RLock()
Expand Down Expand Up @@ -194,6 +195,7 @@ func benchmarkRWMutex(b *testing.B, localWork, writeRatio int) {
foo++
if writeRatio > 0 && foo%writeRatio == 0 {
m.Lock()
//lint:ignore SA2001 critical section is empty in this benchmark
m.Unlock()
} else {
m.RLock()
Expand Down

0 comments on commit 446d9db

Please sign in to comment.