Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 96 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,124 @@
version: "2"
output:
sort-order:
- file
linters:
default: none
enable:
- bidichk
- bodyclose
- dogsled
- dupl
- depguard
- errcheck
- exhaustive
- gochecknoinits
- goconst
- forbidigo
- gocheckcompilerdirectives
- gocritic
- gocyclo
- goprintffuncname
- gosec
- govet
- ineffassign
- lll
- misspell
- mirror
- modernize
- nakedret
- noctx
- nilnil
- nolintlint
- perfsprint
- revive
- staticcheck
- testifylint
- unconvert
- unparam
- unused
- whitespace
- usestdlibvars
- usetesting
- wastedassign
settings:
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: use os or io instead
- pkg: golang.org/x/exp
desc: it's experimental and unreliable
- pkg: github.com/pkg/errors
desc: use builtin errors package instead
nolintlint:
allow-unused: false
require-explanation: true
require-specific: true
gocritic:
enabled-checks:
- equalFold
disabled-checks: []
revive:
severity: error
rules:
- name: blank-imports
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-lines
- name: error-return
- name: error-strings
- name: exported
- name: identical-branches
- name: if-return
- name: increment-decrement
- name: modifies-value-receiver
- name: package-comments
- name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: var-declaration
- name: var-naming
disabled: true
staticcheck:
checks:
- all
testifylint: {}
usetesting:
os-temp-dir: true
perfsprint:
concat-loop: false
govet:
enable:
- nilness
- unusedwrite
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
rules:
- linters:
- errcheck
- staticcheck
- unparam
path: _test\.go
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
- golines
settings:
gci:
custom-order: true
sections:
- standard
- prefix(github.com/golang-queue/queue)
- default
gofumpt:
extra:
group-params: true
clothe-returns: true
balance-calls: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
run:
timeout: 10m
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
GO ?= go
TOOLS_MOD := -modfile=go.tools.mod

## test: run tests
test:
$(GO) test -race -v -cover -covermode=atomic -coverprofile=coverage.out ./...

## upgrade: upgrade dependencies
upgrade:
$(GO) get -u ./...

## install-tools: download tool dependencies (golangci-lint) via tools modfile
install-tools:
$(GO) mod download $(TOOLS_MOD)

## fmt: format go files using golangci-lint
fmt:
$(GO) tool $(TOOLS_MOD) golangci-lint fmt

## lint: run golangci-lint to check for issues
lint:
$(GO) tool $(TOOLS_MOD) golangci-lint run

.PHONY: test upgrade install-tools fmt lint
3 changes: 2 additions & 1 deletion _example/example01/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"fmt"
"time"

"github.com/golang-queue/contrib/zerolog"
"github.com/golang-queue/queue"

"github.com/golang-queue/contrib/zerolog"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion _example/example02/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"log"
"time"

"github.com/golang-queue/contrib/zerolog"
"github.com/golang-queue/queue"
"github.com/golang-queue/queue/core"

"github.com/golang-queue/contrib/zerolog"
)

type job struct {
Expand Down
2 changes: 1 addition & 1 deletion benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func testQueue(b *testing.B, pool testqueue) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
for i := 0; i < count; i++ {
for range count {
_ = pool.Queue(&message)
_, _ = pool.Request()
}
Expand Down
Loading
Loading