Skip to content

Commit

Permalink
Add staticcheck (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
sj14 committed May 5, 2023
1 parent 6813443 commit db8f86f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/go.yml → .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Go
on:
pull_request:
paths:
- go.sum
- go.mod
- "**.go"
- .github/workflows/go.yaml

jobs:
build:
Expand All @@ -19,9 +22,13 @@ jobs:
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: go build -v ./cmd/dbbench/...
- name: Format
run: |
go fmt ./...
git diff --exit-code
- name: staticcheck
uses: dominikh/staticcheck-action@v1.3.0
with:
install-go: false
- name: Test
run: go test -race ./...
# - name: Run golangci-lint
# uses: golangci/golangci-lint-action@v3.2.0
File renamed without changes.
4 changes: 2 additions & 2 deletions benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func (b *mockedBencher) Exec(s string) { _ = b.Called(s) }

func TestBuildStmt(t *testing.T) {
// arrange
tmpl := template.Must(template.New("test").Parse("{{.Iter}} {{call .RandInt63}}"))
tmpl := template.Must(template.New("test").Parse("{{.Iter}} test"))

// act
stmt := buildStmt(tmpl, 1337)

// assert
want := "1337 5577006791947779410"
want := "1337 test"
if stmt != want {
t.Errorf("got statement %v, want %v", stmt, want)
}
Expand Down
5 changes: 1 addition & 4 deletions cmd/dbbench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func main() {
*threads = *iter
}

benchmarks := []benchmark.Benchmark{}
benchmarks := bencher.Benchmarks()

// If a script was specified, overwrite built-in benchmarks.
if *scriptname != "" {
Expand All @@ -193,9 +193,6 @@ func main() {
if err != nil {
log.Fatalf("failed to parse script: %v\n", err)
}
} else {
// Otherwise use built-in benchmarks.
benchmarks = bencher.Benchmarks()
}

// split benchmark names when "-run 'bench0 bench1 ...'" flag was used
Expand Down

0 comments on commit db8f86f

Please sign in to comment.