Skip to content

Commit

Permalink
chore: update ci config and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanSpeakEasy committed Aug 16, 2024
1 parent 6ea3647 commit 85bbd18
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
7 changes: 1 addition & 6 deletions .circleci/circle_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ set -ex
# might as well run a little longer
export FUZZ_TIME=20s

# there are too many golangci plugins that don't work for 1.19 just yet, so just skip linting for it
if [[ "$GO_VER" == 1.18.* ]]; then
make
else
make test_with_fuzz
fi
make
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- image: cimg/go:<< parameters.golang-version >>
steps:
- checkout
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
- run: .circleci/circle_build.sh

workflows:
Expand All @@ -19,5 +19,4 @@ workflows:
matrix:
parameters:
golang-version:
- '1.18'
- '1.19'
- "1.23"
22 changes: 10 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
run:
tests: false

linters:
linters:
disable-all: true
enable:
- asciicheck
Expand All @@ -10,19 +10,20 @@ linters:
- containedctx
- contextcheck
- decorder
- depguard
# Disabling depguard as there is no guarded list of imports
# - depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
# FIXME: commented out as it crashes with 1.18 for now
# - errname
- errname
- errorlint
- exportloopref
- forbidigo
- funlen
- gci
# Don't need gci and goimports
# - gci
- gochecknoglobals
- gochecknoinits
- gocognit
Expand All @@ -34,15 +35,14 @@ linters:
- gofumpt
- goheader
- goimports
- gomnd
- mnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
- ifshort
- importas
- ineffassign
- lll
Expand All @@ -58,23 +58,21 @@ linters:
- prealloc
- predeclared
- promlinter
# FIXME: doesn't support 1.18 yet
# - revive
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- tagliatelle
- tenv
- testpackage
- thelper
- tparallel
- typecheck
# FIXME: doesn't support 1.23 yet
# - typecheck
- unconvert
- unparam
- unused
- varcheck
- varnamelen
- wastedassign
- whitespace
2 changes: 1 addition & 1 deletion json.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (om *OrderedMap[K, V]) MarshalJSON() ([]byte, error) { //nolint:funlen

writer.RawByte(':')
// the error is checked at the end of the function
writer.Raw(json.Marshal(pair.Value)) //nolint:errchkjson
writer.Raw(json.Marshal(pair.Value))
}

writer.RawByte('}')
Expand Down
8 changes: 4 additions & 4 deletions orderedmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func WithInitialData[K comparable, V any](initialData ...Pair[K, V]) InitOption[
// New creates a new OrderedMap.
// options can either be one or several InitOption[K, V], or a single integer,
// which is then interpreted as a capacity hint, à la make(map[K]V, capacity).
func New[K comparable, V any](options ...any) *OrderedMap[K, V] { //nolint:varnamelen
func New[K comparable, V any](options ...any) *OrderedMap[K, V] {
orderedMap := &OrderedMap[K, V]{}

var config initConfig[K, V]
Expand Down Expand Up @@ -363,11 +363,11 @@ func (om *OrderedMap[K, V]) ValuesFromNewest() iter.Seq[V] {

// From creates a new OrderedMap from an iterator over key-value pairs.
func From[K comparable, V any](i iter.Seq2[K, V]) *OrderedMap[K, V] {
om := New[K, V]()
oMap := New[K, V]()

for k, v := range i {
om.Set(k, v)
oMap.Set(k, v)
}

return om
return oMap
}

0 comments on commit 85bbd18

Please sign in to comment.