Skip to content
Open
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
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
name: addlicense
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.23.4
go-version: 1.24.10
- run: go install github.com/google/addlicense@latest
- run: addlicense -check -f licenses/addlicense.tmpl .

Expand All @@ -40,10 +40,10 @@ jobs:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.23.4
go-version: 1.24.10
- name: Build
run: go build -v "./..."
- name: Run Tests
Expand All @@ -59,23 +59,23 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.23.4
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v9
with:
version: v1.63.4
version: v2.6.2

test-race:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.23.4
go-version: 1.24.10
- name: Run Tests
run: go test -race -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
shell: bash
Expand Down
146 changes: 64 additions & 82 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,68 @@
# Copyright 2020-Present Couchbase, Inc.
# Copyright 2025-Present Couchbase, Inc.
#
# Use of this software is governed by the Business Source License included in
# the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that
# file, in accordance with the Business Source License, use of this software
# will be governed by the Apache License, Version 2.0, included in the file
# licenses/APL2.txt.

# config file for golangci-lint

run:
timeout: 3m
# Use of this software is governed by the Business Source License included
# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
# in that file, in accordance with the Business Source License, use of this
# software will be governed by the Apache License, Version 2.0, included in
# the file licenses/APL2.txt.

version: "2"
linters:
enable:
#- bodyclose # checks whether HTTP response body is closed successfully
#- dupl # Tool for code clone detection
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
#- goconst # Finds repeated strings that could be replaced by a constant
#- gocritic # The most opinionated Go source code linter
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
#- goprintffuncname # Checks that printf-like functions are named with `f` at the end
#- gosec # (gas) Inspects source code for security problems
#- gosimple # (megacheck) Linter for Go source code that specializes in simplifying a code
- govet # (vet, vetshadow) Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
#- ineffassign # Detects when assignments to existing variables are not used
#- nakedret # Finds naked returns in functions greater than a specified function length
#- prealloc # Finds slice declarations that could potentially be preallocated
#- revive # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
#- staticcheck # (megacheck) Staticcheck is a go vet on steroids, applying a ton of static analysis checks
#- structcheck # Finds unused struct fields - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
#- unconvert # Remove unnecessary type conversions
#- unparam # Reports unused function parameters
#- unused # (megacheck) Checks Go code for unused constants, variables, functions and types
disable:
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- depguard # Go linter that checks if package imports are in a list of acceptable packages
- dogsled # Checks assignments with too many blank identifiers # (e.g. x, _, _, _, := f())
- funlen # Tool for detection of long functions
- gochecknoglobals # Checks that no globals are present in Go code
- gochecknoinits # Checks that no init functions are present in Go code
- gocognit # Computes and checks the cognitive complexity of functions
- gocyclo # Computes and checks the cyclomatic complexity of functions
- godot # Check if comments end in a period
- godox # Tool for detection of FIXME, TODO and other comment keywords
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
- gomodguard # Allow and block list linter for direct Go module dependencies.
- lll # Reports long lines
- misspell # Finds commonly misspelled English words in comments
- nestif # Reports deeply nested if statements
- nolintlint # Reports ill-formed or insufficient nolint directives
- rowserrcheck # checks whether Err of rows is checked successfully
- stylecheck # Stylecheck is a replacement for golint
- testpackage # linter that makes you use a separate _test package
- unused # (megacheck) Checks Go code for unused constants, variables, functions and types
- whitespace # Tool for detection of leading and trailing whitespace
- wsl # Whitespace Linter - Forces you to use empty lines!
# Once fixed, should enable
- bodyclose # checks whether HTTP response body is closed successfully
- dupl # Tool for code clone detection
- goconst # Finds repeated strings that could be replaced by a constant
- gocritic # The most opinionated Go source code linter
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
- gosec # (gas) Inspects source code for security problems
- gosimple # (megacheck) Linter for Go source code that specializes in simplifying a code
- ineffassign # Detects when assignments to existing variables are not used
- nakedret # Finds naked returns in functions greater than a specified function length
- prealloc # Finds slice declarations that could potentially be preallocated
- revive # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
- staticcheck # (megacheck) Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- unconvert # Remove unnecessary type conversions
- unparam # Reports unused function parameters

# Don't enable fieldalignment, changing the field alignment requires checking to see if anyone uses constructors
# without names. If there is a memory issue on a specific field, that is best found with a heap profile.
#linters-settings:
# govet:
# enable:
# - fieldalignment # detect Go structs that would take less memory if their fields were sorted

# Disable goconst in test files, often we have duplicated strings across tests, but don't make sense as constants.
issues:
exclude-rules:
- path: (_test\.go|utilities_testing\.go)
linters:
- goconst
- asciicheck
- bodyclose
- depguard
- dogsled
- dupl
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gomodguard
- goprintffuncname
- gosec
- ineffassign
- lll
- misspell
- nakedret
- nestif
- nolintlint
- prealloc
- revive
- rowserrcheck
- staticcheck
- testpackage
- unconvert
- unparam
- unused
- whitespace
- wsl
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- goconst
path: (_test\.go|utilities_testing\.go)
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/couchbase/sg-bucket v0.0.0-20240606153601-d152b90edccb
github.com/google/uuid v1.6.0
github.com/mattn/go-sqlite3 v1.14.24
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ github.com/robertkrimen/otto v0.0.0-20211024170158-b87d35c0b86f h1:a7clxaGmmqtdN
github.com/robertkrimen/otto v0.0.0-20211024170158-b87d35c0b86f/go.mod h1:/mK7FZ3mFYEn9zvNPhpngTyatyehSwte5bJZ4ehL5Xw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
Loading