From ed26d5c15ea943b90c907f1bd578287434884eaa Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Mon, 11 May 2026 18:45:30 +0800 Subject: [PATCH 1/5] wire make lint into the make check --- .github/workflows/pr_build_and_test.yaml | 2 +- Makefile | 8 +- tools/Makefile | 2 +- tools/check/go.mod | 285 +++++----- tools/check/go.sum | 663 ++++++++++++----------- tools/check/tools.go | 2 +- 6 files changed, 508 insertions(+), 454 deletions(-) diff --git a/.github/workflows/pr_build_and_test.yaml b/.github/workflows/pr_build_and_test.yaml index 4bbd4672fb..ec2bc583a5 100644 --- a/.github/workflows/pr_build_and_test.yaml +++ b/.github/workflows/pr_build_and_test.yaml @@ -50,7 +50,7 @@ jobs: key: ubuntu-latest-ticdc-tools-${{ hashFiles('tools/check/go.sum') }} - name: Check - run: make check + run: make check LINT_NEW_FROM_REV="${{ github.event.pull_request.base.sha }}" classic_build_and_test: if: >- diff --git a/Makefile b/Makefile index 39805ffc83..7ae86337e5 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,11 @@ check-copyright: @./scripts/check-copyright.sh check-static: tools/bin/golangci-lint - tools/bin/golangci-lint run --timeout 10m0s --exclude-dirs "^tests/" +ifneq ($(LINT_NEW_FROM_REV),) + tools/bin/golangci-lint run --timeout 10m0s --new-from-rev=$(LINT_NEW_FROM_REV) +else + tools/bin/golangci-lint run --timeout 10m0s +endif check-ticdc-dashboard: @echo "check-ticdc-dashboard" @@ -328,7 +332,7 @@ check-makefiles: format-makefiles format-makefiles: $(MAKE_FILES) $(SED_IN_PLACE) -e 's/^\(\t*\) /\1\t/g' -e 's/^\(\t*\) /\1/' -- $? -check: check-copyright fmt tidy generate_mock go-generate check-diff-line-width check-ticdc-dashboard check-makefiles +check: check-copyright fmt tidy generate_mock go-generate check-diff-line-width check-ticdc-dashboard check-makefiles check-static @git --no-pager diff --exit-code || (echo "Please add changed files!" && false) clean: diff --git a/tools/Makefile b/tools/Makefile index bf0026e717..40bdb8738e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,7 +8,7 @@ tools/bin/goveralls: tools/check/go.mod cd tools/check && $(GO) build -mod=mod -o ../bin/goveralls github.com/mattn/goveralls tools/bin/golangci-lint: tools/check/go.mod - cd tools/check && $(GO) build -mod=mod -o ../bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint + cd tools/check && $(GO) build -mod=mod -o ../bin/golangci-lint github.com/golangci/golangci-lint/v2/cmd/golangci-lint tools/bin/mockgen: tools/check/go.mod cd tools/check && $(GO) build -mod=mod -o ../bin/mockgen github.com/golang/mock/mockgen diff --git a/tools/check/go.mod b/tools/check/go.mod index 6662d8e7bb..71e96a442b 100644 --- a/tools/check/go.mod +++ b/tools/check/go.mod @@ -5,11 +5,11 @@ go 1.25.8 require ( github.com/AlekSi/gocov-xml v1.1.0 github.com/axw/gocov v1.1.0 - github.com/daixiang0/gci v0.13.5 + github.com/daixiang0/gci v0.13.7 github.com/deepmap/oapi-codegen v1.9.0 github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.7.0-rc.1 - github.com/golangci/golangci-lint v1.61.1-0.20240915150923-7187c89d4091 + github.com/golangci/golangci-lint/v2 v2.12.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 github.com/mattn/goveralls v0.0.8 @@ -17,64 +17,84 @@ require ( github.com/tinylib/msgp v1.5.0 github.com/vektra/mockery/v2 v2.53.4 github.com/zhouqiang-cl/gocovmerge v0.0.0-20190125174600-5256314471af - golang.org/x/tools v0.36.0 + golang.org/x/tools v0.44.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 - google.golang.org/protobuf v1.36.1 + google.golang.org/protobuf v1.36.10 gotest.tools/gotestsum v1.13.0 - mvdan.cc/gofumpt v0.7.0 + mvdan.cc/gofumpt v0.9.2 mvdan.cc/sh/v3 v3.3.1 ) require ( - 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect - 4d63.com/gochecknoglobals v0.2.1 // indirect - github.com/4meepo/tagalign v1.3.4 // indirect - github.com/Abirdcfly/dupword v0.1.1 // indirect - github.com/Antonboom/errname v0.1.13 // indirect - github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/Antonboom/testifylint v1.4.3 // indirect - github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.5.2 // indirect - github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect - github.com/Masterminds/semver/v3 v3.3.0 // indirect - github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect - github.com/alecthomas/go-check-sumtype v0.1.4 // indirect - github.com/alexkohler/nakedret/v2 v2.0.4 // indirect - github.com/alexkohler/prealloc v1.0.0 // indirect + 4d63.com/gocheckcompilerdirectives v1.3.0 // indirect + 4d63.com/gochecknoglobals v0.2.2 // indirect + charm.land/lipgloss/v2 v2.0.3 // indirect + codeberg.org/chavacava/garif v0.2.0 // indirect + codeberg.org/polyfloyd/go-errorlint v1.9.0 // indirect + dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect + dev.gaijin.team/go/golib v0.6.0 // indirect + github.com/4meepo/tagalign v1.4.3 // indirect + github.com/Abirdcfly/dupword v0.1.7 // indirect + github.com/AdminBenni/iota-mixing v1.0.0 // indirect + github.com/AlwxSin/noinlineerr v1.0.5 // indirect + github.com/Antonboom/errname v1.1.1 // indirect + github.com/Antonboom/nilnil v1.1.1 // indirect + github.com/Antonboom/testifylint v1.6.4 // indirect + github.com/BurntSushi/toml v1.6.0 // indirect + github.com/ClickHouse/clickhouse-go-linter v1.2.0 // indirect + github.com/Djarvur/go-err113 v0.1.1 // indirect + github.com/Masterminds/semver/v3 v3.5.0 // indirect + github.com/MirrexOne/unqueryvet v1.5.4 // indirect + github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect + github.com/alecthomas/chroma/v2 v2.24.1 // indirect + github.com/alecthomas/go-check-sumtype v0.3.1 // indirect + github.com/alexkohler/nakedret/v2 v2.0.6 // indirect + github.com/alexkohler/prealloc v1.1.0 // indirect + github.com/alfatraining/structtag v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/ashanbrown/forbidigo v1.6.0 // indirect - github.com/ashanbrown/makezero v1.1.1 // indirect + github.com/alingse/nilnesserr v0.2.0 // indirect + github.com/ashanbrown/forbidigo/v2 v2.3.1 // indirect + github.com/ashanbrown/makezero/v2 v2.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bitfield/gotestdox v0.2.2 // indirect - github.com/bkielbasa/cyclop v1.2.1 // indirect + github.com/bkielbasa/cyclop v1.2.3 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect - github.com/bombsimon/wsl/v4 v4.4.1 // indirect - github.com/breml/bidichk v0.3.1 // indirect - github.com/breml/errchkjson v0.3.6 // indirect - github.com/butuzov/ireturn v0.3.0 // indirect - github.com/butuzov/mirror v1.2.0 // indirect - github.com/catenacyber/perfsprint v0.7.1 // indirect - github.com/ccojocar/zxcvbn-go v1.0.2 // indirect + github.com/bombsimon/wsl/v4 v4.7.0 // indirect + github.com/bombsimon/wsl/v5 v5.8.0 // indirect + github.com/breml/bidichk v0.3.3 // indirect + github.com/breml/errchkjson v0.4.1 // indirect + github.com/butuzov/ireturn v0.4.1 // indirect + github.com/butuzov/mirror v1.3.0 // indirect + github.com/catenacyber/perfsprint v0.10.1 // indirect + github.com/ccojocar/zxcvbn-go v1.0.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/charithe/durationcheck v0.0.10 // indirect - github.com/chavacava/garif v0.1.0 // indirect + github.com/charithe/durationcheck v0.0.11 // indirect + github.com/charmbracelet/colorprofile v0.4.3 // indirect + github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318 // indirect + github.com/charmbracelet/x/ansi v0.11.7 // indirect + github.com/charmbracelet/x/term v0.2.2 // indirect + github.com/charmbracelet/x/termios v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.2.2 // indirect github.com/chigopher/pathlib v0.19.1 // indirect - github.com/ckaznocha/intrange v0.2.1 // indirect - github.com/curioswitch/go-reassign v0.2.0 // indirect + github.com/ckaznocha/intrange v0.3.1 // indirect + github.com/clipperhouse/displaywidth v0.11.0 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect + github.com/curioswitch/go-reassign v0.3.0 // indirect + github.com/dave/dst v0.27.3 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/denis-tingaikin/go-header v0.5.0 // indirect + github.com/dlclark/regexp2 v1.12.0 // indirect github.com/dnephin/pflag v1.0.7 // indirect github.com/ettle/strcase v0.2.0 // indirect - github.com/fatih/color v1.18.0 // indirect + github.com/fatih/color v1.19.0 // indirect github.com/fatih/structtag v1.2.0 // indirect - github.com/firefart/nonamedreturns v1.0.5 // indirect + github.com/firefart/nonamedreturns v1.0.6 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/getkin/kin-openapi v0.80.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect - github.com/ghostiam/protogetter v0.3.8 // indirect - github.com/go-critic/go-critic v0.11.4 // indirect + github.com/ghostiam/protogetter v0.3.20 // indirect + github.com/go-critic/go-critic v0.14.3 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/swag v0.19.15 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect @@ -84,152 +104,161 @@ require ( github.com/go-toolsmith/astp v1.1.0 // indirect github.com/go-toolsmith/strparse v1.1.0 // indirect github.com/go-toolsmith/typep v1.1.0 // indirect - github.com/go-viper/mapstructure/v2 v2.4.0 // indirect - github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/flock v0.12.1 // indirect + github.com/godoc-lint/godoc-lint v0.11.2 // indirect + github.com/gofrs/flock v0.13.0 // indirect github.com/golang/glog v1.0.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect - github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 // indirect + github.com/golangci/asciicheck v0.5.0 // indirect + github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 // indirect + github.com/golangci/go-printf-func-name v0.1.1 // indirect + github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golines v0.15.0 // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect - github.com/golangci/misspell v0.6.0 // indirect - github.com/golangci/modinfo v0.3.4 // indirect - github.com/golangci/plugin-module-register v0.1.1 // indirect - github.com/golangci/revgrep v0.5.3 // indirect - github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect + github.com/golangci/misspell v0.8.0 // indirect + github.com/golangci/plugin-module-register v0.1.2 // indirect + github.com/golangci/revgrep v0.8.0 // indirect + github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba // indirect + github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect + github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/renameio v1.0.1 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/gordonklaus/ineffassign v0.1.0 // indirect + github.com/gordonklaus/ineffassign v0.2.0 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect - github.com/gostaticanalysis/comment v1.4.2 // indirect - github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect - github.com/gostaticanalysis/nilerr v0.1.1 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/gostaticanalysis/comment v1.5.0 // indirect + github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect + github.com/gostaticanalysis/nilerr v0.1.2 // indirect + github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect + github.com/hashicorp/go-version v1.9.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jgautheron/goconst v1.7.1 // indirect - github.com/jingyugao/rowserrcheck v1.1.1 // indirect + github.com/jgautheron/goconst v1.10.0 // indirect github.com/jinzhu/copier v0.4.0 // indirect - github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect - github.com/jjti/go-spancheck v0.6.2 // indirect + github.com/jjti/go-spancheck v0.6.5 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/julz/importas v0.1.0 // indirect - github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect - github.com/kisielk/errcheck v1.7.0 // indirect - github.com/kkHAIKE/contextcheck v1.1.5 // indirect - github.com/kulti/thelper v0.6.3 // indirect - github.com/kunwardeep/paralleltest v1.0.10 // indirect - github.com/kyoh86/exportloopref v0.1.11 // indirect + github.com/julz/importas v0.2.0 // indirect + github.com/karamaru-alpha/copyloopvar v1.2.2 // indirect + github.com/kisielk/errcheck v1.10.0 // indirect + github.com/kkHAIKE/contextcheck v1.1.6 // indirect + github.com/kulti/thelper v0.7.1 // indirect + github.com/kunwardeep/paralleltest v1.0.15 // indirect github.com/labstack/echo/v4 v4.9.0 // indirect github.com/labstack/gommon v0.3.1 // indirect - github.com/lasiar/canonicalheader v1.1.1 // indirect - github.com/ldez/gomoddirectives v0.2.4 // indirect - github.com/ldez/tagliatelle v0.5.0 // indirect + github.com/lasiar/canonicalheader v1.1.2 // indirect + github.com/ldez/exptostd v0.4.5 // indirect + github.com/ldez/gomoddirectives v0.8.0 // indirect + github.com/ldez/grignotin v0.10.1 // indirect + github.com/ldez/structtags v0.6.1 // indirect + github.com/ldez/tagliatelle v0.7.2 // indirect + github.com/ldez/usetesting v0.5.0 // indirect github.com/leonklingele/grouper v1.1.2 // indirect - github.com/lufeee/execinquery v1.2.1 // indirect - github.com/macabu/inamedparam v0.1.3 // indirect - github.com/mailru/easyjson v0.7.6 // indirect - github.com/maratori/testableexamples v1.0.0 // indirect - github.com/maratori/testpackage v1.1.1 // indirect - github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect + github.com/lucasb-eyer/go-colorful v1.4.0 // indirect + github.com/macabu/inamedparam v0.2.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/manuelarte/embeddedstructfieldcheck v0.4.0 // indirect + github.com/manuelarte/funcorder v0.6.0 // indirect + github.com/maratori/testableexamples v1.0.1 // indirect + github.com/maratori/testpackage v1.1.2 // indirect + github.com/matoous/godox v1.1.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mattn/go-runewidth v0.0.23 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mgechev/revive v1.3.9 // indirect + github.com/mgechev/revive v1.15.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.16.2 // indirect - github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/nunnatsa/ginkgolinter v0.23.0 // indirect + github.com/pelletier/go-toml/v2 v2.3.1 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.6.0 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect - github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect + github.com/quasilyte/go-ruleguard v0.4.5 // indirect + github.com/quasilyte/go-ruleguard/dsl v0.3.23 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/raeperd/recvcheck v0.1.2 // indirect + github.com/raeperd/recvcheck v0.2.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect + github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/rs/zerolog v1.33.0 // indirect - github.com/ryancurrah/gomodguard v1.3.5 // indirect - github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect + github.com/ryancurrah/gomodguard v1.4.1 // indirect + github.com/ryancurrah/gomodguard/v2 v2.1.3 // indirect + github.com/ryanrolds/sqlclosecheck v0.6.0 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect - github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect - github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect + github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect - github.com/securego/gosec/v2 v2.21.2 // indirect - github.com/sergi/go-diff v1.1.0 // indirect - github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect + github.com/securego/gosec/v2 v2.26.1 // indirect + github.com/sergi/go-diff v1.2.0 // indirect + github.com/sirupsen/logrus v1.9.4 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.10.0 // indirect - github.com/sonatard/noctx v0.1.0 // indirect + github.com/sonatard/noctx v0.5.1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect - github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.12.0 // indirect + github.com/sourcegraph/go-diff v0.8.0 // indirect + github.com/spf13/afero v1.15.0 // indirect github.com/spf13/cast v1.7.1 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.6 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/viper v1.20.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect - github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect + github.com/stbenjam/no-sprintf-host-port v0.3.1 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/stretchr/testify v1.10.0 // indirect + github.com/stretchr/testify v1.11.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.18 // indirect - github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect - github.com/timonwong/loggercheck v0.9.4 // indirect - github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect + github.com/tetafro/godot v1.5.6 // indirect + github.com/timakin/bodyclose v0.0.0-20260129054331-73d1f95b84b4 // indirect + github.com/timonwong/loggercheck v0.11.0 // indirect + github.com/tomarrell/wrapcheck/v2 v2.12.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/ultraware/funlen v0.1.0 // indirect - github.com/ultraware/whitespace v0.1.1 // indirect - github.com/uudashr/gocognit v1.1.3 // indirect + github.com/ultraware/funlen v0.2.0 // indirect + github.com/ultraware/whitespace v0.2.0 // indirect + github.com/uudashr/gocognit v1.2.1 // indirect + github.com/uudashr/iface v1.4.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect - github.com/xen0n/gosmopolitan v1.2.2 // indirect + github.com/xen0n/gosmopolitan v1.3.0 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.3.0 // indirect github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect - go-simpler.org/musttag v0.12.2 // indirect - go-simpler.org/sloglint v0.7.2 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/automaxprocs v1.5.3 // indirect + go-simpler.org/musttag v0.14.0 // indirect + go-simpler.org/sloglint v0.12.0 // indirect + go.augendre.info/arangolint v0.4.0 // indirect + go.augendre.info/fatcontext v0.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect - golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect - golang.org/x/mod v0.27.0 // indirect - golang.org/x/net v0.43.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.36.0 // indirect - golang.org/x/term v0.35.0 // indirect - golang.org/x/text v0.28.0 // indirect - golang.org/x/tools/go/expect v0.1.1-deprecated // indirect - golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect + go.uber.org/zap v1.27.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20260209203927-2842357ff358 // indirect + golang.org/x/mod v0.35.0 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa // indirect + golang.org/x/term v0.42.0 // indirect + golang.org/x/text v0.36.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.5.1 // indirect + honnef.co/go/tools v0.7.0 // indirect mvdan.cc/editorconfig v0.2.0 // indirect - mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect + mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15 // indirect ) diff --git a/tools/check/go.sum b/tools/check/go.sum index 094f8992df..482ae96c5c 100644 --- a/tools/check/go.sum +++ b/tools/check/go.sum @@ -1,7 +1,9 @@ -4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= -4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= -4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= -4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= +4d63.com/gocheckcompilerdirectives v1.3.0 h1:Ew5y5CtcAAQeTVKUVFrE7EwHMrTO6BggtEj8BZSjZ3A= +4d63.com/gocheckcompilerdirectives v1.3.0/go.mod h1:ofsJ4zx2QAuIP/NO/NAh1ig6R1Fb18/GI7RVMwz7kAY= +4d63.com/gochecknoglobals v0.2.2 h1:H1vdnwnMaZdQW/N+NrkT1SZMTBmcwHe9Vq8lJcYYTtU= +4d63.com/gochecknoglobals v0.2.2/go.mod h1:lLxwTQjL5eIesRbvnzIP3jZtG140FnTdz+AlMa+ogt0= +charm.land/lipgloss/v2 v2.0.3 h1:yM2zJ4Cf5Y51b7RHIwioil4ApI/aypFXXVHSwlM6RzU= +charm.land/lipgloss/v2 v2.0.3/go.mod h1:7myLU9iG/3xluAWzpY/fSxYYHCgoKTie7laxk6ATwXA= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -34,110 +36,146 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +codeberg.org/chavacava/garif v0.2.0 h1:F0tVjhYbuOCnvNcU3YSpO6b3Waw6Bimy4K0mM8y6MfY= +codeberg.org/chavacava/garif v0.2.0/go.mod h1:P2BPbVbT4QcvLZrORc2T29szK3xEOlnl0GiPTJmEqBQ= +codeberg.org/polyfloyd/go-errorlint v1.9.0 h1:VkdEEmA1VBpH6ecQoMR4LdphVI3fA4RrCh2an7YmodI= +codeberg.org/polyfloyd/go-errorlint v1.9.0/go.mod h1:GPRRu2LzVijNn4YkrZYJfatQIdS+TrcK8rL5Xs24qw8= +dev.gaijin.team/go/exhaustruct/v4 v4.0.0 h1:873r7aNneqoBB3IaFIzhvt2RFYTuHgmMjoKfwODoI1Y= +dev.gaijin.team/go/exhaustruct/v4 v4.0.0/go.mod h1:aZ/k2o4Y05aMJtiux15x8iXaumE88YdiB0Ai4fXOzPI= +dev.gaijin.team/go/golib v0.6.0 h1:v6nnznFTs4bppib/NyU1PQxobwDHwCXXl15P7DV5Zgo= +dev.gaijin.team/go/golib v0.6.0/go.mod h1:uY1mShx8Z/aNHWDyAkZTkX+uCi5PdX7KsG1eDQa2AVE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8= -github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= -github.com/Abirdcfly/dupword v0.1.1 h1:Bsxe0fIw6OwBtXMIncaTxCLHYO5BB+3mcsR5E8VXloY= -github.com/Abirdcfly/dupword v0.1.1/go.mod h1:B49AcJdTYYkpd4HjgAcutNGG9HZ2JWwKunH9Y2BA6sM= +github.com/4meepo/tagalign v1.4.3 h1:Bnu7jGWwbfpAie2vyl63Zup5KuRv21olsPIha53BJr8= +github.com/4meepo/tagalign v1.4.3/go.mod h1:00WwRjiuSbrRJnSVeGWPLp2epS5Q/l4UEy0apLLS37c= +github.com/Abirdcfly/dupword v0.1.7 h1:2j8sInznrje4I0CMisSL6ipEBkeJUJAmK1/lfoNGWrQ= +github.com/Abirdcfly/dupword v0.1.7/go.mod h1:K0DkBeOebJ4VyOICFdppB23Q0YMOgVafM0zYW0n9lF4= +github.com/AdminBenni/iota-mixing v1.0.0 h1:Os6lpjG2dp/AE5fYBPAA1zfa2qMdCAWwPMCgpwKq7wo= +github.com/AdminBenni/iota-mixing v1.0.0/go.mod h1:i4+tpAaB+qMVIV9OK3m4/DAynOd5bQFaOu+2AhtBCNY= github.com/AlekSi/gocov-xml v1.1.0 h1:iElWGi7s/MuL8/d8WDtI2fOAsN3ap9x8nK5RrAhaDng= github.com/AlekSi/gocov-xml v1.1.0/go.mod h1:g1dRVOCHjKkMtlPfW6BokJ/qxoeZ1uPNAK7A/ii3CUo= -github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= -github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= -github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= -github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.4.3 h1:ohMt6AHuHgttaQ1xb6SSnxCeK4/rnK7KKzbvs7DmEck= -github.com/Antonboom/testifylint v1.4.3/go.mod h1:+8Q9+AOLsz5ZiQiiYujJKs9mNz398+M6UgslP4qgJLA= +github.com/AlwxSin/noinlineerr v1.0.5 h1:RUjt63wk1AYWTXtVXbSqemlbVTb23JOSRiNsshj7TbY= +github.com/AlwxSin/noinlineerr v1.0.5/go.mod h1:+QgkkoYrMH7RHvcdxdlI7vYYEdgeoFOVjU9sUhw/rQc= +github.com/Antonboom/errname v1.1.1 h1:bllB7mlIbTVzO9jmSWVWLjxTEbGBVQ1Ff/ClQgtPw9Q= +github.com/Antonboom/errname v1.1.1/go.mod h1:gjhe24xoxXp0ScLtHzjiXp0Exi1RFLKJb0bVBtWKCWQ= +github.com/Antonboom/nilnil v1.1.1 h1:9Mdr6BYd8WHCDngQnNVV0b554xyisFioEKi30sksufQ= +github.com/Antonboom/nilnil v1.1.1/go.mod h1:yCyAmSw3doopbOWhJlVci+HuyNRuHJKIv6V2oYQa8II= +github.com/Antonboom/testifylint v1.6.4 h1:gs9fUEy+egzxkEbq9P4cpcMB6/G0DYdMeiFS87UiqmQ= +github.com/Antonboom/testifylint v1.6.4/go.mod h1:YO33FROXX2OoUfwjz8g+gUxQXio5i9qpVy7nXGbxDD4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= -github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA= -github.com/Crocmagnon/fatcontext v0.5.2/go.mod h1:87XhRMaInHP44Q7Tlc7jkgKKB7kZAOPiDkFMdKCC+74= -github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= -github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= -github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= -github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= -github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= -github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= -github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= -github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= -github.com/alecthomas/go-check-sumtype v0.1.4/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= -github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/ClickHouse/clickhouse-go-linter v1.2.0 h1:zbm174up3hTKjp0wKZVnTzRiG7tSF5XZF0FJG/MuCBI= +github.com/ClickHouse/clickhouse-go-linter v1.2.0/go.mod h1:pLorS7ffPTfuUV9M0SJgfHA/h/WQPQUk2FWG9x74cQ4= +github.com/Djarvur/go-err113 v0.1.1 h1:eHfopDqXRwAi+YmCUas75ZE0+hoBHJ2GQNLYRSxao4g= +github.com/Djarvur/go-err113 v0.1.1/go.mod h1:IaWJdYFLg76t2ihfflPZnM1LIQszWOsFDh2hhhAVF6k= +github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE= +github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/MirrexOne/unqueryvet v1.5.4 h1:38QOxShO7JmMWT+eCdDMbcUgGCOeJphVkzzRgyLJgsQ= +github.com/MirrexOne/unqueryvet v1.5.4/go.mod h1:fs9Zq6eh1LRIhsDIsxf9PONVUjYdFHdtkHIgZdJnyPU= +github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4= +github.com/OpenPeeDeeP/depguard/v2 v2.2.1/go.mod h1:q4DKzC4UcVaAvcfd41CZh0PWpGgzrVxUYBlgKNGquUo= +github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= +github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/chroma/v2 v2.24.1 h1:m5ffpfZbIb++k8AqFEKy9uVgY12xIQtBsQlc6DfZJQM= +github.com/alecthomas/chroma/v2 v2.24.1/go.mod h1:l+ohZ9xRXIbGe7cIW+YZgOGbvuVLjMps/FYN/CwuabI= +github.com/alecthomas/go-check-sumtype v0.3.1 h1:u9aUvbGINJxLVXiFvHUlPEaD7VDULsrxJb4Aq31NLkU= +github.com/alecthomas/go-check-sumtype v0.3.1/go.mod h1:A8TSiN3UPRw3laIgWEUOHHLPa6/r9MtoigdlP5h3K/E= +github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= +github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alexkohler/nakedret/v2 v2.0.4 h1:yZuKmjqGi0pSmjGpOC016LtPJysIL0WEUiaXW5SUnNg= -github.com/alexkohler/nakedret/v2 v2.0.4/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= -github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= -github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= +github.com/alexkohler/nakedret/v2 v2.0.6 h1:ME3Qef1/KIKr3kWX3nti3hhgNxw6aqN5pZmQiFSsuzQ= +github.com/alexkohler/nakedret/v2 v2.0.6/go.mod h1:l3RKju/IzOMQHmsEvXwkqMDzHHvurNQfAgE1eVmT40Q= +github.com/alexkohler/prealloc v1.1.0 h1:cKGRBqlXw5iyQGLYhrXrDlcHxugXpTq4tQ5c91wkf8M= +github.com/alexkohler/prealloc v1.1.0/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= +github.com/alfatraining/structtag v1.0.0 h1:2qmcUqNcCoyVJ0up879K614L9PazjBSFruTB0GOFjCc= +github.com/alfatraining/structtag v1.0.0/go.mod h1:p3Xi5SwzTi+Ryj64DqjLWz7XurHxbGsq6y3ubePJPus= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= +github.com/alingse/nilnesserr v0.2.0 h1:raLem5KG7EFVb4UIDAXgrv3N2JIaffeKNtcEXkEWd/w= +github.com/alingse/nilnesserr v0.2.0/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= -github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= -github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= -github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= +github.com/ashanbrown/forbidigo/v2 v2.3.1 h1:KAZijvQ7zeIBKbhikT4jCm0TLYXC4u78bTiLh/8JROI= +github.com/ashanbrown/forbidigo/v2 v2.3.1/go.mod h1:2QDkLTzU6TV937eFROamXrW92M3paehdae4HCDCOZCM= +github.com/ashanbrown/makezero/v2 v2.2.1 h1:A7uU8dgB1PA9aelTxHMfHIQ8Qev8AB3JLxJUBUsejqM= +github.com/ashanbrown/makezero/v2 v2.2.1/go.mod h1:aEGT/9q3S8DHeE57C88z2a6xydvgx8J5hgXIGWgo0MY= github.com/axw/gocov v1.1.0 h1:y5U1krExoJDlb/kNtzxyZQmNRprFOFCutWbNjcQvmVM= github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitfield/gotestdox v0.2.2 h1:x6RcPAbBbErKLnapz1QeAlf3ospg8efBsedU93CDsnE= github.com/bitfield/gotestdox v0.2.2/go.mod h1:D+gwtS0urjBrzguAkTM2wodsTQYFHdpx8eqRJ3N+9pY= -github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= -github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= +github.com/bkielbasa/cyclop v1.2.3 h1:faIVMIGDIANuGPWH031CZJTi2ymOQBULs9H21HSMa5w= +github.com/bkielbasa/cyclop v1.2.3/go.mod h1:kHTwA9Q0uZqOADdupvcFJQtp/ksSnytRMe8ztxG8Fuo= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= -github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= -github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= -github.com/breml/bidichk v0.3.1 h1:mm0l1NVE6lhaF4GUI8wX6TRV+e9kyHSvtA1wSG3nDqU= -github.com/breml/bidichk v0.3.1/go.mod h1:Qo0jQtZkQYyArvHxFXxNmaioxJRgfnSo6UirDTaAJL4= -github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= -github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= -github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= -github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= -github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= -github.com/butuzov/mirror v1.2.0/go.mod h1:DqZZDtzm42wIAIyHXeN8W/qb1EPlb9Qn/if9icBOpdQ= -github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= -github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= -github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= -github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= +github.com/bombsimon/wsl/v4 v4.7.0 h1:1Ilm9JBPRczjyUs6hvOPKvd7VL1Q++PL8M0SXBDf+jQ= +github.com/bombsimon/wsl/v4 v4.7.0/go.mod h1:uV/+6BkffuzSAVYD+yGyld1AChO7/EuLrCF/8xTiapg= +github.com/bombsimon/wsl/v5 v5.8.0 h1:JTkyfs4yl8SPejrCF2GdABXE+mO1WvM7iUYzRWlsxDs= +github.com/bombsimon/wsl/v5 v5.8.0/go.mod h1:AbOLsulgkqP4ZnitHf9gwPtCOGlrzkk0jb0uNxRSY0o= +github.com/breml/bidichk v0.3.3 h1:WSM67ztRusf1sMoqH6/c4OBCUlRVTKq+CbSeo0R17sE= +github.com/breml/bidichk v0.3.3/go.mod h1:ISbsut8OnjB367j5NseXEGGgO/th206dVa427kR8YTE= +github.com/breml/errchkjson v0.4.1 h1:keFSS8D7A2T0haP9kzZTi7o26r7kE3vymjZNeNDRDwg= +github.com/breml/errchkjson v0.4.1/go.mod h1:a23OvR6Qvcl7DG/Z4o0el6BRAjKnaReoPQFciAl9U3s= +github.com/butuzov/ireturn v0.4.1 h1:vWb3NO4t77iku/sjCQ/2pHTQeOmxEhjIriJqRLg1Y+I= +github.com/butuzov/ireturn v0.4.1/go.mod h1:q+DXKzTDV5guNuXLnIab9fKXizTn2miZHLhxH7V/GB4= +github.com/butuzov/mirror v1.3.0 h1:HdWCXzmwlQHdVhwvsfBb2Au0r3HyINry3bDWLYXiKoc= +github.com/butuzov/mirror v1.3.0/go.mod h1:AEij0Z8YMALaq4yQj9CPPVYOyJQyiexpQEQgihajRfI= +github.com/catenacyber/perfsprint v0.10.1 h1:u7Riei30bk46XsG8nknMhKLXG9BcXz3+3tl/WpKm0PQ= +github.com/catenacyber/perfsprint v0.10.1/go.mod h1:DJTGsi/Zufpuus6XPGJyKOTMELe347o6akPvWG9Zcsc= +github.com/ccojocar/zxcvbn-go v1.0.4 h1:FWnCIRMXPj43ukfX000kvBZvV6raSxakYr1nzyNrUcc= +github.com/ccojocar/zxcvbn-go v1.0.4/go.mod h1:3GxGX+rHmueTUMvm5ium7irpyjmm7ikxYFOSJB21Das= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= -github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= -github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= -github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= +github.com/charithe/durationcheck v0.0.11 h1:g1/EX1eIiKS57NTWsYtHDZ/APfeXKhye1DidBcABctk= +github.com/charithe/durationcheck v0.0.11/go.mod h1:x5iZaixRNl8ctbM+3B2RrPG5t856TxRyVQEnbIEM2X4= +github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q= +github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q= +github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318 h1:OqDqxQZliC7C8adA7KjelW3OjtAxREfeHkNcd66wpeI= +github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318/go.mod h1:Y6kE2GzHfkyQQVCSL9r2hwokSrIlHGzZG+71+wDYSZI= +github.com/charmbracelet/x/ansi v0.11.7 h1:kzv1kJvjg2S3r9KHo8hDdHFQLEqn4RBCb39dAYC84jI= +github.com/charmbracelet/x/ansi v0.11.7/go.mod h1:9qGpnAVYz+8ACONkZBUWPtL7lulP9No6p1epAihUZwQ= +github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= +github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= +github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY= +github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo= +github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM= +github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k= github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A= github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/ckaznocha/intrange v0.2.1 h1:M07spnNEQoALOJhwrImSrJLaxwuiQK+hA2DeajBlwYk= -github.com/ckaznocha/intrange v0.2.1/go.mod h1:7NEhVyf8fzZO5Ds7CRaqPEm52Ut83hsTiL5zbER/HYk= +github.com/ckaznocha/intrange v0.3.1 h1:j1onQyXvHUsPWujDH6WIjhyH26gkRt/txNlV7LspvJs= +github.com/ckaznocha/intrange v0.3.1/go.mod h1:QVepyz1AkUoFQkpEqksSYpNpUo3c5W7nWh/s6SHIJJk= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= +github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.13/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= -github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= +github.com/curioswitch/go-reassign v0.3.0 h1:dh3kpQHuADL3cobV/sSGETA8DOv457dwl+fbBAhrQPs= +github.com/curioswitch/go-reassign v0.3.0/go.mod h1:nApPCCTtqLJN/s8HfItCcKV0jIPwluBOvZP+dsJGA88= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= -github.com/daixiang0/gci v0.13.5/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= +github.com/daixiang0/gci v0.13.7 h1:+0bG5eK9vlI08J+J/NWGbWPTNiXPG4WhNLJOkSxWITQ= +github.com/daixiang0/gci v0.13.7/go.mod h1:812WVN6JLFY9S6Tv76twqmNqevN0pa3SX3nih0brVzQ= +github.com/dave/dst v0.27.3 h1:P1HPoMza3cMEquVf9kKy8yXsFirry4zEnWOdYPOoIzY= +github.com/dave/dst v0.27.3/go.mod h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc= +github.com/dave/jennifer v1.7.1 h1:B4jJJDHelWcDhlRQxWeo0Npa/pYKBLrirAQoTN45txo= +github.com/dave/jennifer v1.7.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -149,6 +187,8 @@ github.com/deepmap/oapi-codegen v1.9.0/go.mod h1:7t4DbSxmAffcTEgrWvsPYEE2aOARZ8Z github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8= github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8= +github.com/dlclark/regexp2 v1.12.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -157,12 +197,12 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= -github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= -github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA= -github.com/firefart/nonamedreturns v1.0.5/go.mod h1:gHJjDqhGM4WyPt639SOZs+G89Ko7QKH5R5BhnO6xJhw= +github.com/firefart/nonamedreturns v1.0.6 h1:vmiBcKV/3EqKY3ZiPxCINmpS431OcE1S47AQUwhrg8E= +github.com/firefart/nonamedreturns v1.0.6/go.mod h1:R8NisJnSIpvPWheCq0mNRXJok6D8h7fagJTF8EMEwCo= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= @@ -173,13 +213,13 @@ github.com/getkin/kin-openapi v0.80.0 h1:W/s5/DNnDCR8P+pYyafEWlGk4S7/AfQUWXgrRSS github.com/getkin/kin-openapi v0.80.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghostiam/protogetter v0.3.8 h1:LYcXbYvybUyTIxN2Mj9h6rHrDZBDwZloPoKctWrFyJY= -github.com/ghostiam/protogetter v0.3.8/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= +github.com/ghostiam/protogetter v0.3.20 h1:oW7OPFit2FxZOpmMRPP9FffU4uUpfeE/rEdE1f+MzD0= +github.com/ghostiam/protogetter v0.3.20/go.mod h1:FjIu5Yfs6FT391m+Fjp3fbAYJ6rkL/J6ySpZBfnODuI= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-critic/go-critic v0.11.4 h1:O7kGOCx0NDIni4czrkRIXTnit0mkyKOCePh3My6OyEU= -github.com/go-critic/go-critic v0.11.4/go.mod h1:2QAdo4iuLik5S9YG0rT4wcZ8QxwHYkrr6/2MWAiv/vc= +github.com/go-critic/go-critic v0.14.3 h1:5R1qH2iFeo4I/RJU8vTezdqs08Egi4u5p6vOESA0pog= +github.com/go-critic/go-critic v0.14.3/go.mod h1:xwntfW6SYAd7h1OqDzmN6hBX/JxsEKl5up/Y2bsxgVQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -189,8 +229,8 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -227,16 +267,18 @@ github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQi github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= -github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= -github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= -github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-xmlfmt/xmlfmt v1.1.3 h1:t8Ey3Uy7jDSEisW2K3somuMKIpzktkWptA0iFCnRUWY= +github.com/go-xmlfmt/xmlfmt v1.1.3/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= -github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= +github.com/godoc-lint/godoc-lint v0.11.2 h1:Bp0FkJWoSdNsBikdNgIcgtaoo+xz6I/Y9s5WSBQUeeM= +github.com/godoc-lint/godoc-lint v0.11.2/go.mod h1:iVpGdL1JCikNH2gGeAn3Hh+AgN5Gx/I/cxV+91L41jo= +github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= +github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -273,25 +315,33 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= -github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= -github.com/golangci/golangci-lint v1.61.1-0.20240915150923-7187c89d4091 h1:QOO0qQ6PJxmQgr1J4WfUrMvwXclzhXsKTaLjRflOU7U= -github.com/golangci/golangci-lint v1.61.1-0.20240915150923-7187c89d4091/go.mod h1:PRvTpn+9dXYfWhsJX3OQ+RzzXBkzJjqkux72cKQECGs= +github.com/golangci/asciicheck v0.5.0 h1:jczN/BorERZwK8oiFBOGvlGPknhvq0bjnysTj4nUfo0= +github.com/golangci/asciicheck v0.5.0/go.mod h1:5RMNAInbNFw2krqN6ibBxN/zfRFa9S6tA1nPdM0l8qQ= +github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 h1:CbTB8KpqnViI6lIXxp03Oclc4VFHi3K4BWC1TacsZ+A= +github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202/go.mod h1:NUw9Zr2Sy7+HxzdjIULge71wI6yEg1lWQr7Evcu8K0E= +github.com/golangci/go-printf-func-name v0.1.1 h1:hIYTFJqAGp1iwoIfsNTpoq1xZAarogrvjO9AfiW3B4U= +github.com/golangci/go-printf-func-name v0.1.1/go.mod h1:Es64MpWEZbh0UBtTAICOZiB+miW53w/K9Or/4QogJss= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= +github.com/golangci/golangci-lint/v2 v2.12.2 h1:7+d1uY0bq1MU2UV3R5pW5Q7QWdcoq4naMRXM+gsJKrs= +github.com/golangci/golangci-lint/v2 v2.12.2/go.mod h1:opqHHuIcTG2R+4akzWMd4o1BnD9/1LcjICWOujr91U8= +github.com/golangci/golines v0.15.0 h1:Qnph25g8Y1c5fdo1X7GaRDGgnMHgnxh4Gk4VfPTtRx0= +github.com/golangci/golines v0.15.0/go.mod h1:AZjXd23tbHMpowhtnGlj9KCNsysj72aeZVVHnVcZx10= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= -github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= -github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= -github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= -github.com/golangci/modinfo v0.3.4/go.mod h1:wytF1M5xl9u0ij8YSvhkEVPP3M5Mc7XLl1pxH3B2aUM= -github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c= -github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc= -github.com/golangci/revgrep v0.5.3 h1:3tL7c1XBMtWHHqVpS5ChmiAAoe4PF/d5+ULzV9sLAzs= -github.com/golangci/revgrep v0.5.3/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= -github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed h1:IURFTjxeTfNFP0hTEi1YKjB/ub8zkpaOqFFMApi2EAs= -github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed/go.mod h1:XLXN8bNw4CGRPaqgl3bv/lhz7bsGPh4/xSaMTbo2vkQ= +github.com/golangci/misspell v0.8.0 h1:qvxQhiE2/5z+BVRo1kwYA8yGz+lOlu5Jfvtx2b04Jbg= +github.com/golangci/misspell v0.8.0/go.mod h1:WZyyI2P3hxPY2UVHs3cS8YcllAeyfquQcKfdeE9AFVg= +github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg= +github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw= +github.com/golangci/revgrep v0.8.0 h1:EZBctwbVd0aMeRnNUsFogoyayvKHyxlV3CdUA46FX2s= +github.com/golangci/revgrep v0.8.0/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= +github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba h1:lqtcnSMDuuJdu/LrKWi5RJzpSNLOJXYe/nzQutTI5kg= +github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba/go.mod h1:sCBNcpRmhJCtbFGz49+IM3ETTFf7QdJ30AeYCd43NKk= +github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e h1:ai0EfmVYE2bRA5htgAG9r7s3tHsfjIhN98WshBTJ9jM= +github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e/go.mod h1:Vrn4B5oR9qRwM+f54koyeH3yzphlecwERs0el27Fr/s= +github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e h1:gD6P7NEo7Eqtt0ssnqSJNNndxe69DOQ24A5h7+i3KpM= +github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e/go.mod h1:h+wZwLjUTJnm/P2rwlbJdRPZXOzaT36/FwnPnY2inzc= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -304,7 +354,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= @@ -318,8 +367,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU= github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk= @@ -328,30 +377,36 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s= -github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.2.0 h1:Uths4KnmwxNJNzq87fwQQDDnbNb7De00VOk9Nu0TySs= +github.com/gordonklaus/ineffassign v0.2.0/go.mod h1:TIpymnagPSexySzs7F9FnO1XFTy8IT3a59vmZp5Y9Lw= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= -github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= -github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= -github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= -github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= -github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= -github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= +github.com/gostaticanalysis/comment v1.5.0 h1:X82FLl+TswsUMpMh17srGRuKaaXprTaytmEpgnKIDu8= +github.com/gostaticanalysis/comment v1.5.0/go.mod h1:V6eb3gpCv9GNVqb6amXzEUX3jXLVK/AdA+IrAMSqvEc= +github.com/gostaticanalysis/forcetypeassert v0.2.0 h1:uSnWrrUEYDr86OCxWa4/Tp2jeYDlogZiZHzGkWFefTk= +github.com/gostaticanalysis/forcetypeassert v0.2.0/go.mod h1:M5iPavzE9pPqWyeiVXSFghQjljW1+l/Uke3PXHS6ILY= +github.com/gostaticanalysis/nilerr v0.1.2 h1:S6nk8a9N8g062nsx63kUkF6AzbHGw7zzyHMcpu52xQU= +github.com/gostaticanalysis/nilerr v0.1.2/go.mod h1:A19UHhoY3y8ahoL7YKz6sdjDtduwTSI4CsymaC2htPA= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= -github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= -github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= +github.com/gostaticanalysis/testutil v0.5.0 h1:Dq4wT1DdTwTGCQQv3rl3IvD5Ld0E6HiY+3Zh0sUGqw8= +github.com/gostaticanalysis/testutil v0.5.0/go.mod h1:OLQSbuM6zw2EvCcXTz1lVq5unyoNft372msDY0nY5Hs= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 h1:Ghn7copILfeIg0y8sTGRppI1bd8I4l2VN3cob0Xeqwg= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0/go.mod h1:dnjr4snxnhRSn5GWqJUva2AoMbeaxyAcepvc0Tg8lXk= +github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo= +github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= @@ -361,16 +416,12 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jgautheron/goconst v1.7.1 h1:VpdAG7Ca7yvvJk5n8dMwQhfEZJh95kl/Hl9S1OI5Jkk= -github.com/jgautheron/goconst v1.7.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= -github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= -github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= +github.com/jgautheron/goconst v1.10.0 h1:Ptt+OoE4NaEWKhLrWrrN3IpZdGLiqaf7WLnEX/iv4Jw= +github.com/jgautheron/goconst v1.10.0/go.mod h1:0p+wv1lFOiUr0IlNNT1nrm6+8DB8u2sU6KHGzFRXHDc= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= -github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= +github.com/jjti/go-spancheck v0.6.5 h1:lmi7pKxa37oKYIMScialXUK6hP3iY5F1gu+mLBPgYB8= +github.com/jjti/go-spancheck v0.6.5/go.mod h1:aEogkeatBrbYsyW6y5TgDfihCulDYciL1B7rG2vSsrU= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -383,16 +434,16 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= -github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= -github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= +github.com/julz/importas v0.2.0 h1:y+MJN/UdL63QbFJHws9BVC5RpA2iq0kpjrFajTGivjQ= +github.com/julz/importas v0.2.0/go.mod h1:pThlt589EnCYtMnmhmRYY/qn9lCf/frPOK+WMx3xiJY= +github.com/karamaru-alpha/copyloopvar v1.2.2 h1:yfNQvP9YaGQR7VaWLYcfZUlRP2eo2vhExWKxD/fP6q0= +github.com/karamaru-alpha/copyloopvar v1.2.2/go.mod h1:oY4rGZqZ879JkJMtX3RRkcXRkmUvH0x35ykgaKgsgJY= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= -github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= +github.com/kisielk/errcheck v1.10.0 h1:Lvs/YAHP24YKg08LA8oDw2z9fJVme090RAXd90S+rrw= +github.com/kisielk/errcheck v1.10.0/go.mod h1:kQxWMMVZgIkDq7U8xtG/n2juOjbLgZtedi0D+/VL/i8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LXxiilg= -github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA= +github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/ttjfJCE= +github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -405,24 +456,30 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= -github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= -github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= -github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= -github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= +github.com/kulti/thelper v0.7.1 h1:fI8QITAoFVLx+y+vSyuLBP+rcVIB8jKooNSCT2EiI98= +github.com/kulti/thelper v0.7.1/go.mod h1:NsMjfQEy6sd+9Kfw8kCP61W1I0nerGSYSFnGaxQkcbs= +github.com/kunwardeep/paralleltest v1.0.15 h1:ZMk4Qt306tHIgKISHWFJAO1IDQJLc6uDyJMLyncOb6w= +github.com/kunwardeep/paralleltest v1.0.15/go.mod h1:di4moFqtfz3ToSKxhNjhOZL+696QtJGCFe132CbBLGk= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= -github.com/lasiar/canonicalheader v1.1.1 h1:wC+dY9ZfiqiPwAexUApFush/csSPXeIi4QqyxXmng8I= -github.com/lasiar/canonicalheader v1.1.1/go.mod h1:cXkb3Dlk6XXy+8MVQnF23CYKWlyA7kfQhSw2CcZtZb0= -github.com/ldez/gomoddirectives v0.2.4 h1:j3YjBIjEBbqZ0NKtBNzr8rtMHTOrLPeiwTkfUJZ3alg= -github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWWDO+SO0qSQw5g= -github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= -github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= +github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= +github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= +github.com/ldez/exptostd v0.4.5 h1:kv2ZGUVI6VwRfp/+bcQ6Nbx0ghFWcGIKInkG/oFn1aQ= +github.com/ldez/exptostd v0.4.5/go.mod h1:QRjHRMXJrCTIm9WxVNH6VW7oN7KrGSht69bIRwvdFsM= +github.com/ldez/gomoddirectives v0.8.0 h1:JqIuTtgvFC2RdH1s357vrE23WJF2cpDCPFgA/TWDGpk= +github.com/ldez/gomoddirectives v0.8.0/go.mod h1:jutzamvZR4XYJLr0d5Honycp4Gy6GEg2mS9+2YX3F1Q= +github.com/ldez/grignotin v0.10.1 h1:keYi9rYsgbvqAZGI1liek5c+jv9UUjbvdj3Tbn5fn4o= +github.com/ldez/grignotin v0.10.1/go.mod h1:UlDbXFCARrXbWGNGP3S5vsysNXAPhnSuBufpTEbwOas= +github.com/ldez/structtags v0.6.1 h1:bUooFLbXx41tW8SvkfwfFkkjPYvFFs59AAMgVg6DUBk= +github.com/ldez/structtags v0.6.1/go.mod h1:YDxVSgDy/MON6ariaxLF2X09bh19qL7MtGBN5MrvbdY= +github.com/ldez/tagliatelle v0.7.2 h1:KuOlL70/fu9paxuxbeqlicJnCspCRjH0x8FW+NfgYUk= +github.com/ldez/tagliatelle v0.7.2/go.mod h1:PtGgm163ZplJfZMZ2sf5nhUT170rSuPgBimoyYtdaSI= +github.com/ldez/usetesting v0.5.0 h1:3/QtzZObBKLy1F4F8jLuKJiKBjjVFi1IavpoWbmqLwc= +github.com/ldez/usetesting v0.5.0/go.mod h1:Spnb4Qppf8JTuRgblLrEWb7IE6rDmUpGvxY3iRrzvDQ= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= @@ -434,20 +491,25 @@ github.com/lestrrat-go/httpcc v1.0.0/go.mod h1:tGS/u00Vh5N6FHNkExqGGNId8e0Big+++ github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= github.com/lestrrat-go/jwx v1.2.7/go.mod h1:bw24IXWbavc0R2RsOtpXL7RtMyP589yZ1+L7kd09ZGA= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= -github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= -github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= +github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4= +github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/macabu/inamedparam v0.2.0 h1:VyPYpOc10nkhI2qeNUdh3Zket4fcZjEWe35poddBCpE= +github.com/macabu/inamedparam v0.2.0/go.mod h1:+Pee9/YfGe5LJ62pYXqB89lJ+0k5bsR8Wgz/C0Zlq3U= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= -github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= -github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= -github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= -github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= -github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/manuelarte/embeddedstructfieldcheck v0.4.0 h1:3mAIyaGRtjK6EO9E73JlXLtiy7ha80b2ZVGyacxgfww= +github.com/manuelarte/embeddedstructfieldcheck v0.4.0/go.mod h1:z8dFSyXqp+fC6NLDSljRJeNQJJDWnY7RoWFzV3PC6UM= +github.com/manuelarte/funcorder v0.6.0 h1:0hBngc4fa1IgNiI65A7sFGkMvoMCc878RjqB5V7rWP0= +github.com/manuelarte/funcorder v0.6.0/go.mod h1:id3NDhXdQBmeqXH7eVC6Z89xS6JxvZ8kF9xUxpArU/g= +github.com/maratori/testableexamples v1.0.1 h1:HfOQXs+XgfeRBJ+Wz0XfH+FHnoY9TVqL6Fcevpzy4q8= +github.com/maratori/testableexamples v1.0.1/go.mod h1:XE2F/nQs7B9N08JgyRmdGjYVGqxWwClLPCGSQhXQSrQ= +github.com/maratori/testpackage v1.1.2 h1:ffDSh+AgqluCLMXhM19f/cpvQAKygKAJXFl9aUjmbqs= +github.com/maratori/testpackage v1.1.2/go.mod h1:8F24GdVDFW5Ew43Et02jamrVMNXLUNaOynhDssITGfc= +github.com/matoous/godox v1.1.0 h1:W5mqwbyWrwZv6OQ5Z1a/DHGMOvXYCBP3+Ht7KMoJhq4= +github.com/matoous/godox v1.1.0/go.mod h1:jgE/3fUXiTurkdHOLT5WEkThTSuE7yxHv5iWPa80afs= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= @@ -466,15 +528,14 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= +github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mattn/goveralls v0.0.8 h1:4xflElRkVgj/FcBVKTAkqSWhHFY2u2uv4c054kG2RY8= github.com/mattn/goveralls v0.0.8/go.mod h1:h8b4ow6FxSPMQHF6o2ve3qsclnffZjYTNEKmLesRwqw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= -github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= +github.com/mgechev/revive v1.15.0 h1:vJ0HzSBzfNyPbHKolgiFjHxLek9KUijhqh42yGoqZ8Q= +github.com/mgechev/revive v1.15.0/go.mod h1:LlAKO3QQe9OJ0pVZzI2GPa8CbXGZ/9lNpCGvK4T/a8A= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -486,6 +547,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= @@ -495,14 +558,12 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.16.2 h1:8iLqHIZvN4fTLDC0Ke9tbSZVcyVHoBs0HIbnVSxfHJk= -github.com/nunnatsa/ginkgolinter v0.16.2/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= -github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= +github.com/nunnatsa/ginkgolinter v0.23.0 h1:x3o4DGYOWbBMP/VdNQKgSj+25aJKx2Pe6lHr8gBcgf8= +github.com/nunnatsa/ginkgolinter v0.23.0/go.mod h1:9qN1+0akwXEccwV1CAcCDfcoBlWXHB+ML9884pL4SZ4= +github.com/onsi/ginkgo/v2 v2.28.2 h1:DTrMfpqxiNUyQ3Y0zhn1n3cOO2euFgQPYIpkWwxVFps= +github.com/onsi/ginkgo/v2 v2.28.2/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= +github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -510,8 +571,8 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc= +github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg= @@ -523,15 +584,10 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgc github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= -github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= -github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= -github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -554,87 +610,82 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 h1:+Wl/0aFp0hpuHM3H//KMft64WQ1yX9LdJY64Qm/gFCo= -github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= -github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= -github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard v0.4.5 h1:AGY0tiOT5hJX9BTdx/xBdoCubQUAE2grkqY2lSwvZcA= +github.com/quasilyte/go-ruleguard v0.4.5/go.mod h1:Vl05zJ538vcEEwu16V/Hdu7IYZWyKSwIy4c88Ro1kRE= +github.com/quasilyte/go-ruleguard/dsl v0.3.23 h1:lxjt5B6ZCiBeeNO8/oQsegE6fLeCzuMRoVWSkXC4uvY= +github.com/quasilyte/go-ruleguard/dsl v0.3.23/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= -github.com/raeperd/recvcheck v0.1.2 h1:SjdquRsRXJc26eSonWIo8b7IMtKD3OAT2Lb5G3ZX1+4= -github.com/raeperd/recvcheck v0.1.2/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/raeperd/recvcheck v0.2.0 h1:GnU+NsbiCqdC2XX5+vMZzP+jAJC5fht7rcVTAhX74UI= +github.com/raeperd/recvcheck v0.2.0/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.3.5 h1:cShyguSwUEeC0jS7ylOiG/idnd1TpJ1LfHGpV3oJmPU= -github.com/ryancurrah/gomodguard v1.3.5/go.mod h1:MXlEPQRxgfPQa62O8wzK3Ozbkv9Rkqr+wKjSxTdsNJE= -github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= -github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= +github.com/ryancurrah/gomodguard v1.4.1 h1:eWC8eUMNZ/wM/PWuZBv7JxxqT5fiIKSIyTvjb7Elr+g= +github.com/ryancurrah/gomodguard v1.4.1/go.mod h1:qnMJwV1hX9m+YJseXEBhd2s90+1Xn6x9dLz11ualI1I= +github.com/ryancurrah/gomodguard/v2 v2.1.3 h1:E7sz3PJwE9Ba1reVxSpF6XLCPJZ74Kfw/LabTNM4GIA= +github.com/ryancurrah/gomodguard/v2 v2.1.3/go.mod h1:CQicdLGatWMxLX53JzoBjYlsNZhHbmLv2AVa0s2aivU= +github.com/ryanrolds/sqlclosecheck v0.6.0 h1:pEyL9okISdg1F1SEpJNlrEotkTGerv5BMk7U4AG0eVg= +github.com/ryanrolds/sqlclosecheck v0.6.0/go.mod h1:xyX16hsDaCMXHrMJ3JMzGf5OpDfHTOTTQrT7HOFUmeU= github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= -github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= -github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= +github.com/sanposhiho/wastedassign/v2 v2.1.0 h1:crurBF7fJKIORrV85u9UUpePDYGWnwvv3+A96WvwXT0= +github.com/sanposhiho/wastedassign/v2 v2.1.0/go.mod h1:+oSmSC+9bQ+VUAxA66nBb0Z7N8CK7mscKTDYC6aIek4= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= -github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= -github.com/securego/gosec/v2 v2.21.2 h1:deZp5zmYf3TWwU7A7cR2+SolbTpZ3HQiwFqnzQyEl3M= -github.com/securego/gosec/v2 v2.21.2/go.mod h1:au33kg78rNseF5PwPnTWhuYBFf534bvJRvOrgZ/bFzU= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sashamelentyev/usestdlibvars v1.29.0 h1:8J0MoRrw4/NAXtjQqTHrbW9NN+3iMf7Knkq057v4XOQ= +github.com/sashamelentyev/usestdlibvars v1.29.0/go.mod h1:8PpnjHMk5VdeWlVb4wCdrB8PNbLqZ3wBZTZWkrpZZL8= +github.com/securego/gosec/v2 v2.26.1 h1:gdkttGhQFVehqRJ8grKH4DrpqM/QlPKNHBnl8QgcEC4= +github.com/securego/gosec/v2 v2.26.1/go.mod h1:57UW4p0uoP3kxoTkhoo3axLdVAi+OWrLg/Ax/kdqtPE= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= +github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= -github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= -github.com/sonatard/noctx v0.1.0 h1:JjqOc2WN16ISWAjAk8M5ej0RfExEXtkEyExl2hLW+OM= -github.com/sonatard/noctx v0.1.0/go.mod h1:0RvBxqY8D4j9cTTTWE8ylt2vqj2EPI8fHmrxHdsaZ2c= +github.com/sonatard/noctx v0.5.1 h1:wklWg9c9ZYugOAk7qG4yP4PBrlQsmSLPTvW1K4PRQMs= +github.com/sonatard/noctx v0.5.1/go.mod h1:64XdbzFb18XL4LporKXp8poqZtPKbCrqQ402CV+kJas= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= -github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= -github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= +github.com/sourcegraph/go-diff v0.8.0 h1:ipIyu4cTsLbIrln4l0qtHA3r0a7gyK4ntKjtQytHhvY= +github.com/sourcegraph/go-diff v0.8.0/go.mod h1:hWlcO7Al+UZStZAP8rBumHpCK5ZHQ5BXsMls8p4+F5E= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY= github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= -github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= -github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +github.com/stbenjam/no-sprintf-host-port v0.3.1 h1:AyX7+dxI4IdLBPtDbsGAyqiTSLpCP9hWRrXQDU4Cm/g= +github.com/stbenjam/no-sprintf-host-port v0.3.1/go.mod h1:ODbZesTCHMVKthBHskvUUexdcNHAQRXk9NpSsL8p/HQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -644,40 +695,38 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -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= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= -github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.18 h1:ouX3XGiziKDypbpXqShBfnNLTSjR8r3/HVzrtJ+bHlI= -github.com/tetafro/godot v1.4.18/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= -github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= -github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= -github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= -github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= +github.com/tetafro/godot v1.5.6 h1:IEkrFCwXaYHlOn4mGzGS3F3dkP6m9t0jpwqBFPIkKiA= +github.com/tetafro/godot v1.5.6/go.mod h1:eOkMrVQurDui411nBY2FA05EYH01r14LuWY/NrVDVcU= +github.com/timakin/bodyclose v0.0.0-20260129054331-73d1f95b84b4 h1:SiHe5XLTn9sFWJ5pBwJ5FN/4j34q9ZlOAD//kMoMYp0= +github.com/timakin/bodyclose v0.0.0-20260129054331-73d1f95b84b4/go.mod h1:sDHLK7rb/59v/ZxZ7KtymgcoxuUMxjXq8gtu9VMOK8M= +github.com/timonwong/loggercheck v0.11.0 h1:jdaMpYBl+Uq9mWPXv1r8jc5fC3gyXx4/WGwTnnNKn4M= +github.com/timonwong/loggercheck v0.11.0/go.mod h1:HEAWU8djynujaAVX7QI65Myb8qgfcZ1uKbdpg3ZzKl8= github.com/tinylib/msgp v1.5.0 h1:GWnqAE54wmnlFazjq2+vgr736Akg58iiHImh+kPY2pc= github.com/tinylib/msgp v1.5.0/go.mod h1:cvjFkb4RiC8qSBOPMGPSzSAx47nAsfhLVTCZZNuHv5o= -github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4= -github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= +github.com/tomarrell/wrapcheck/v2 v2.12.0 h1:H/qQ1aNWz/eeIhxKAFvkfIA+N7YDvq6TWVFL27Of9is= +github.com/tomarrell/wrapcheck/v2 v2.12.0/go.mod h1:AQhQuZd0p7b6rfW+vUwHm5OMCGgp63moQ9Qr/0BpIWo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= -github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= -github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= -github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= -github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= -github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= -github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= +github.com/ultraware/funlen v0.2.0 h1:gCHmCn+d2/1SemTdYMiKLAHFYxTYz7z9VIDRaTGyLkI= +github.com/ultraware/funlen v0.2.0/go.mod h1:ZE0q4TsJ8T1SQcjmkhN/w+MceuatI6pBFSxxyteHIJA= +github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSWoFa+g= +github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= +github.com/uudashr/gocognit v1.2.1 h1:CSJynt5txTnORn/DkhiB4mZjwPuifyASC8/6Q0I/QS4= +github.com/uudashr/gocognit v1.2.1/go.mod h1:acaubQc6xYlXFEMb9nWX2dYBzJ/bIjEkc1zzvyIZg5Q= +github.com/uudashr/iface v1.4.2 h1:06Vq5RKVYThBsj0Bnw4oasMjD1r+7CE/bcKOA8dVSvg= +github.com/uudashr/iface v1.4.2/go.mod h1:pbeBPlbuU2qkNDn0mmfrxP2X+wjPMIQAy+r1MBXSXtg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -685,8 +734,10 @@ github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52 github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vektra/mockery/v2 v2.53.4 h1:abBWJLUQppM7T/VsLasBwgl7XXQRWH6lC3bnbJpOCLk= github.com/vektra/mockery/v2 v2.53.4/go.mod h1:hIFFb3CvzPdDJJiU7J4zLRblUMv7OuezWsHPmswriwo= -github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= -github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= +github.com/xen0n/gosmopolitan v1.3.0 h1:zAZI1zefvo7gcpbCOrPSHJZJYA9ZgLfJqtKzZ5pHqQM= +github.com/xen0n/gosmopolitan v1.3.0/go.mod h1:rckfr5T6o4lBtM1ga7mLGKZmLxswUoH1zxHgNXOsEt4= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.3.0 h1:JVDbMp08lVCP7Y6NP3qHroGAO6z2yGKQtS5JsjqtoFs= @@ -697,7 +748,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zhouqiang-cl/gocovmerge v0.0.0-20190125174600-5256314471af h1:TscntfU6Necy6hfH+hcow8QSg8DJq47Fe/rqpZZS9U4= @@ -706,25 +756,27 @@ gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo= gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8= go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= -go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= -go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= -go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= -go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= +go-simpler.org/musttag v0.14.0 h1:XGySZATqQYSEV3/YTy+iX+aofbZZllJaqwFWs+RTtSo= +go-simpler.org/musttag v0.14.0/go.mod h1:uP8EymctQjJ4Z1kUnjX0u2l60WfUdQxCwSNKzE1JEOE= +go-simpler.org/sloglint v0.12.0 h1:UzWDlLWNE5FLqsvyq3tWYHuQMbqrervOhT8qPl4Mmw4= +go-simpler.org/sloglint v0.12.0/go.mod h1:jBjjC2bm8rYrs88oTRlFX497kWjJsyZWYoNaXkGRI6I= +go.augendre.info/arangolint v0.4.0 h1:xSCZjRoS93nXazBSg5d0OGCi9APPLNMmmLrC995tR50= +go.augendre.info/arangolint v0.4.0/go.mod h1:l+f/b4plABuFISuKnTGD4RioXiCCgghv2xqst/xOvAA= +go.augendre.info/fatcontext v0.9.0 h1:Gt5jGD4Zcj8CDMVzjOJITlSb9cEch54hjRRlN3qDojE= +go.augendre.info/fatcontext v0.9.0/go.mod h1:L94brOAT1OOUNue6ph/2HnwxoNlds9aXDF2FcUntbNw= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= -go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -735,9 +787,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201217014255-9d1352758620/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -748,12 +799,12 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= -golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20260209203927-2842357ff358 h1:qWFG1Dj7TBjOjOvhEOkmyGPVoquqUKnIU0lEVLp8xyk= +golang.org/x/exp/typeparams v0.0.0-20260209203927-2842357ff358/go.mod h1:4Mzdyp/6jzw9auFDJ3OMF5qksa7UvPnzKqTVGcb04ms= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -775,15 +826,12 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= -golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -814,16 +862,12 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -843,8 +887,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -883,11 +927,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -899,27 +940,22 @@ golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa h1:efT73AJZfAAUV7SOip6pWGkwJDzIGiKBZGVzHYa+ve4= +golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa/go.mod h1:kHjTxDEnAu6/Nl9lDkzjWpR+bmKfxeiRuSDlsMb70gE= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= -golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= +golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= +golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -927,11 +963,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -943,7 +977,6 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -952,10 +985,8 @@ golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -973,7 +1004,6 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -985,27 +1015,18 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= -golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= +golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= @@ -1066,12 +1087,12 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc= +google.golang.org/genproto v0.0.0-20220719170305-83ca9fad585f h1:P8EiVSxZwC6xH2niv2N66aqwMtYFg+D54gbjpcqKJtM= +google.golang.org/genproto v0.0.0-20220719170305-83ca9fad585f/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1085,8 +1106,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= -google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1102,8 +1123,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= -google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1137,16 +1158,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= -honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= +honnef.co/go/tools v0.7.0 h1:w6WUp1VbkqPEgLz4rkBzH/CSU6HkoqNLp6GstyTx3lU= +honnef.co/go/tools v0.7.0/go.mod h1:pm29oPxeP3P82ISxZDgIYeOaf9ta6Pi0EWvCFoLG2vc= mvdan.cc/editorconfig v0.2.0 h1:XL+7ys6ls/RKrkUNFQvEwIvNHh+JKx8Mj1pUV5wQxQE= mvdan.cc/editorconfig v0.2.0/go.mod h1:lvnnD3BNdBYkhq+B4uBuFFKatfp02eB6HixDvEz91C0= -mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= -mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= +mvdan.cc/gofumpt v0.9.2 h1:zsEMWL8SVKGHNztrx6uZrXdp7AX8r421Vvp23sz7ik4= +mvdan.cc/gofumpt v0.9.2/go.mod h1:iB7Hn+ai8lPvofHd9ZFGVg2GOr8sBUw1QUWjNbmIL/s= mvdan.cc/sh/v3 v3.3.1 h1:aA0i7NZOc1oV5jfAH20FCz+QsmI/TX7FiAquC5Rdo5o= mvdan.cc/sh/v3 v3.3.1/go.mod h1:DpbFT2B4fXpKiq69fEoMe+71JrmUn5aUekYy9fNKnQw= -mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= -mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= +mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15 h1:ssMzja7PDPJV8FStj7hq9IKiuiKhgz9ErWw+m68e7DI= +mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15/go.mod h1:4M5MMXl2kW6fivUT6yRGpLLPNfuGtU2Z0cPvFquGDYU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/tools/check/tools.go b/tools/check/tools.go index dc93ef4b8f..489b52ca55 100644 --- a/tools/check/tools.go +++ b/tools/check/tools.go @@ -27,7 +27,7 @@ import ( _ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen" _ "github.com/gogo/protobuf/protoc-gen-gogofaster" _ "github.com/golang/mock/mockgen" - _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" From d542479919d6517230c633bb52ae7af0df5b79d6 Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Mon, 11 May 2026 22:30:27 +0800 Subject: [PATCH 2/5] fix all lint issue --- cmd/kafka-consumer/consumer.go | 6 +++- cmd/kafka-consumer/writer.go | 6 ++-- cmd/oauth2-server/main.go | 2 +- cmd/pulsar-consumer/consumer.go | 2 +- cmd/storage-consumer/main.go | 3 +- coordinator/changefeed/backoff_test.go | 1 - coordinator/changefeed/etcd_backend_test.go | 2 +- coordinator/controller.go | 10 ++---- coordinator/coordinator_test.go | 5 +-- .../dispatcher/basic_dispatcher.go | 8 ++--- .../dispatcher/event_dispatcher.go | 6 ++-- .../dispatchermanager/dispatcher_manager.go | 2 +- .../dispatcher_manager_helper.go | 2 +- .../eventcollector/dispatcher_stat_test.go | 3 -- .../eventcollector/event_collector.go | 3 +- .../routing/ddl_query_rewriter_test.go | 1 - .../routing/router_apply_test.go | 3 -- .../routing/router_supported_ddl_test.go | 1 - downstreamadapter/sink/redo/meta.go | 8 ++--- downstreamadapter/sink/redo/sink.go | 4 +-- logservice/eventstore/event_store.go | 11 ++---- logservice/logpuller/region_request_worker.go | 3 +- logservice/logpuller/subscription_client.go | 4 ++- logservice/schemastore/disk_format.go | 5 +-- logservice/schemastore/multi_version_test.go | 4 ++- .../schemastore/persist_storage_test.go | 4 ++- logservice/schemastore/schema_store_test.go | 4 +-- maintainer/barrier.go | 4 +-- maintainer/operator/operator_merge.go | 4 +-- maintainer/operator/operator_split.go | 4 +-- .../range_checker/table_span_range_checker.go | 2 +- maintainer/replica/split_span_checker.go | 19 ++++++----- maintainer/scheduler/balance_splits.go | 7 ++-- maintainer/scheduler/drain_test.go | 1 - pkg/applier/redo.go | 7 ++-- pkg/binlog-filter/filter_test.go | 2 +- pkg/common/format.go | 34 +++++++++---------- pkg/common/format_test.go | 6 ---- pkg/common/helper_test.go | 2 -- pkg/common/span_op.go | 4 +-- pkg/common/table_info.go | 2 +- pkg/common/table_info_helper.go | 10 +++--- .../table_info_shared_schema_guard_test.go | 1 - pkg/common/table_info_test.go | 1 - pkg/common/table_name_test.go | 1 - pkg/config/sink.go | 2 +- pkg/diff/checkpoint.go | 5 +-- pkg/diff/diff.go | 4 +-- pkg/diff/util.go | 6 ++-- pkg/errors/helper.go | 10 +++--- pkg/errors/utils.go | 29 +++++++--------- pkg/etcd/client.go | 12 ++++--- pkg/etcd/etcd.go | 6 +++- pkg/eventservice/event_broker.go | 9 +++-- pkg/eventservice/event_service_test.go | 6 ++-- pkg/eventservice/scan_window.go | 2 +- pkg/logger/log.go | 5 +-- pkg/messaging/message.go | 8 ++--- pkg/messaging/message_center.go | 3 +- pkg/messaging/remote_target.go | 10 ++---- pkg/notify/notify_test.go | 1 - pkg/orchestrator/batch_test.go | 2 +- pkg/orchestrator/etcd_worker_test.go | 5 +-- pkg/pdutil/api_client.go | 9 ++--- pkg/pdutil/api_client_test.go | 7 ++-- pkg/redo/reader/file.go | 7 ++-- pkg/redo/reader/reader.go | 4 +-- pkg/redo/reader/reader_test.go | 5 +-- pkg/retry/retry_test.go | 5 +-- pkg/scheduler/replica/replication.go | 2 +- pkg/security/sasl_test.go | 2 -- pkg/security/scram_client.go | 4 +-- pkg/sink/codec/common/config.go | 8 ++--- pkg/sink/codec/common/helper.go | 7 ++-- pkg/sink/codec/csv/csv_decoder.go | 2 +- pkg/sink/codec/csv/csv_message.go | 2 +- pkg/sink/codec/csv/csv_message_test.go | 7 ++-- pkg/sink/kafka/options_test.go | 4 ++- pkg/sink/kafka/sarama_config_test.go | 2 -- pkg/sink/mysql/helper.go | 13 ++++--- pkg/sink/mysql/mysql_writer.go | 3 +- pkg/sink/mysql/mysql_writer_ddl.go | 2 +- pkg/sink/mysql/mysql_writer_dml_exec.go | 3 +- pkg/sink/mysql/mysql_writer_dml_test.go | 1 - ...sql_writer_for_active_active_sync_stats.go | 4 ++- pkg/sink/mysql/mysql_writer_for_syncpoint.go | 2 +- pkg/sink/mysql/mysql_writer_test.go | 2 +- pkg/sink/mysql/sql_builder.go | 16 ++++----- pkg/tcpserver/tcp_server.go | 3 +- pkg/upstream/upstream.go | 8 ++--- pkg/version/check_test.go | 2 +- pkg/workerpool/async_pool_test.go | 3 +- server/module_election.go | 6 ++-- server/server.go | 2 +- tests/integration_tests/api_v2/cases.go | 2 +- tests/integration_tests/bank/case.go | 3 +- tests/integration_tests/cdc/cdc.go | 7 ++-- tests/integration_tests/cdc/dailytest/case.go | 4 +-- .../integration_tests/cdc/dailytest/parser.go | 7 ++-- .../complex_transaction/workload.go | 7 ++-- tests/integration_tests/default_value/main.go | 9 ++--- tests/integration_tests/many_pk_or_uk/main.go | 9 ++--- tests/integration_tests/multi_source/main.go | 23 +++++++------ tests/integration_tests/resolve_lock/main.go | 7 ++-- tests/integration_tests/util/config.go | 4 +-- tests/integration_tests/util/db.go | 3 +- utils/chann/unlimited_chann.go | 6 ++-- utils/threadpool/thread_pool_test.go | 2 +- 108 files changed, 292 insertions(+), 297 deletions(-) diff --git a/cmd/kafka-consumer/consumer.go b/cmd/kafka-consumer/consumer.go index 4e78582f9e..f88a67bae4 100644 --- a/cmd/kafka-consumer/consumer.go +++ b/cmd/kafka-consumer/consumer.go @@ -46,7 +46,11 @@ func getPartitionNum(o *option) (int32, error) { for i := 0; i <= 30; i++ { resp, err := admin.GetMetadata(&o.topic, false, timeout) if err != nil { - if err.(kafka.Error).Code() == kafka.ErrTransport { + if func() kafka.Error { + var target kafka.Error + _ = errors.As(err, &target) + return target + }().Code() == kafka.ErrTransport { log.Info("retry get partition number", zap.Int("retryTime", i), zap.Int("timeout", timeout)) timeout += 100 continue diff --git a/cmd/kafka-consumer/writer.go b/cmd/kafka-consumer/writer.go index ac073a2958..3962d088e0 100644 --- a/cmd/kafka-consumer/writer.go +++ b/cmd/kafka-consumer/writer.go @@ -64,10 +64,8 @@ func (p *partitionProgress) updateWatermark(newWatermark uint64, offset kafka.Of zap.Uint64("watermark", newWatermark)) return } - readOldOffset := true - if offset > p.watermarkOffset { - readOldOffset = false - } + readOldOffset := !(offset > p.watermarkOffset) + log.Warn("partition resolved ts fall back, ignore it", zap.Bool("readOldOffset", readOldOffset), zap.Int32("partition", p.partition), diff --git a/cmd/oauth2-server/main.go b/cmd/oauth2-server/main.go index 1385bfc4bb..5ee68f13c1 100644 --- a/cmd/oauth2-server/main.go +++ b/cmd/oauth2-server/main.go @@ -152,7 +152,7 @@ func run(_ *cobra.Command, _ []string) { } }))) http.Handle("/.well-known/openid-configuration", logMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - _, _ = w.Write([]byte(fmt.Sprintf(openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port))) + _, _ = fmt.Fprintf(w, openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port) w.WriteHeader(200) }))) log.Info("starting auth2 server", zap.Int("port", serverConfig.port)) diff --git a/cmd/pulsar-consumer/consumer.go b/cmd/pulsar-consumer/consumer.go index d23ed61675..e9d0217c52 100644 --- a/cmd/pulsar-consumer/consumer.go +++ b/cmd/pulsar-consumer/consumer.go @@ -115,7 +115,7 @@ func (c *consumer) readMessage(ctx context.Context) error { if !needCommit { continue } - err := c.pulsarConsumer.AckID(consumerMsg.Message.ID()) + err := c.pulsarConsumer.AckID(consumerMsg.ID()) if err != nil { log.Panic("Error ack message", zap.Error(err)) } diff --git a/cmd/storage-consumer/main.go b/cmd/storage-consumer/main.go index c8aa270301..7215d9c5ab 100644 --- a/cmd/storage-consumer/main.go +++ b/cmd/storage-consumer/main.go @@ -15,6 +15,7 @@ package main import ( "context" + "errors" "flag" "net/http" "net/url" @@ -103,7 +104,7 @@ func main() { if consumer != nil { consumer.sink.Close() } - if err != nil && err != context.Canceled { + if err != nil && !errors.Is(err, context.Canceled) { return 1 } return 0 diff --git a/coordinator/changefeed/backoff_test.go b/coordinator/changefeed/backoff_test.go index c5962cbd63..c0af7d7f0c 100644 --- a/coordinator/changefeed/backoff_test.go +++ b/coordinator/changefeed/backoff_test.go @@ -150,7 +150,6 @@ func TestTableRoutingErrorsFastFail(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { backoff := NewBackoff(common.NewChangeFeedIDWithName("test", common.DefaultKeyspaceName), time.Minute*30, 1) require.True(t, backoff.ShouldRun()) diff --git a/coordinator/changefeed/etcd_backend_test.go b/coordinator/changefeed/etcd_backend_test.go index a801fbcaec..223c1db098 100644 --- a/coordinator/changefeed/etcd_backend_test.go +++ b/coordinator/changefeed/etcd_backend_test.go @@ -58,7 +58,7 @@ func TestGetAllChangefeeds(t *testing.T) { require.Nil(t, err) require.Len(t, resp, 0) - // status unmarshal failed, changefeed will not be ignored, and the checkpiont ts will be the start ts + // status unmarshal failed, changefeed will not be ignored, and the checkpoint ts will be the start ts // the old version of changefeed without gid cdcClient.EXPECT().GetChangefeedInfoAndStatus(gomock.Any()).Return( int64(0), diff --git a/coordinator/controller.go b/coordinator/controller.go index 7e38cf2fd7..d4214d53e1 100644 --- a/coordinator/controller.go +++ b/coordinator/controller.go @@ -723,10 +723,7 @@ func (c *Controller) RemoveChangefeed(ctx context.Context, id common.ChangeFeedI count := 0 ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() - for { - if op.IsFinished() { - break - } + for !op.IsFinished() { select { case <-ctx.Done(): return 0, errors.Trace(ctx.Err()) @@ -764,10 +761,7 @@ func (c *Controller) PauseChangefeed(ctx context.Context, id common.ChangeFeedID count := 0 ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() - for { - if op.IsFinished() { - break - } + for !op.IsFinished() { select { case <-ctx.Done(): return errors.Trace(ctx.Err()) diff --git a/coordinator/coordinator_test.go b/coordinator/coordinator_test.go index d8f08c028b..5e51329bbd 100644 --- a/coordinator/coordinator_test.go +++ b/coordinator/coordinator_test.go @@ -16,6 +16,7 @@ package coordinator import ( "context" "encoding/json" + "errors" "flag" "fmt" "net" @@ -682,7 +683,7 @@ func TestConcurrentStopAndSendEvents(t *testing.T) { ctxRun, cancelRun := context.WithCancel(ctx) go func() { err := cr.Run(ctxRun) - if err != nil && err != context.Canceled { + if err != nil && !errors.Is(err, context.Canceled) { t.Errorf("Coordinator Run returned unexpected error: %v", err) } }() @@ -715,7 +716,7 @@ func TestConcurrentStopAndSendEvents(t *testing.T) { // Use recvMessages to send event to channel err := co.recvMessages(ctx, msg) - if err != nil && err != context.Canceled { + if err != nil && !errors.Is(err, context.Canceled) { t.Logf("Failed to send event in goroutine %d: %v", id, err) } diff --git a/downstreamadapter/dispatcher/basic_dispatcher.go b/downstreamadapter/dispatcher/basic_dispatcher.go index 5f1ed3eaf0..198826f705 100644 --- a/downstreamadapter/dispatcher/basic_dispatcher.go +++ b/downstreamadapter/dispatcher/basic_dispatcher.go @@ -490,9 +490,9 @@ func (d *BasicDispatcher) isFirstEvent(event commonEvent.Event) bool { } func (d *BasicDispatcher) GetHeartBeatInfo(h *HeartBeatInfo) { - h.Watermark.CheckpointTs = d.GetCheckpointTs() - h.Watermark.ResolvedTs = d.GetResolvedTs() - h.Watermark.LastSyncedTs = d.GetLastSyncedTs() + h.CheckpointTs = d.GetCheckpointTs() + h.ResolvedTs = d.GetResolvedTs() + h.LastSyncedTs = d.GetLastSyncedTs() h.Id = d.GetId() h.ComponentStatus = d.GetComponentStatus() h.IsRemoving = d.GetRemovingStatus() @@ -591,7 +591,7 @@ func (d *BasicDispatcher) handleEvents(dispatcherEvents []DispatcherEvent, wakeC if log.GetLevel() == zapcore.DebugLevel { log.Debug("dispatcher receive all event", zap.Stringer("dispatcher", d.id), zap.Int64("mode", d.mode), - zap.String("eventType", commonEvent.TypeToString(dispatcherEvent.Event.GetType())), + zap.String("eventType", commonEvent.TypeToString(dispatcherEvent.GetType())), zap.Any("event", dispatcherEvent.Event)) } diff --git a/downstreamadapter/dispatcher/event_dispatcher.go b/downstreamadapter/dispatcher/event_dispatcher.go index c4691de983..770852b163 100644 --- a/downstreamadapter/dispatcher/event_dispatcher.go +++ b/downstreamadapter/dispatcher/event_dispatcher.go @@ -125,8 +125,8 @@ func (d *EventDispatcher) cache(dispatcherEvents []DispatcherEvent, wakeCallback zap.Stringer("dispatcher", d.id), zap.Uint64("dispatcherResolvedTs", d.GetResolvedTs()), zap.Int("length", len(dispatcherEvents)), - zap.Int("eventType", dispatcherEvents[len(dispatcherEvents)-1].Event.GetType()), - zap.Uint64("commitTs", dispatcherEvents[len(dispatcherEvents)-1].Event.GetCommitTs()), + zap.Int("eventType", dispatcherEvents[len(dispatcherEvents)-1].GetType()), + zap.Uint64("commitTs", dispatcherEvents[len(dispatcherEvents)-1].GetCommitTs()), zap.Uint64("redoGlobalTs", d.redoGlobalTs.Load()), ) default: @@ -137,7 +137,7 @@ func (d *EventDispatcher) cache(dispatcherEvents []DispatcherEvent, wakeCallback func (d *EventDispatcher) HandleEvents(dispatcherEvents []DispatcherEvent, wakeCallback func()) bool { // if the commit-ts of last event of dispatcherEvents is greater than redoGlobalTs, // the dispatcherEvents will be cached util the redoGlobalTs is updated. - if d.redoEnable && len(dispatcherEvents) > 0 && d.redoGlobalTs.Load() < dispatcherEvents[len(dispatcherEvents)-1].Event.GetCommitTs() { + if d.redoEnable && len(dispatcherEvents) > 0 && d.redoGlobalTs.Load() < dispatcherEvents[len(dispatcherEvents)-1].GetCommitTs() { d.cache(dispatcherEvents, wakeCallback) return true } diff --git a/downstreamadapter/dispatchermanager/dispatcher_manager.go b/downstreamadapter/dispatchermanager/dispatcher_manager.go index d88bce3c5e..d88d5cb6e5 100644 --- a/downstreamadapter/dispatchermanager/dispatcher_manager.go +++ b/downstreamadapter/dispatchermanager/dispatcher_manager.go @@ -831,7 +831,7 @@ func (e *DispatcherManager) MergeDispatcher(dispatcherIDs []common.DispatcherID, return e.mergeEventDispatcher(dispatcherIDs, mergedDispatcherID) } -// mergeEventDispatcher merges the mulitple event dispatchers belonging to the same table with consecutive ranges. +// mergeEventDispatcher merges the multiple event dispatchers belonging to the same table with consecutive ranges. func (e *DispatcherManager) mergeEventDispatcher(dispatcherIDs []common.DispatcherID, mergedDispatcherID common.DispatcherID) *MergeCheckTask { // Step 1: check the dispatcherIDs and mergedDispatcherID are valid: // 1. whether the mergedDispatcherID is not exist in the dispatcherMap diff --git a/downstreamadapter/dispatchermanager/dispatcher_manager_helper.go b/downstreamadapter/dispatchermanager/dispatcher_manager_helper.go index 72d21f03d7..64731249cd 100644 --- a/downstreamadapter/dispatchermanager/dispatcher_manager_helper.go +++ b/downstreamadapter/dispatchermanager/dispatcher_manager_helper.go @@ -64,7 +64,7 @@ func getDispatcherStatus(id common.DispatcherID, dispatcherItem dispatcher.Dispa return &heartbeatpb.TableSpanStatus{ ID: id.ToPB(), ComponentStatus: heartBeatInfo.ComponentStatus, - CheckpointTs: heartBeatInfo.Watermark.CheckpointTs, + CheckpointTs: heartBeatInfo.CheckpointTs, EventSizePerSecond: dispatcherItem.GetEventSizePerSecond(), Mode: dispatcherItem.GetMode(), }, nil, &heartBeatInfo.Watermark diff --git a/downstreamadapter/eventcollector/dispatcher_stat_test.go b/downstreamadapter/eventcollector/dispatcher_stat_test.go index d84013b610..637da1155e 100644 --- a/downstreamadapter/eventcollector/dispatcher_stat_test.go +++ b/downstreamadapter/eventcollector/dispatcher_stat_test.go @@ -1051,7 +1051,6 @@ func TestHandleBatchDataEvents(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() mockDisp := newMockDispatcher(common.NewDispatcherID(), 0) @@ -1140,7 +1139,6 @@ func TestHandleSingleDataEvents(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() mockDisp := newMockDispatcher(common.NewDispatcherID(), 0) @@ -1345,7 +1343,6 @@ func TestHandleBatchDMLEvent(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() mockDisp := newMockDispatcher(common.NewDispatcherID(), 0) diff --git a/downstreamadapter/eventcollector/event_collector.go b/downstreamadapter/eventcollector/event_collector.go index e22ab376b9..77f13cd8ca 100644 --- a/downstreamadapter/eventcollector/event_collector.go +++ b/downstreamadapter/eventcollector/event_collector.go @@ -476,7 +476,8 @@ func (c *EventCollector) sendDispatcherRequests(ctx context.Context) error { if err != nil { sleepInterval := 10 * time.Millisecond // if the error is Congested, sleep a larger interval - if appErr, ok := err.(errors.AppError); ok && appErr.Type == errors.ErrorTypeMessageCongested { + var appErr errors.AppError + if errors.As(err, &appErr) { sleepInterval = 1 * time.Second } log.Info("failed to send dispatcher request message, try again later", diff --git a/downstreamadapter/routing/ddl_query_rewriter_test.go b/downstreamadapter/routing/ddl_query_rewriter_test.go index 6e9d946e51..8294fcc7eb 100644 --- a/downstreamadapter/routing/ddl_query_rewriter_test.go +++ b/downstreamadapter/routing/ddl_query_rewriter_test.go @@ -487,7 +487,6 @@ func TestRewriteParserBackedDDLQueryWithSemicolonsInLiteralsAndComments(t *testi } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/downstreamadapter/routing/router_apply_test.go b/downstreamadapter/routing/router_apply_test.go index de97c77c57..5d52f9a46c 100644 --- a/downstreamadapter/routing/router_apply_test.go +++ b/downstreamadapter/routing/router_apply_test.go @@ -364,7 +364,6 @@ func TestApplyToDDLEvent(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { routed, err := tc.router.ApplyToDDLEvent(tc.ddl) require.NoError(t, err) @@ -540,7 +539,6 @@ func TestRewriteDDLQueryWithRouting(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { newQuery, err := tc.router.rewriteParserBackedDDLQuery(tc.ddl) require.NoError(t, err) @@ -775,7 +773,6 @@ func TestApplyToDDLEventRejectsParserUnsupportedIndexDDL(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/downstreamadapter/routing/router_supported_ddl_test.go b/downstreamadapter/routing/router_supported_ddl_test.go index ca33b5f1d8..78d8b21374 100644 --- a/downstreamadapter/routing/router_supported_ddl_test.go +++ b/downstreamadapter/routing/router_supported_ddl_test.go @@ -991,7 +991,6 @@ func TestRewriteDDLQueryWithRoutingSupportsParserBackedDDLTypes(t *testing.T) { require.GreaterOrEqual(t, len(cases), 39) for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { require.Equal(t, byte(tc.action), tc.ddl.Type) diff --git a/downstreamadapter/sink/redo/meta.go b/downstreamadapter/sink/redo/meta.go index c23d3387b9..60f18353b7 100644 --- a/downstreamadapter/sink/redo/meta.go +++ b/downstreamadapter/sink/redo/meta.go @@ -397,11 +397,9 @@ func (m *RedoMeta) prepareForFlushMeta() (bool, misc.LogMeta) { unflushed.CheckpointTs = m.metaCheckpointTs.getUnflushed() unflushed.ResolvedTs = m.metaResolvedTs.getUnflushed() - hasChange := false - if flushed.CheckpointTs < unflushed.CheckpointTs || - flushed.ResolvedTs < unflushed.ResolvedTs { - hasChange = true - } + hasChange := flushed.CheckpointTs < unflushed.CheckpointTs || + flushed.ResolvedTs < unflushed.ResolvedTs + return hasChange, unflushed } diff --git a/downstreamadapter/sink/redo/sink.go b/downstreamadapter/sink/redo/sink.go index 10b81b39b8..3c32a7582e 100644 --- a/downstreamadapter/sink/redo/sink.go +++ b/downstreamadapter/sink/redo/sink.go @@ -197,7 +197,7 @@ func (s *Sink) Close() { start := time.Now() s.logBuffer.Close() if s.ddlWriter != nil { - if err := s.ddlWriter.Close(); err != nil && errors.Cause(err) != context.Canceled { + if err := s.ddlWriter.Close(); err != nil && !errors.Is(errors.Cause(err), context.Canceled) { log.Error("redo sink fails to close ddl writer", zap.String("keyspace", s.changefeedID.Keyspace()), zap.String("changefeed", s.changefeedID.Name()), @@ -205,7 +205,7 @@ func (s *Sink) Close() { } } if s.dmlWriter != nil { - if err := s.dmlWriter.Close(); err != nil && errors.Cause(err) != context.Canceled { + if err := s.dmlWriter.Close(); err != nil && !errors.Is(errors.Cause(err), context.Canceled) { log.Error("redo sink fails to close dml writer", zap.String("keyspace", s.changefeedID.Keyspace()), zap.String("changefeed", s.changefeedID.Name()), diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index 4138cb3609..beb98e6257 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -945,10 +945,7 @@ func (e *eventStore) GetIterator(dispatcherID common.DispatcherID, dataRange com decoder := e.decoderPool.Get().(*zstd.Decoder) - needCheckSpan := true - if stat.tableSpan.Equal(subStat.tableSpan) { - needCheckSpan = false - } + needCheckSpan := !stat.tableSpan.Equal(subStat.tableSpan) return &eventStoreIter{ tableSpan: stat.tableSpan, @@ -1520,14 +1517,12 @@ func (iter *eventStoreIter) Next() (*common.RawKVEntry, bool) { skippedBytesMetrics.Add(float64(len(value))) iter.innerIter.Next() } - isNewTxn := false + isNewTxn := iter.prevCommitTs == 0 || (rawKV.StartTs != iter.prevStartTs || rawKV.CRTs != iter.prevCommitTs) // 2 PC transactions have different startTs and commitTs. // async-commit transactions have different startTs and may have the same commitTs. // at the moment, use commit-ts determine whether it is a new transaction, even though multiple // different transactions may be grouped together, to satisfy the resolved-ts semantics. - if iter.prevCommitTs == 0 || (rawKV.StartTs != iter.prevStartTs || rawKV.CRTs != iter.prevCommitTs) { - isNewTxn = true - } + iter.prevCommitTs = rawKV.CRTs iter.prevStartTs = rawKV.StartTs iter.rowCount++ diff --git a/logservice/logpuller/region_request_worker.go b/logservice/logpuller/region_request_worker.go index 2049335446..00b7023cc5 100644 --- a/logservice/logpuller/region_request_worker.go +++ b/logservice/logpuller/region_request_worker.go @@ -15,6 +15,7 @@ package logpuller import ( "context" + stderrors "errors" "sync" "sync/atomic" "time" @@ -105,7 +106,7 @@ func newRegionRequestWorker( } var regionErr error if err := version.CheckStoreVersion(ctx, worker.client.pd); err != nil { - if errors.Cause(err) == context.Canceled { + if stderrors.Is(errors.Cause(err), context.Canceled) { return nil } log.Error("event feed check store version fails", diff --git a/logservice/logpuller/subscription_client.go b/logservice/logpuller/subscription_client.go index 50c7fed814..484f7c83b7 100644 --- a/logservice/logpuller/subscription_client.go +++ b/logservice/logpuller/subscription_client.go @@ -15,6 +15,7 @@ package logpuller import ( "context" + stderrors "errors" "sync" "sync/atomic" "time" @@ -844,7 +845,8 @@ func (s *subscriptionClient) handleErrors(ctx context.Context) error { func (s *subscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error { err := errors.Cause(errInfo.err) - if _, requestCancelled := err.(*requestCancelledErr); !requestCancelled { + var rcErr *requestCancelledErr + if !stderrors.As(err, &rcErr) { log.Debug("cdc region error", zap.Uint64("subscriptionID", uint64(errInfo.subscribedSpan.subID)), zap.Uint64("regionID", errInfo.verID.GetID()), diff --git a/logservice/schemastore/disk_format.go b/logservice/schemastore/disk_format.go index 8b27b11d65..4a407ad5da 100644 --- a/logservice/schemastore/disk_format.go +++ b/logservice/schemastore/disk_format.go @@ -17,6 +17,7 @@ import ( "bytes" "encoding/binary" "encoding/json" + "errors" "math" "strings" "time" @@ -379,7 +380,7 @@ func tryReadLogicalTableID(snap *pebble.Snapshot, tableID int64, version uint64) return 0 } val, closer, err := snap.Get(key) - if err == pebble.ErrNotFound { + if errors.Is(err, pebble.ErrNotFound) { return 0 } if err != nil { @@ -402,7 +403,7 @@ func readTableInfoInKVSnap(snap *pebble.Snapshot, tableID int64, version uint64) log.Fatal("generate table info failed", zap.Error(err)) } value, closer, err := snap.Get(targetKey) - if err == pebble.ErrNotFound { + if errors.Is(err, pebble.ErrNotFound) { return "", nil } if err != nil { diff --git a/logservice/schemastore/multi_version_test.go b/logservice/schemastore/multi_version_test.go index 8cfb443c7e..f90af8688e 100644 --- a/logservice/schemastore/multi_version_test.go +++ b/logservice/schemastore/multi_version_test.go @@ -14,6 +14,7 @@ package schemastore import ( + "errors" "testing" "github.com/pingcap/ticdc/pkg/common" @@ -221,7 +222,8 @@ func TestBuildVersionedTableInfoStore(t *testing.T) { } } else { require.Nil(t, tableInfo) - if _, ok := err.(*TableDeletedError); !ok { + var tableDeletedError *TableDeletedError + if !errors.As(err, &tableDeletedError) { t.Error("expect TableDeletedError, but got", err) } } diff --git a/logservice/schemastore/persist_storage_test.go b/logservice/schemastore/persist_storage_test.go index 47cc4d2763..864d9958c1 100644 --- a/logservice/schemastore/persist_storage_test.go +++ b/logservice/schemastore/persist_storage_test.go @@ -14,6 +14,7 @@ package schemastore import ( + "errors" "fmt" "math" "os" @@ -2881,7 +2882,8 @@ func TestRegisterTable(t *testing.T) { tableInfo, err := pStorage.getTableInfo(testCase.tableID, testCase.snapTs) if testCase.deleted { require.Nil(t, tableInfo) - if _, ok := err.(*TableDeletedError); !ok { + var tableDeletedError *TableDeletedError + if !errors.As(err, &tableDeletedError) { t.Error("expect TableDeletedError, but got", err) } } else { diff --git a/logservice/schemastore/schema_store_test.go b/logservice/schemastore/schema_store_test.go index 11bbe6724e..6168bef86f 100644 --- a/logservice/schemastore/schema_store_test.go +++ b/logservice/schemastore/schema_store_test.go @@ -102,8 +102,8 @@ func TestIgnoreDDLByCommitTs(t *testing.T) { require.Len(t, tables, 2) tableNames := make(map[string]struct{}) for _, tbl := range tables { - log.Info("found table", zap.String("name", tbl.SchemaTableName.TableName)) - tableNames[tbl.SchemaTableName.TableName] = struct{}{} + log.Info("found table", zap.String("name", tbl.TableName)) + tableNames[tbl.TableName] = struct{}{} } require.Contains(t, tableNames, "t1") require.Contains(t, tableNames, "t3") diff --git a/maintainer/barrier.go b/maintainer/barrier.go index 0c92fdeb87..62b6752163 100644 --- a/maintainer/barrier.go +++ b/maintainer/barrier.go @@ -228,7 +228,7 @@ func (b *Barrier) handleBootstrapResponse(bootstrapRespMap map[node.ID]*heartbea b.blockedEvents.Range(func(key eventKey, barrierEvent *BarrierEvent) bool { if barrierEvent.allDispatcherReported() { // it means the dispatchers involved in the block event are all in the cached resp, not restarted. - // so we don't do speical check for this event + // so we don't do special check for this event // just use usual logic to handle it // Besides, is the dispatchers are all reported waiting status, it means at least one dispatcher // is not get acked, so it must be resent by dispatcher later. @@ -467,7 +467,7 @@ func (b *Barrier) checkEventFinish(be *BarrierEvent) { if be.selected.Load() { log.Info("all dispatchers reported event done, remove event", zap.String("changefeed", be.cfID.Name()), - zap.Uint64("committs", be.commitTs), + zap.Uint64("commits", be.commitTs), zap.Int64("mode", b.mode)) // already selected a dispatcher to write, now all dispatchers reported the block event b.blockedEvents.Delete(getEventKey(be.commitTs, be.isSyncPoint)) diff --git a/maintainer/operator/operator_merge.go b/maintainer/operator/operator_merge.go index beee376717..fb7b281de3 100644 --- a/maintainer/operator/operator_merge.go +++ b/maintainer/operator/operator_merge.go @@ -65,8 +65,8 @@ type MergeDispatcherOperator struct { func buildMergedSpanInfo(toMergedSpans []*heartbeatpb.TableSpan) string { var spansInfo strings.Builder for _, span := range toMergedSpans { - spansInfo.WriteString(fmt.Sprintf("[%s,%s,%d]", - hex.EncodeToString(span.StartKey), hex.EncodeToString(span.EndKey), span.TableID)) + fmt.Fprintf(&spansInfo, "[%s,%s,%d]", + hex.EncodeToString(span.StartKey), hex.EncodeToString(span.EndKey), span.TableID) } return spansInfo.String() } diff --git a/maintainer/operator/operator_split.go b/maintainer/operator/operator_split.go index 1ef53e8b92..636c7c2454 100644 --- a/maintainer/operator/operator_split.go +++ b/maintainer/operator/operator_split.go @@ -78,8 +78,8 @@ func NewSplitDispatcherOperator( ) *SplitDispatcherOperator { var spansInfo strings.Builder for _, span := range splitSpans { - spansInfo.WriteString(fmt.Sprintf("[%s,%s]", - hex.EncodeToString(span.StartKey), hex.EncodeToString(span.EndKey))) + fmt.Fprintf(&spansInfo, "[%s,%s]", + hex.EncodeToString(span.StartKey), hex.EncodeToString(span.EndKey)) } op := &SplitDispatcherOperator{ replicaSet: replicaSet, diff --git a/maintainer/range_checker/table_span_range_checker.go b/maintainer/range_checker/table_span_range_checker.go index 580cd34460..478247acfb 100644 --- a/maintainer/range_checker/table_span_range_checker.go +++ b/maintainer/range_checker/table_span_range_checker.go @@ -79,7 +79,7 @@ func (rc *TableSpanRangeChecker) Detail() string { buf.WriteString("uncovered tables: ") for id, span := range rc.tableSpans { if !span.IsFullyCovered() { - buf.WriteString(fmt.Sprintf("%d,\n", id)) + fmt.Fprintf(buf, "%d,\n", id) } } return buf.String() diff --git a/maintainer/replica/split_span_checker.go b/maintainer/replica/split_span_checker.go index 441cc0f39a..6e700a6c29 100644 --- a/maintainer/replica/split_span_checker.go +++ b/maintainer/replica/split_span_checker.go @@ -106,7 +106,8 @@ func (b *BalanceCondition) updateScore(minTrafficNodeID node.ID, if b.balanceScore == 0 { b.initFirstScore(minTrafficNodeID, maxTrafficNodeID, balanceCauseByMinNode, balanceCauseByMaxNode) } else { - if b.balanceCause == BalanceCauseByBoth { + switch b.balanceCause { + case BalanceCauseByBoth: if b.minTrafficNodeID == minTrafficNodeID && b.maxTrafficNodeID == maxTrafficNodeID { b.balanceScore += 1 } else if b.minTrafficNodeID == minTrafficNodeID { @@ -118,13 +119,13 @@ func (b *BalanceCondition) updateScore(minTrafficNodeID node.ID, } else { b.initFirstScore(minTrafficNodeID, maxTrafficNodeID, balanceCauseByMinNode, balanceCauseByMaxNode) } - } else if b.balanceCause == BalanceCauseByMaxNode { + case BalanceCauseByMaxNode: if b.maxTrafficNodeID == maxTrafficNodeID { b.balanceScore += 1 } else { b.initFirstScore(minTrafficNodeID, maxTrafficNodeID, balanceCauseByMinNode, balanceCauseByMaxNode) } - } else if b.balanceCause == BalanceCauseByMinNode { + case BalanceCauseByMinNode: if b.minTrafficNodeID == minTrafficNodeID { b.balanceScore += 1 } else { @@ -242,7 +243,7 @@ func (s *SplitSpanChecker) UpdateStatus(replica *SpanReplication) { log.Debug("update traffic score", zap.String("changefeed", s.changefeedID.String()), zap.Int64("group", s.groupID), - zap.String("span", status.SpanReplication.ID.String()), + zap.String("span", status.ID.String()), zap.Any("trafficScore", status.trafficScore), zap.Any("eventSizePerSecond", status.GetStatus().EventSizePerSecond), ) @@ -976,7 +977,7 @@ func (s *SplitSpanChecker) chooseSplitSpans( log.Info("chooseSplitSpans split span by traffic", zap.String("changefeed", s.changefeedID.String()), zap.Int64("group", s.groupID), - zap.String("splitSpan", status.SpanReplication.ID.String()), + zap.String("splitSpan", status.ID.String()), zap.Any("splitTargetNodes", status.GetNodeID()), ) spanNum := int(math.Ceil(status.lastThreeTraffic[latestTrafficIndex] / float64(s.writeThreshold))) @@ -1000,7 +1001,7 @@ func (s *SplitSpanChecker) chooseSplitSpans( if status.regionCount > s.regionThreshold { log.Info("chooseSplitSpans split span by region", zap.String("changefeed", s.changefeedID.String()), - zap.String("splitSpan", status.SpanReplication.ID.String()), + zap.String("splitSpan", status.ID.String()), zap.Int64("group", s.groupID), zap.Any("splitTargetNodes", status.GetNodeID()), ) @@ -1211,7 +1212,7 @@ func (s *SplitSpanChecker) checkBalanceTraffic( log.Info("checkBalanceTraffic split span", zap.Stringer("changefeed", s.changefeedID), - zap.String("splitSpan", span.SpanReplication.ID.String()), + zap.String("splitSpan", span.ID.String()), zap.Int64("group", s.groupID), zap.Any("splitTargetNodes", []node.ID{minTrafficNodeID, maxTrafficNodeID}), ) @@ -1247,13 +1248,13 @@ func (s *SplitSpanChecker) Stat() string { res.WriteString("traffic infos:") // record all the latest three traffic of tasks for _, status := range s.allTasks { - res.WriteString(fmt.Sprintf("[task: %s, traffic: %f, %f, %f];", status.ID, status.lastThreeTraffic[0], status.lastThreeTraffic[1], status.lastThreeTraffic[2])) + fmt.Fprintf(&res, "[task: %s, traffic: %f, %f, %f];", status.ID, status.lastThreeTraffic[0], status.lastThreeTraffic[1], status.lastThreeTraffic[2]) } } if s.regionThreshold > 0 { res.WriteString("region infos:") for _, status := range s.allTasks { - res.WriteString(fmt.Sprintf("[task: %s, region: %d];", status.ID, status.regionCount)) + fmt.Fprintf(&res, "[task: %s, region: %d];", status.ID, status.regionCount) } } return res.String() diff --git a/maintainer/scheduler/balance_splits.go b/maintainer/scheduler/balance_splits.go index c66b7429c3..7f808a01a9 100644 --- a/maintainer/scheduler/balance_splits.go +++ b/maintainer/scheduler/balance_splits.go @@ -128,7 +128,8 @@ func (s *balanceSplitsScheduler) Execute() time.Time { checkResults := s.spanController.CheckByGroup(group, availableSize) for _, checkResult := range checkResults.([]replica.SplitSpanCheckResult) { - if checkResult.OpType == replica.OpSplit { + switch checkResult.OpType { + case replica.OpSplit: splitSpans := s.splitter.Split(context.Background(), checkResult.SplitSpan.Span, checkResult.SpanNum, checkResult.SpanType) if len(splitSpans) > 1 { op := operator.NewSplitDispatcherOperator(s.spanController, checkResult.SplitSpan, splitSpans, checkResult.SplitTargetNodes, func(span *replica.SpanReplication, node node.ID) bool { @@ -139,7 +140,7 @@ func (s *balanceSplitsScheduler) Execute() time.Time { availableSize-- } } - } else if checkResult.OpType == replica.OpMove { + case replica.OpMove: for _, span := range checkResult.MoveSpans { op := operator.NewMoveDispatcherOperator(s.spanController, span, span.GetNodeID(), checkResult.TargetNode) ret := s.operatorController.AddOperator(op) @@ -147,7 +148,7 @@ func (s *balanceSplitsScheduler) Execute() time.Time { availableSize-- } } - } else if checkResult.OpType == replica.OpMerge { + case replica.OpMerge: if s.operatorController.AddMergeOperator(checkResult.MergeSpans) != nil { availableSize = availableSize - 1 - len(checkResult.MergeSpans) } diff --git a/maintainer/scheduler/drain_test.go b/maintainer/scheduler/drain_test.go index d2f93cfa7b..1ee5243430 100644 --- a/maintainer/scheduler/drain_test.go +++ b/maintainer/scheduler/drain_test.go @@ -279,7 +279,6 @@ func TestCalculateDrainMoveLimit(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() require.Equal(t, tc.expected, calculateDrainMoveLimit(tc.initialTargetDispatcherCount)) diff --git a/pkg/applier/redo.go b/pkg/applier/redo.go index 72b9043f34..f3b7d78741 100644 --- a/pkg/applier/redo.go +++ b/pkg/applier/redo.go @@ -184,10 +184,7 @@ func (ra *RedoApplier) consumeLogs(ctx context.Context) error { if err != nil { return err } - for { - if row == nil && ddl == nil { - break - } + for row != nil || ddl != nil { if shouldApplyDDL(row, ddl) { if err := ra.applyDDL(ctx, ddl, checkpointTs); err != nil { return err @@ -483,7 +480,7 @@ func (ra *RedoApplier) Apply(egCtx context.Context) (err error) { }) err = eg.Wait() - if errors.Cause(err) != errApplyFinished { + if !errors.Is(errors.Cause(err), errApplyFinished) { return err } return nil diff --git a/pkg/binlog-filter/filter_test.go b/pkg/binlog-filter/filter_test.go index bac74d2c2f..5b3ddb0d81 100644 --- a/pkg/binlog-filter/filter_test.go +++ b/pkg/binlog-filter/filter_test.go @@ -126,7 +126,7 @@ func TestFilter(t *testing.T) { require.Equal(t, Do, action) // invalid rule - err = filter.Selector.Insert("test_1_*", "abc*", "error", selector.Insert) + err = filter.Insert("test_1_*", "abc*", "error", selector.Insert) require.NoError(t, err) _, err = filter.Filter("test_1_a", "abc", InsertEvent, "") require.Error(t, err) diff --git a/pkg/common/format.go b/pkg/common/format.go index 981dabd15f..4a9cdbb3d9 100644 --- a/pkg/common/format.go +++ b/pkg/common/format.go @@ -32,9 +32,9 @@ func FormatBlockStatusRequest(r *heartbeatpb.BlockStatusRequest) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf("changefeed: %s, changefeedID: %s", + fmt.Fprintf(&sb, "changefeed: %s, changefeedID: %s", r.ChangefeedID.GetName(), - NewChangefeedGIDFromPB(r.ChangefeedID).String())) + NewChangefeedGIDFromPB(r.ChangefeedID).String()) for _, status := range r.BlockStatuses { sb.WriteString(FormatTableSpanBlockStatus(status)) } @@ -51,9 +51,9 @@ func FormatTableSpanBlockStatus(s *heartbeatpb.TableSpanBlockStatus) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf("[ dispatcherID: %s, state: %s ]", + fmt.Fprintf(&sb, "[ dispatcherID: %s, state: %s ]", NewDispatcherIDFromPB(s.ID).String(), - s.State.String())) + s.State.String()) sb.WriteString("\n") return sb.String() } @@ -63,10 +63,10 @@ func FormatDispatcherStatus(d *heartbeatpb.DispatcherStatus) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf("action: %s, ack: %s, influencedDispatchers: %s", + fmt.Fprintf(&sb, "action: %s, ack: %s, influencedDispatchers: %s", d.Action.String(), d.Ack.String(), - FormatInfluencedDispatchers(d.InfluencedDispatchers))) + FormatInfluencedDispatchers(d.InfluencedDispatchers)) sb.WriteString("\n") return sb.String() } @@ -76,18 +76,18 @@ func FormatInfluencedDispatchers(d *heartbeatpb.InfluencedDispatchers) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf("schemaID: %d, influenceType: %s", + fmt.Fprintf(&sb, "schemaID: %d, influenceType: %s", d.SchemaID, - d.InfluenceType.String())) + d.InfluenceType.String()) sb.WriteString("dispatcherIDs: [") for _, dispatcherID := range d.DispatcherIDs { - sb.WriteString(fmt.Sprintf("%s, ", - NewDispatcherIDFromPB(dispatcherID).String())) + fmt.Fprintf(&sb, "%s, ", + NewDispatcherIDFromPB(dispatcherID).String()) } sb.WriteString("]") if d.ExcludeDispatcherId != nil { - sb.WriteString(fmt.Sprintf(", excludeDispatcherID: %s", - NewDispatcherIDFromPB(d.ExcludeDispatcherId).String())) + fmt.Fprintf(&sb, ", excludeDispatcherID: %s", + NewDispatcherIDFromPB(d.ExcludeDispatcherId).String()) } sb.WriteString("\n") return sb.String() @@ -98,11 +98,11 @@ func FormatTableSpan(s *heartbeatpb.TableSpan) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf("tableID: %d, startKey: %s, endKey: %s, keyspaceID: %d", + fmt.Fprintf(&sb, "tableID: %d, startKey: %s, endKey: %s, keyspaceID: %d", s.TableID, hex.EncodeToString(s.StartKey), hex.EncodeToString(s.EndKey), - s.KeyspaceID)) + s.KeyspaceID) return sb.String() } @@ -111,14 +111,12 @@ func FormatMaintainerStatus(s *heartbeatpb.MaintainerStatus) string { return "" } sb := strings.Builder{} - sb.WriteString(fmt.Sprintf( - "changefeed: %s, feedState: %s, state: %s, checkpointTs: %d, bootstrapDone: %t, errs: [", + fmt.Fprintf(&sb, "changefeed: %s, feedState: %s, state: %s, checkpointTs: %d, bootstrapDone: %t, errs: [", s.ChangefeedID.GetName(), s.FeedState, s.State.String(), s.CheckpointTs, - s.BootstrapDone, - )) + s.BootstrapDone) for _, err := range s.Err { sb.WriteString(err.String()) } diff --git a/pkg/common/format_test.go b/pkg/common/format_test.go index 07ba47d843..9d89c357f1 100644 --- a/pkg/common/format_test.go +++ b/pkg/common/format_test.go @@ -55,7 +55,6 @@ func TestFormatBlockStatusRequest(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatBlockStatusRequest(tc.input) @@ -89,7 +88,6 @@ func TestFormatTableSpanBlockStatus(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatTableSpanBlockStatus(tc.input) @@ -123,7 +121,6 @@ func TestFormatDispatcherStatus(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatDispatcherStatus(tc.input) @@ -156,7 +153,6 @@ func TestFormatInfluencedDispatchers(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatInfluencedDispatchers(tc.input) @@ -190,7 +186,6 @@ func TestFormatTableSpan(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatTableSpan(tc.input) @@ -226,7 +221,6 @@ func TestFormatMaintainerStatus(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() result := FormatMaintainerStatus(tc.input) diff --git a/pkg/common/helper_test.go b/pkg/common/helper_test.go index 60ede36fc8..91054dc99d 100644 --- a/pkg/common/helper_test.go +++ b/pkg/common/helper_test.go @@ -75,7 +75,6 @@ func TestExtractColValTimeTypes(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -322,7 +321,6 @@ func TestExtractColValDefaultDatumValue(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/common/span_op.go b/pkg/common/span_op.go index 2ee078b1e6..16033dc2e8 100644 --- a/pkg/common/span_op.go +++ b/pkg/common/span_op.go @@ -41,7 +41,7 @@ func TableIDToComparableSpan(keyspaceID uint32, tableID int64) heartbeatpb.Table startKey, endKey, err := GetKeyspaceTableRange(keyspaceID, tableID) if err != nil { // This block should never be reached - // The error only happends when the keyspaceID is greater than 0xFFFFFF, which is an invalid keyspaceID + // The error only happens when the keyspaceID is greater than 0xFFFFFF, which is an invalid keyspaceID log.Error("GetKeyspaceTableRange failed", zap.Uint32("keyspaceID", keyspaceID), zap.Int64("tableID", tableID), zap.Error(err)) } return heartbeatpb.TableSpan{ @@ -68,7 +68,7 @@ func IsCompleteSpan(tableSpan *heartbeatpb.TableSpan) bool { startKey, endKey, err := GetKeyspaceTableRange(tableSpan.KeyspaceID, tableSpan.TableID) if err != nil { // This block should never be reached - // The error only happends when the keyspaceID is greater than 0xFFFFFF, which is an invalid keyspaceID + // The error only happens when the keyspaceID is greater than 0xFFFFFF, which is an invalid keyspaceID log.Error("IsCompleteSpan GetKeyspaceTableRange failed", zap.Uint32("keyspaceID", tableSpan.KeyspaceID), zap.Error(err)) } if StartCompare(ToComparableKey(startKey), tableSpan.StartKey) == 0 && EndCompare(ToComparableKey(endKey), tableSpan.EndKey) == 0 { diff --git a/pkg/common/table_info.go b/pkg/common/table_info.go index b40d5fbe65..2c365d0b25 100644 --- a/pkg/common/table_info.go +++ b/pkg/common/table_info.go @@ -58,7 +58,7 @@ func UnquoteName(name string) string { // EscapeName replaces all "`" in name with double "`" func EscapeName(name string) string { - return strings.Replace(name, "`", "``", -1) + return strings.ReplaceAll(name, "`", "``") } const ( diff --git a/pkg/common/table_info_helper.go b/pkg/common/table_info_helper.go index a1430849cf..0dc505bfa4 100644 --- a/pkg/common/table_info_helper.go +++ b/pkg/common/table_info_helper.go @@ -293,7 +293,7 @@ func (s *SharedColumnSchemaStorage) incColumnSchemaCount(columnSchema *columnSch log.Error("inc column schema count failed, column schema not found", zap.Any("columnSchema", columnSchema)) } for idx, colSchemaWithCount := range colSchemas { - if colSchemaWithCount.columnSchema.equal(columnSchema) { + if colSchemaWithCount.equal(columnSchema) { s.m[columnSchema.Digest][idx].count++ return } @@ -326,7 +326,7 @@ func (s *SharedColumnSchemaStorage) GetOrSetColumnSchema(tableInfo *model.TableI } else { for idx, colSchemaWithCount := range colSchemas { // compare tableInfo to check whether the column schema is the same - if colSchemaWithCount.columnSchema.SameWithTableInfo(tableInfo) { + if colSchemaWithCount.SameWithTableInfo(tableInfo) { s.m[digest][idx].count++ return colSchemaWithCount.columnSchema } @@ -352,7 +352,7 @@ func (s *SharedColumnSchemaStorage) getOrSetColumnSchemaByColumnSchema(columnSch } else { for idx, colSchemaWithCount := range colSchemas { // compare tableInfo to check whether the column schema is the same - if colSchemaWithCount.columnSchema.equal(columnSchema) { + if colSchemaWithCount.equal(columnSchema) { s.m[digest][idx].count++ return colSchemaWithCount.columnSchema } @@ -400,7 +400,7 @@ func (s *SharedColumnSchemaStorage) tryReleaseColumnSchema(columnSchema *columnS // columnSchema is shared across multiple tableInfos with the same schema, in order to reduce memory usage. // we make columnSchema as a private struct, in order to avoid other method to directly create a columnSchema object. // we only want user to get columnSchema by the function we provide, which will increase the reference count of columnSchema.(GetOrSetColumnSchema) -// If user want to copy columnSchema(shaddow copy), they should use Clone method. +// If user want to copy columnSchema(shadow copy), they should use Clone method. type columnSchema struct { // digest of the table info Digest Digest `json:"digest"` @@ -469,7 +469,7 @@ func (s *columnSchema) Marshal() ([]byte, error) { return json.Marshal(s) } -// If you want to copy columnSchema(shaddow copy), you should use Clone method. +// If you want to copy columnSchema(shadow copy), you should use Clone method. // This function will increase the reference count of the columnSchema object. func (s *columnSchema) Clone() *columnSchema { GetSharedColumnSchemaStorage().incColumnSchemaCount(s) diff --git a/pkg/common/table_info_shared_schema_guard_test.go b/pkg/common/table_info_shared_schema_guard_test.go index d1f44af88e..7e807fcfd6 100644 --- a/pkg/common/table_info_shared_schema_guard_test.go +++ b/pkg/common/table_info_shared_schema_guard_test.go @@ -128,7 +128,6 @@ func TestLatestTiDBTableInfoSharedSchemaGuard(t *testing.T) { moduleCache := make(map[string]*moduleInfo) packageCache := make(map[packageKey]map[string][]string) for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { mod, ok := moduleCache[tc.modulePath] if !ok { diff --git a/pkg/common/table_info_test.go b/pkg/common/table_info_test.go index 5be97d2f37..2e66658d08 100644 --- a/pkg/common/table_info_test.go +++ b/pkg/common/table_info_test.go @@ -204,7 +204,6 @@ func TestUnquoteName(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() require.Equal(t, tc.expected, UnquoteName(tc.input)) diff --git a/pkg/common/table_name_test.go b/pkg/common/table_name_test.go index 54a2f914cb..13f45a19ff 100644 --- a/pkg/common/table_name_test.go +++ b/pkg/common/table_name_test.go @@ -50,7 +50,6 @@ func TestTableNameIsRouted(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := tt.tableName.IsRouted(); got != tt.expected { diff --git a/pkg/config/sink.go b/pkg/config/sink.go index ee31637165..d939b5c281 100644 --- a/pkg/config/sink.go +++ b/pkg/config/sink.go @@ -1023,7 +1023,7 @@ func (s *SinkConfig) applyParameterBySinkURI(sinkURI *url.URL) error { getErrMsg := func(cfgIn map[string]string) string { var errMsg strings.Builder for k, v := range cfgIn { - errMsg.WriteString(fmt.Sprintf("%s=%s, ", k, v)) + fmt.Fprintf(&errMsg, "%s=%s, ", k, v) } return errMsg.String()[0 : errMsg.Len()-2] } diff --git a/pkg/diff/checkpoint.go b/pkg/diff/checkpoint.go index c71d8574ae..5f9e63c72b 100644 --- a/pkg/diff/checkpoint.go +++ b/pkg/diff/checkpoint.go @@ -224,9 +224,10 @@ func updateTableSummary(ctx context.Context, db *sql.DB, instanceID, schema, tab checkedNum := successNum + failedNum + ignoreNum state := checkingState - if checkedNum == 0 { + switch checkedNum { + case 0: state = notCheckedState - } else if checkedNum == total { + case total: if total == successNum+ignoreNum { state = successState } else { diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 82b0866f0d..29d1d6e49c 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -883,7 +883,7 @@ func generateDML(tp string, data map[string]*dbutil.ColumnData, table *model.Tab } if needQuotes(col.FieldType) { - values = append(values, fmt.Sprintf("'%s'", strings.Replace(string(data[col.Name.O].Data), "'", "\\'", -1))) + values = append(values, fmt.Sprintf("'%s'", strings.ReplaceAll(string(data[col.Name.O].Data), "'", "\\'"))) } else { values = append(values, string(data[col.Name.O].Data)) } @@ -906,7 +906,7 @@ func generateDML(tp string, data map[string]*dbutil.ColumnData, table *model.Tab if needQuotes(col.FieldType) { kvs = append(kvs, fmt.Sprintf("%s = '%s'", dbutil.ColumnName(col.Name.O), - strings.Replace(string(data[col.Name.O].Data), "'", "\\'", -1))) + strings.ReplaceAll(string(data[col.Name.O].Data), "'", "\\'"))) } else { kvs = append(kvs, fmt.Sprintf("%s = %s", dbutil.ColumnName(col.Name.O), string(data[col.Name.O].Data))) diff --git a/pkg/diff/util.go b/pkg/diff/util.go index d50448efd4..bbf0c7c6d8 100644 --- a/pkg/diff/util.go +++ b/pkg/diff/util.go @@ -105,7 +105,7 @@ func getColumnsFromIndex(index *model.IndexInfo, tableInfo *model.TableInfo) []* } func needQuotes(ft types.FieldType) bool { - return !(dbutil.IsNumberType(ft.GetType()) || dbutil.IsFloatType(ft.GetType())) + return !dbutil.IsNumberType(ft.GetType()) && !dbutil.IsFloatType(ft.GetType()) } func rowContainsCols(row map[string]*dbutil.ColumnData, cols []*model.ColumnInfo) bool { @@ -128,9 +128,9 @@ func redactRowToString(row map[string]*dbutil.ColumnData) string { s.WriteString("{ ") for key, val := range row { if val.IsNull { - s.WriteString(fmt.Sprintf("%s: IsNull, ", key)) + fmt.Fprintf(&s, "%s: IsNull, ", key) } else { - s.WriteString(fmt.Sprintf("%s: %s, ", key, util.RedactValue(string(val.Data)))) + fmt.Fprintf(&s, "%s: %s, ", key, util.RedactValue(string(val.Data))) } } s.WriteString(" }") diff --git a/pkg/errors/helper.go b/pkg/errors/helper.go index cb522aa5bb..177039bc84 100644 --- a/pkg/errors/helper.go +++ b/pkg/errors/helper.go @@ -41,8 +41,8 @@ func IsRetryableError(err error) bool { return false } - switch errors.Cause(err) { - case context.Canceled, context.DeadlineExceeded: + switch { + case Is(errors.Cause(err), context.Canceled), Is(errors.Cause(err), context.DeadlineExceeded): return false } return true @@ -52,8 +52,8 @@ func IsRetryableError(err error) bool { // Return true also means caller can retry sql safely. func IsConnectionError(err error) bool { err = errors.Cause(err) - switch err { - case driver.ErrBadConn, tmysql.ErrBadConn, gmysql.ErrBadConn: + switch { + case Is(err, driver.ErrBadConn), Is(err, tmysql.ErrBadConn), Is(err, gmysql.ErrBadConn): return true } return false @@ -63,7 +63,7 @@ func IsConnectionError(err error) bool { func IsUnretryableConnectionError(err error) bool { // Can't ensure whether the last write has reached the downstream or not. // If the last write isn't idempotent, retry it may cause problems. - return errors.Cause(err) == dmysql.ErrInvalidConn + return Is(errors.Cause(err), dmysql.ErrInvalidConn) } // ChangeFeedGCFastFailError is read only. diff --git a/pkg/errors/utils.go b/pkg/errors/utils.go index 83d853f2a8..300461f310 100644 --- a/pkg/errors/utils.go +++ b/pkg/errors/utils.go @@ -29,7 +29,8 @@ import ( // IsTableNotExistsErr is used to check if the error is a table not exists error. func IsTableNotExistsErr(err error) bool { err = errors.Cause(err) - mysqlErr, ok := err.(*gmysql.MySQLError) + mysqlErr := &gmysql.MySQLError{} + ok := As(err, &mysqlErr) if !ok { return false } @@ -45,7 +46,8 @@ func IsTableNotExistsErr(err error) bool { // tidb/mysql error code definition: https://github.com/pingcap/tidb/blob/master/mysql/errcode.go func IsIgnorableMySQLDDLError(err error) bool { err = errors.Cause(err) - mysqlErr, ok := err.(*gmysql.MySQLError) + mysqlErr := &gmysql.MySQLError{} + ok := As(err, &mysqlErr) if !ok { return false } @@ -94,7 +96,8 @@ func IsRetryableDDLError(err error) bool { } err = errors.Cause(err) - mysqlErr, ok := err.(*gmysql.MySQLError) + mysqlErr := &gmysql.MySQLError{} + ok := As(err, &mysqlErr) if !ok { return false } @@ -122,7 +125,8 @@ func IsRetryableDDLError(err error) bool { // IsAccessDeniedError checks if the error is an access denied error. func IsAccessDeniedError(err error) bool { err = errors.Cause(err) - mysqlErr, ok := err.(*gmysql.MySQLError) + mysqlErr := &gmysql.MySQLError{} + ok := As(err, &mysqlErr) if !ok { return false } @@ -133,7 +137,8 @@ func IsAccessDeniedError(err error) bool { // IsSyncPointIgnoreError returns whether the error is ignorable for syncpoint. func IsSyncPointIgnoreError(err error) bool { err = errors.Cause(err) - mysqlErr, ok := err.(*gmysql.MySQLError) + mysqlErr := &gmysql.MySQLError{} + ok := As(err, &mysqlErr) if !ok { return false } @@ -149,18 +154,10 @@ func IsRetryableEtcdError(err error) bool { } etcdErr := errors.Cause(err) - switch etcdErr { - // Etcd ResourceExhausted errors, may recover after some time - case v3rpc.ErrNoSpace, v3rpc.ErrTooManyRequests: + switch { + case Is(etcdErr, v3rpc.ErrNoSpace), Is(etcdErr, v3rpc.ErrTooManyRequests): return true - // Etcd Unavailable errors, may be available after some time - // https://github.com/etcd-io/etcd/pull/9934/files#diff-6d8785d0c9eaf96bc3e2b29c36493c04R162-R167 - // ErrStopped: - // one of the etcd nodes stopped from failure injection - // ErrNotCapable: - // capability check has not been done (in the beginning) - case v3rpc.ErrNoLeader, v3rpc.ErrLeaderChanged, v3rpc.ErrNotCapable, v3rpc.ErrStopped, v3rpc.ErrTimeout, - v3rpc.ErrTimeoutDueToLeaderFail, v3rpc.ErrGRPCTimeoutDueToConnectionLost, v3rpc.ErrUnhealthy: + case Is(etcdErr, v3rpc.ErrNoLeader), Is(etcdErr, v3rpc.ErrLeaderChanged), Is(etcdErr, v3rpc.ErrNotCapable), Is(etcdErr, v3rpc.ErrStopped), Is(etcdErr, v3rpc.ErrTimeout), Is(etcdErr, v3rpc.ErrTimeoutDueToLeaderFail), Is(etcdErr, v3rpc.ErrGRPCTimeoutDueToConnectionLost), Is(etcdErr, v3rpc.ErrUnhealthy): return true default: } diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index fb77a29b7b..969db70ec5 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -16,6 +16,7 @@ package etcd import ( "context" "crypto/tls" + stderrors "errors" "fmt" "sync" "time" @@ -140,7 +141,7 @@ func retryRPC(rpcName string, metric prometheus.Counter, etcdRPC func() error) e // 16s = \sum_{n=0}^{6} 0.5*1.5^n return retry.Do(context.Background(), func() error { err := etcdRPC() - if err != nil && errors.Cause(err) != context.Canceled { + if err != nil && !stderrors.Is(errors.Cause(err), context.Canceled) { log.Warn("etcd RPC failed", zap.String("RPC", rpcName), zap.Error(err)) } if metric != nil { @@ -351,7 +352,8 @@ func isRetryableError(rpcName string) retry.IsRetryable { switch rpcName { case EtcdRevoke: - if etcdErr, ok := err.(v3rpc.EtcdError); ok && etcdErr.Code() == codes.NotFound { + var etcdErr v3rpc.EtcdError + if stderrors.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound { // It means the etcd lease is already expired or revoked return false } @@ -566,8 +568,8 @@ func (checker *healthyChecker) update(eps []string) { } if time.Since(lastHealthy) > etcdServerDisconnectedTimeout { // try to reset client endpoint to trigger reconnect - client.(*healthyClient).Client.SetEndpoints([]string{}...) - client.(*healthyClient).Client.SetEndpoints(ep) + client.(*healthyClient).SetEndpoints([]string{}...) + client.(*healthyClient).SetEndpoints(ep) } continue } @@ -614,5 +616,5 @@ func IsHealthy(ctx context.Context, client *clientv3.Client) bool { _, err := client.Get(ctx, healthyPath) // permission denied is OK since proposal goes through consensus to get it // See: https://github.com/etcd-io/etcd/blob/85b640cee793e25f3837c47200089d14a8392dc7/etcdctl/ctlv3/command/ep_command.go#L124 - return err == nil || err == rpctypes.ErrPermissionDenied + return err == nil || stderrors.Is(err, rpctypes.ErrPermissionDenied) } diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index a2c3d992e2..b8e0c62888 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -404,7 +404,11 @@ func (c *CDCEtcdClientImpl) RevokeAllLeases(ctx context.Context, leases map[stri _, err := c.Client.Revoke(ctx, clientv3.LeaseID(lease)) if err == nil { continue - } else if etcdErr := err.(rpctypes.EtcdError); etcdErr.Code() == codes.NotFound { + } else if etcdErr := func() rpctypes.EtcdError { + var target rpctypes.EtcdError + _ = errors.As(err, &target) + return target + }(); etcdErr.Code() == codes.NotFound { // it means the etcd lease is already expired or revoked continue } diff --git a/pkg/eventservice/event_broker.go b/pkg/eventservice/event_broker.go index 984cdc3193..12afbded9b 100644 --- a/pkg/eventservice/event_broker.go +++ b/pkg/eventservice/event_broker.go @@ -206,10 +206,8 @@ func (c *eventBroker) sendDML(remoteID node.ID, batchEvent *event.BatchDMLEvent, lastStartTs uint64 lastCommitTs uint64 ) - for { - if idx >= len(batchEvent.DMLEvents) { - break - } + for idx < len(batchEvent.DMLEvents) { + dml := batchEvent.DMLEvents[idx] if c.hasSyncPointEventsBeforeTs(dml.GetCommitTs(), d) { events := batchEvent.PopHeadDMLEvents(idx) @@ -877,7 +875,8 @@ func (c *eventBroker) sendMsg(ctx context.Context, tMsg *messaging.TargetMessage // Send the message to the dispatcher. err := c.msgSender.SendEvent(tMsg) if err != nil { - _, ok := err.(errors.AppError) + var appError errors.AppError + ok := errors.As(err, &appError) log.Debug("send msg failed, retry it later", zap.Error(err), zap.Stringer("tMsg", tMsg), zap.Bool("castOk", ok)) if strings.Contains(err.Error(), "congested") { log.Debug("send message failed since the message is congested, retry it laster", zap.Error(err)) diff --git a/pkg/eventservice/event_service_test.go b/pkg/eventservice/event_service_test.go index e58508d10a..a64a00d5d6 100644 --- a/pkg/eventservice/event_service_test.go +++ b/pkg/eventservice/event_service_test.go @@ -324,10 +324,8 @@ func (iter *mockEventIterator) Next() (*common.RawKVEntry, bool) { row := iter.events[0] iter.events = iter.events[1:] - isNewTxn := false - if iter.prevCommitTS == 0 || row.StartTs != iter.prevStartTS || row.CRTs != iter.prevCommitTS { - isNewTxn = true - } + isNewTxn := iter.prevCommitTS == 0 || row.StartTs != iter.prevStartTS || row.CRTs != iter.prevCommitTS + iter.prevStartTS = row.StartTs iter.prevCommitTS = row.CRTs iter.rowCount++ diff --git a/pkg/eventservice/scan_window.go b/pkg/eventservice/scan_window.go index 46cb9cffb3..48189d9ac8 100644 --- a/pkg/eventservice/scan_window.go +++ b/pkg/eventservice/scan_window.go @@ -255,7 +255,7 @@ func (c *changefeedStatus) adjustScanInterval(now time.Time, usage memoryUsageSt allowedToIncrease := now.Sub(c.lastAdjustTime.Load()) >= scanIntervalAdjustCooldown && usage.cnt >= minIncreaseSamples && usage.span >= minIncreaseSpan && - !(isAboveTrendStart && isIncreasing) + (!isAboveTrendStart || !isIncreasing) // Determine the new interval based on memory pressure levels. // Priority order: critical > high > trend damping > very low > low diff --git a/pkg/logger/log.go b/pkg/logger/log.go index 84fa2c49d9..1ea37b1c52 100644 --- a/pkg/logger/log.go +++ b/pkg/logger/log.go @@ -16,6 +16,7 @@ package logger import ( "bytes" "context" + stderrors "errors" "io" "os" "strconv" @@ -232,7 +233,7 @@ func initOptionalComponent(op *loggerOp, cfg *Config) error { func ZapErrorFilter(err error, filterErrors ...error) zap.Field { cause := errors.Cause(err) for _, ferr := range filterErrors { - if cause == ferr { + if stderrors.Is(cause, ferr) { return zap.Error(nil) } } @@ -334,7 +335,7 @@ func ErrorFilterContextCanceled(logger *zap.Logger, msg string, fields ...zap.Fi } case zapcore.ErrorType: err, ok := field.Interface.(error) - if ok && errors.Cause(err) == context.Canceled { + if ok && stderrors.Is(errors.Cause(err), context.Canceled) { return } } diff --git a/pkg/messaging/message.go b/pkg/messaging/message.go index 3e1cc0015d..7f4a34a9ae 100644 --- a/pkg/messaging/message.go +++ b/pkg/messaging/message.go @@ -249,7 +249,7 @@ func (r DispatcherRequest) GetChangefeedID() common.ChangeFeedID { } func (r DispatcherRequest) GetFilterConfig() *eventpb.FilterConfig { - return r.DispatcherRequest.FilterConfig + return r.FilterConfig } func (r DispatcherRequest) SyncPointEnabled() bool { @@ -273,15 +273,15 @@ func (r DispatcherRequest) GetBdrMode() bool { } func (r DispatcherRequest) GetIntegrity() *integrity.Config { - if r.DispatcherRequest.Integrity == nil { + if r.Integrity == nil { return &integrity.Config{ IntegrityCheckLevel: util.AddressOf(integrity.CheckLevelNone), CorruptionHandleLevel: util.AddressOf(integrity.CorruptionHandleLevelWarn), } } return &integrity.Config{ - IntegrityCheckLevel: util.AddressOf(r.DispatcherRequest.Integrity.IntegrityCheckLevel), - CorruptionHandleLevel: util.AddressOf(r.DispatcherRequest.Integrity.CorruptionHandleLevel), + IntegrityCheckLevel: util.AddressOf(r.Integrity.IntegrityCheckLevel), + CorruptionHandleLevel: util.AddressOf(r.Integrity.CorruptionHandleLevel), } } diff --git a/pkg/messaging/message_center.go b/pkg/messaging/message_center.go index faa94f555d..ab9a88aca8 100644 --- a/pkg/messaging/message_center.go +++ b/pkg/messaging/message_center.go @@ -16,6 +16,7 @@ package messaging import ( "context" "encoding/json" + stderrors "errors" "fmt" "sync" "time" @@ -473,7 +474,7 @@ func (s *grpcServer) handleConnect(stream proto.MessageService_StreamMessagesSer } return nil }, retry.WithIsRetryableErr(func(err error) bool { - return err != context.DeadlineExceeded + return !stderrors.Is(err, context.DeadlineExceeded) }), retry.WithMaxTries(10)) if err != nil { log.Error("Failed to get remote target", zap.Error(err)) diff --git a/pkg/messaging/remote_target.go b/pkg/messaging/remote_target.go index 51dd973df6..d7e09a3113 100644 --- a/pkg/messaging/remote_target.go +++ b/pkg/messaging/remote_target.go @@ -497,10 +497,7 @@ func (s *remoteMessageTarget) runSendMessages(ctx context.Context, streamType st }() // wait stream ready - for { - if s.isReadyToSend() { - break - } + for !s.isReadyToSend() { select { case <-ctx.Done(): return ctx.Err() @@ -573,10 +570,7 @@ func (s *remoteMessageTarget) runReceiveMessages(ctx context.Context, streamType }() // wait stream ready - for { - if s.isReadyToSend() { - break - } + for !s.isReadyToSend() { select { case <-ctx.Done(): return ctx.Err() diff --git a/pkg/notify/notify_test.go b/pkg/notify/notify_test.go index e1ab3e0c5c..59fc765b3a 100644 --- a/pkg/notify/notify_test.go +++ b/pkg/notify/notify_test.go @@ -87,7 +87,6 @@ func TestContinusStop(t *testing.T) { require.Nil(t, err) } for i := 0; i < n; i++ { - i := i go func() { for { select { diff --git a/pkg/orchestrator/batch_test.go b/pkg/orchestrator/batch_test.go index 9a7267a6f9..675e945067 100644 --- a/pkg/orchestrator/batch_test.go +++ b/pkg/orchestrator/batch_test.go @@ -26,7 +26,7 @@ func TestGetBatchChangeState(t *testing.T) { patchGroupSize := 1000 patchGroup := make([][]DataPatch, patchGroupSize) for i := 0; i < patchGroupSize; i++ { - i := i + patches := []DataPatch{&SingleDataPatch{ Key: util.NewEtcdKey(fmt.Sprintf("/key%d", i)), Func: func(old []byte) (newValue []byte, changed bool, err error) { diff --git a/pkg/orchestrator/etcd_worker_test.go b/pkg/orchestrator/etcd_worker_test.go index ca8303d4d9..413d1d33d2 100644 --- a/pkg/orchestrator/etcd_worker_test.go +++ b/pkg/orchestrator/etcd_worker_test.go @@ -16,6 +16,7 @@ package orchestrator import ( "context" "encoding/json" + stderrors "errors" "regexp" "strconv" "strings" @@ -272,8 +273,8 @@ func TestEtcdSum(t *testing.T) { } err = errg.Wait() - if err != nil && (errors.Cause(err) == context.DeadlineExceeded || - errors.Cause(err) == context.Canceled || + if err != nil && (stderrors.Is(errors.Cause(err), context.DeadlineExceeded) || + stderrors.Is(errors.Cause(err), context.Canceled) || strings.Contains(err.Error(), "etcdserver: request timeout")) { return } diff --git a/pkg/pdutil/api_client.go b/pkg/pdutil/api_client.go index 3abbd793ad..5c116299a8 100644 --- a/pkg/pdutil/api_client.go +++ b/pkg/pdutil/api_client.go @@ -19,6 +19,7 @@ import ( "crypto/tls" "encoding/hex" "encoding/json" + stderrors "errors" "fmt" "io" "net/http" @@ -187,8 +188,8 @@ func (pc *pdAPIClient) UpdateMetaLabel(ctx context.Context) error { retry.WithBackoffBaseDelay(200), retry.WithBackoffMaxDelay(4000), retry.WithIsRetryableErr(func(err error) bool { - switch errors.Cause(err) { - case context.Canceled: + switch { + case stderrors.Is(errors.Cause(err), context.Canceled): return false } return true @@ -364,8 +365,8 @@ func (pc *pdAPIClient) ListGcServiceSafePoint( } return nil }, retry.WithMaxTries(defaultMaxRetry), retry.WithIsRetryableErr(func(err error) bool { - switch errors.Cause(err) { - case context.Canceled: + switch { + case stderrors.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/pdutil/api_client_test.go b/pkg/pdutil/api_client_test.go index 0b8df17758..d308a04b54 100644 --- a/pkg/pdutil/api_client_test.go +++ b/pkg/pdutil/api_client_test.go @@ -241,13 +241,14 @@ func TestScanRegions(t *testing.T) { i = 0 handler = func() RegionsInfo { - if i == 0 { + switch i { + case 0: i++ return RegionsInfo{Regions: regions[2:3]} - } else if i == 1 { + case 1: i++ return RegionsInfo{Regions: regions[3:4]} - } else if i == 2 { + case 2: i++ return RegionsInfo{Regions: regions[4:5]} } diff --git a/pkg/redo/reader/file.go b/pkg/redo/reader/file.go index ef5da20027..56229a8292 100644 --- a/pkg/redo/reader/file.go +++ b/pkg/redo/reader/file.go @@ -20,6 +20,7 @@ import ( "container/heap" "context" "encoding/binary" + stderrors "errors" "io" "math" "net/url" @@ -225,7 +226,7 @@ func readAllFromBuffer(buf []byte) (logHeap, error) { for { rl, err := r.Read() if err != nil { - if err != io.EOF { + if !stderrors.Is(err, io.EOF) { return nil, err } break @@ -327,7 +328,7 @@ func (r *reader) Read() (*pevent.RedoLog, error) { lenField, err := readInt64(r.br) if err != nil { - if err == io.EOF { + if stderrors.Is(err, io.EOF) { return nil, err } return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) @@ -337,7 +338,7 @@ func (r *reader) Read() (*pevent.RedoLog, error) { data := make([]byte, recBytes+padBytes) _, err = io.ReadFull(r.br, data) if err != nil { - if err == io.EOF || err == io.ErrUnexpectedEOF { + if stderrors.Is(err, io.EOF) || stderrors.Is(err, io.ErrUnexpectedEOF) { log.Warn("read redo log have unexpected io error", zap.String("fileName", r.fileName), zap.Error(err)) diff --git a/pkg/redo/reader/reader.go b/pkg/redo/reader/reader.go index a687cf6a8f..27933a1a7f 100644 --- a/pkg/redo/reader/reader.go +++ b/pkg/redo/reader/reader.go @@ -223,7 +223,7 @@ func (l *LogReader) runReader(egCtx context.Context, cfg *readerConfig) error { // read next and push again rl, err := fileReaders[item.idx].Read() if err != nil { - if err != io.EOF { + if !errors.Is(err, io.EOF) { return errors.Trace(err) } continue @@ -338,7 +338,7 @@ func newLogHeap(fileReaders []fileReader) (logHeap, error) { for i := 0; i < len(fileReaders); i++ { rl, err := fileReaders[i].Read() if err != nil { - if err != io.EOF { + if !errors.Is(err, io.EOF) { return nil, err } continue diff --git a/pkg/redo/reader/reader_test.go b/pkg/redo/reader/reader_test.go index 624b3a4820..8cd1bc496e 100644 --- a/pkg/redo/reader/reader_test.go +++ b/pkg/redo/reader/reader_test.go @@ -59,7 +59,8 @@ func genLogFile( return fileName })) require.Nil(t, err) - if logType == redo.RedoRowLogFileType { + switch logType { + case redo.RedoRowLogFileType: // generate unsorted logs for ts := maxCommitTs; ts >= minCommitTs; ts-- { event := &pevent.RedoRowEvent{ @@ -74,7 +75,7 @@ func genLogFile( _, err = w.Write(rawData) require.Nil(t, err) } - } else if logType == redo.RedoDDLLogFileType { + case redo.RedoDDLLogFileType: event := &pevent.DDLEvent{ FinishedTs: maxCommitTs, TableInfo: &common.TableInfo{}, diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index dfc11ec8f4..73aa4d18a8 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -15,6 +15,7 @@ package retry import ( "context" + stderrors "errors" "math" "testing" "time" @@ -64,8 +65,8 @@ func TestIsRetryable(t *testing.T) { } err := Do(context.Background(), f, WithMaxTries(3), WithIsRetryableErr(func(err error) bool { - switch errors.Cause(err) { - case context.Canceled: + switch { + case stderrors.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/scheduler/replica/replication.go b/pkg/scheduler/replica/replication.go index 0bcf8cd583..2cab19c294 100644 --- a/pkg/scheduler/replica/replication.go +++ b/pkg/scheduler/replica/replication.go @@ -357,7 +357,7 @@ func (db *replicationDB[T, R]) GetCheckerStat() string { stat.WriteString(" ") } stat.WriteString(GetGroupName(groupID)) - stat.WriteString(fmt.Sprintf("(%s)", group.checker.Name())) + fmt.Fprintf(&stat, "(%s)", group.checker.Name()) stat.WriteString(": [") stat.WriteString(group.checker.Stat()) stat.WriteString("] ") diff --git a/pkg/security/sasl_test.go b/pkg/security/sasl_test.go index ad8546965b..71f3c90754 100644 --- a/pkg/security/sasl_test.go +++ b/pkg/security/sasl_test.go @@ -76,7 +76,6 @@ func TestSASLMechanismFromString(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() mechanism, err := SASLMechanismFromString(test.s) @@ -129,7 +128,6 @@ func TestAuthTypeFromString(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/security/scram_client.go b/pkg/security/scram_client.go index 56c9cea117..481ee545e4 100644 --- a/pkg/security/scram_client.go +++ b/pkg/security/scram_client.go @@ -37,11 +37,11 @@ type XDGSCRAMClient struct { // Begin xdg scram client Begin func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error) { - x.Client, err = x.HashGeneratorFcn.NewClient(userName, password, authzID) + x.Client, err = x.NewClient(userName, password, authzID) if err != nil { return err } - x.ClientConversation = x.Client.NewConversation() + x.ClientConversation = x.NewConversation() return nil } diff --git a/pkg/sink/codec/common/config.go b/pkg/sink/codec/common/config.go index 0033f4acc3..83486f3da3 100644 --- a/pkg/sink/codec/common/config.go +++ b/pkg/sink/codec/common/config.go @@ -182,7 +182,7 @@ type urlConfig struct { // can be `json` and `avro`, default to `json`. EncodingFormatType *string `form:"encoding-format"` - // If both `EnableTiDBExtension` and `OutputRowKey` is set to true, row key will be outputed in the tidb-extension field. + // If both `EnableTiDBExtension` and `OutputRowKey` is set to true, row key will be outputted in the tidb-extension field. // This is only used for the **canal-json** protocol. OutputRowKey *bool `form:"output-row-key"` } @@ -353,7 +353,7 @@ func (c *Config) WithChangefeedID(id common.ChangeFeedID) *Config { // Validate the Config func (c *Config) Validate() error { if c.EnableTiDBExtension && - !(c.Protocol == config.ProtocolCanalJSON || c.Protocol == config.ProtocolAvro || c.Protocol == config.ProtocolDebezium) { + (c.Protocol != config.ProtocolCanalJSON && c.Protocol != config.ProtocolAvro && c.Protocol != config.ProtocolDebezium) { log.Warn("ignore invalid config, enable-tidb-extension"+ "only supports canal-json/avro/debezium protocol", zap.Bool("enableTidbExtension", c.EnableTiDBExtension), @@ -398,8 +398,8 @@ func (c *Config) Validate() error { } if c.EnableRowChecksum { - if !(c.EnableTiDBExtension && c.AvroDecimalHandlingMode == DecimalHandlingModeString && - c.AvroBigintUnsignedHandlingMode == BigintUnsignedHandlingModeString) { + if !c.EnableTiDBExtension || c.AvroDecimalHandlingMode != DecimalHandlingModeString || + c.AvroBigintUnsignedHandlingMode != BigintUnsignedHandlingModeString { return errors.ErrCodecInvalidConfig.GenWithStack( `Avro protocol with row level checksum, should set "%s" to "%s", and set "%s" to "%s" and "%s" to "%s"`, diff --git a/pkg/sink/codec/common/helper.go b/pkg/sink/codec/common/helper.go index e92fc9a102..b90332674b 100644 --- a/pkg/sink/codec/common/helper.go +++ b/pkg/sink/codec/common/helper.go @@ -16,6 +16,7 @@ package common import ( "context" "database/sql" + stderrors "errors" "fmt" "math" "strconv" @@ -268,7 +269,8 @@ func queryRowChecksumAux( query := fmt.Sprintf("set @@tidb_snapshot=%d", commitTs) _, err := conn.ExecContext(ctx, query) if err != nil { - mysqlErr, ok := errors.Cause(err).(*mysqlDriver.MySQLError) + mysqlErr := &mysqlDriver.MySQLError{} + ok := stderrors.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { @@ -324,7 +326,8 @@ func MustSnapshotQuery( query := fmt.Sprintf("set @@tidb_snapshot=%d", commitTs) _, err = conn.ExecContext(ctx, query) if err != nil { - mysqlErr, ok := errors.Cause(err).(*mysqlDriver.MySQLError) + mysqlErr := &mysqlDriver.MySQLError{} + ok := stderrors.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { diff --git a/pkg/sink/codec/csv/csv_decoder.go b/pkg/sink/codec/csv/csv_decoder.go index 05109c687a..461356ccf6 100644 --- a/pkg/sink/codec/csv/csv_decoder.go +++ b/pkg/sink/codec/csv/csv_decoder.go @@ -110,7 +110,7 @@ func (b *decoder) HasNext() (common.MessageType, bool) { err := b.parser.ReadRow() if err != nil { b.closed = true - if errors.Cause(err) == io.EOF { + if errors.Is(errors.Cause(err), io.EOF) { return common.MessageTypeUnknown, false } log.Panic("read csv row failed", zap.Error(err)) diff --git a/pkg/sink/codec/csv/csv_message.go b/pkg/sink/codec/csv/csv_message.go index 1fb2953584..ac27d33ba4 100644 --- a/pkg/sink/codec/csv/csv_message.go +++ b/pkg/sink/codec/csv/csv_message.go @@ -270,7 +270,7 @@ func (c *csvMessage) formatValue(value any, strBuilder *strings.Builder) { c.formatWithEscapes(v, strBuilder) } default: - strBuilder.WriteString(fmt.Sprintf("%v", v)) + fmt.Fprintf(strBuilder, "%v", v) } } diff --git a/pkg/sink/codec/csv/csv_message_test.go b/pkg/sink/codec/csv/csv_message_test.go index ad761220f7..43f163bcfe 100644 --- a/pkg/sink/codec/csv/csv_message_test.go +++ b/pkg/sink/codec/csv/csv_message_test.go @@ -929,11 +929,12 @@ func TestRowChangeEventConversion(t *testing.T) { } e.TableInfo = commonType.WrapTableInfo("test", tidbTableInfo) - if idx%3 == 0 { // delete operation + switch idx % 3 { + case 0: // delete operation e.Event.PreRow = chunk.MutRowFromValues(cols...).ToRow() - } else if idx%3 == 1 { // insert operation + case 1: // insert operation e.Event.Row = chunk.MutRowFromValues(cols...).ToRow() - } else { // update operation + default: // update operation e.Event.PreRow = chunk.MutRowFromValues(cols...).ToRow() e.Event.Row = chunk.MutRowFromValues(cols...).ToRow() } diff --git a/pkg/sink/kafka/options_test.go b/pkg/sink/kafka/options_test.go index 36c2f4e669..42f127f3e1 100644 --- a/pkg/sink/kafka/options_test.go +++ b/pkg/sink/kafka/options_test.go @@ -15,6 +15,7 @@ package kafka import ( "context" + stderrors "errors" "fmt" "net/url" "strconv" @@ -832,7 +833,8 @@ func TestAdjustOptionsKeepAlive(t *testing.T) { err := adjustOptions(ctx, adminClient, o, adminClient.GetDefaultMockTopicName()) require.Error(t, err) // The error should be a type conversion error. - _, ok := errors.Cause(err).(*strconv.NumError) + numError := &strconv.NumError{} + ok := stderrors.As(errors.Cause(err), &numError) require.True(t, ok, "error should be of type strconv.NumError") }) diff --git a/pkg/sink/kafka/sarama_config_test.go b/pkg/sink/kafka/sarama_config_test.go index 6c85146117..e8711a1440 100644 --- a/pkg/sink/kafka/sarama_config_test.go +++ b/pkg/sink/kafka/sarama_config_test.go @@ -257,7 +257,6 @@ func TestApplySASL(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() options := NewOptions() @@ -328,7 +327,6 @@ func TestApplyTLS(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() options := NewOptions() diff --git a/pkg/sink/mysql/helper.go b/pkg/sink/mysql/helper.go index f795d8dff1..1953c1e7c1 100644 --- a/pkg/sink/mysql/helper.go +++ b/pkg/sink/mysql/helper.go @@ -17,6 +17,7 @@ import ( "context" "database/sql" "encoding/base64" + stderrors "errors" "fmt" "net" "strconv" @@ -70,8 +71,8 @@ func CheckIfBDRModeIsSupported(ctx context.Context, db *sql.DB) (bool, error) { query := "SET SESSION tidb_cdc_write_source = 1" _, err := db.ExecContext(ctx, query) if err != nil { - if mysqlErr, ok := errors.Cause(err).(*dmysql.MySQLError); ok && - mysqlErr.Number == mysql.ErrUnknownSystemVariable { + mysqlErr := &dmysql.MySQLError{} + if stderrors.As(errors.Cause(err), &mysqlErr) { return false, nil } return false, err @@ -189,7 +190,8 @@ func GetTestDB(dbConfig *dmysql.Config) (*sql.DB, error) { testDB, err := CreateMysqlDBConn(dbConfig.FormatDSN()) if err != nil { // If access is denied and password is encoded by base64, try to decoded password. - if mysqlErr, ok := errors.Cause(err).(*dmysql.MySQLError); ok && mysqlErr.Number == mysql.ErrAccessDenied { + mysqlErr := &dmysql.MySQLError{} + if stderrors.As(errors.Cause(err), &mysqlErr) { if dePassword, decodeErr := base64.StdEncoding.DecodeString(password); decodeErr == nil && string(dePassword) != password { dbConfig.Passwd = string(dePassword) testDB, err = CreateMysqlDBConn(dbConfig.FormatDSN()) @@ -309,7 +311,7 @@ func checkCharsetSupport(db *sql.DB, charsetName string) (bool, error) { querySQL := "select character_set_name from information_schema.character_sets " + "where character_set_name = '" + charsetName + "';" err = db.QueryRowContext(context.Background(), querySQL).Scan(&characterSetName) - if err != nil && err != sql.ErrNoRows { + if err != nil && !stderrors.Is(err, sql.ErrNoRows) { return false, cerror.WrapError(cerror.ErrMySQLQueryError, err) } if err != nil { @@ -470,7 +472,8 @@ func isRetryableDMLError(err error) bool { } func getSQLErrCode(err error) (errors.ErrCode, bool) { - mysqlErr, ok := errors.Cause(err).(*dmysql.MySQLError) + mysqlErr := &dmysql.MySQLError{} + ok := stderrors.As(errors.Cause(err), &mysqlErr) if !ok { return -1, false } diff --git a/pkg/sink/mysql/mysql_writer.go b/pkg/sink/mysql/mysql_writer.go index 6d78c54c0c..c5e3cb31f6 100644 --- a/pkg/sink/mysql/mysql_writer.go +++ b/pkg/sink/mysql/mysql_writer.go @@ -16,6 +16,7 @@ package mysql import ( "context" "database/sql" + stderrors "errors" "strings" "sync" "time" @@ -260,7 +261,7 @@ func (w *Writer) checkIsDuplicateEntryError(err error) bool { if err == nil { return false } - if errors.Cause(err) == cerror.ErrMySQLDuplicateEntry || + if stderrors.Is(errors.Cause(err), cerror.ErrMySQLDuplicateEntry) || strings.Contains(err.Error(), "Duplicate entry") { if !w.isInErrorCausedSafeMode { w.isInErrorCausedSafeMode = true diff --git a/pkg/sink/mysql/mysql_writer_ddl.go b/pkg/sink/mysql/mysql_writer_ddl.go index 6b06d71781..6607847e3a 100644 --- a/pkg/sink/mysql/mysql_writer_ddl.go +++ b/pkg/sink/mysql/mysql_writer_ddl.go @@ -228,7 +228,7 @@ func (w *Writer) execDDLWithMaxRetries(event *commonEvent.DDLEvent) error { // If the error is ignorable, we will ignore the error directly. return nil } - if w.cfg.IsTiDB && ddlCreateTime != "" && errors.Cause(err) == mysql.ErrInvalidConn { + if w.cfg.IsTiDB && ddlCreateTime != "" && errors.Is(errors.Cause(err), mysql.ErrInvalidConn) { log.Warn("Wait the asynchronous ddl to synchronize", zap.String("ddl", event.Query), zap.String("ddlCreateTime", ddlCreateTime), zap.Uint64("startTs", event.GetStartTs()), zap.Uint64("commitTs", event.GetCommitTs()), zap.String("readTimeout", w.cfg.ReadTimeout), zap.Error(err)) diff --git a/pkg/sink/mysql/mysql_writer_dml_exec.go b/pkg/sink/mysql/mysql_writer_dml_exec.go index 8a25ceb236..954fca29a4 100644 --- a/pkg/sink/mysql/mysql_writer_dml_exec.go +++ b/pkg/sink/mysql/mysql_writer_dml_exec.go @@ -17,6 +17,7 @@ import ( "context" "database/sql" "database/sql/driver" + stderrors "errors" "fmt" "strings" "time" @@ -158,7 +159,7 @@ func (w *Writer) sequenceExecute( if execError != nil { log.Error("ExecContext", zap.Error(execError), zap.Any("dmls", dmls), zap.Int("writerID", w.id)) if rbErr := tx.Rollback(); rbErr != nil { - if errors.Cause(rbErr) != context.Canceled { + if !stderrors.Is(errors.Cause(rbErr), context.Canceled) { log.Warn("failed to rollback txn", zap.Error(rbErr), zap.Int("writerID", w.id)) } } diff --git a/pkg/sink/mysql/mysql_writer_dml_test.go b/pkg/sink/mysql/mysql_writer_dml_test.go index d66585c0f7..8685fb064d 100644 --- a/pkg/sink/mysql/mysql_writer_dml_test.go +++ b/pkg/sink/mysql/mysql_writer_dml_test.go @@ -829,7 +829,6 @@ func TestAllRowInSameSafeMode(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := allRowInSameSafeMode(tt.safemode, tt.events) diff --git a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go index 5bbaefa916..d11646b0f9 100644 --- a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go +++ b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go @@ -17,6 +17,7 @@ import ( "context" "database/sql" "encoding/json" + stderrors "errors" "sync" dmysql "github.com/go-sql-driver/mysql" @@ -41,7 +42,8 @@ func CheckActiveActiveSyncStatsSupported(ctx context.Context, db *sql.DB) (bool, row := db.QueryRowContext(ctx, "SELECT @@tidb_cdc_active_active_sync_stats;") var v sql.NullString if err := row.Scan(&v); err != nil { - if mysqlErr, ok := errors.Cause(err).(*dmysql.MySQLError); ok && + mysqlErr := &dmysql.MySQLError{} + if stderrors.As(errors.Cause(err), &mysqlErr) && mysqlErr.Number == tidbmysql.ErrUnknownSystemVariable { return false, nil } diff --git a/pkg/sink/mysql/mysql_writer_for_syncpoint.go b/pkg/sink/mysql/mysql_writer_for_syncpoint.go index a931dd4e15..cf3e788afa 100644 --- a/pkg/sink/mysql/mysql_writer_for_syncpoint.go +++ b/pkg/sink/mysql/mysql_writer_for_syncpoint.go @@ -113,7 +113,7 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { builder.WriteString("' and changefeed = '") builder.WriteString(w.ChangefeedID.String()) builder.WriteString("' and created_at < (NOW() - INTERVAL ") - builder.WriteString(fmt.Sprintf("%.2f", w.cfg.SyncPointRetention.Seconds())) + fmt.Fprintf(&builder, "%.2f", w.cfg.SyncPointRetention.Seconds()) builder.WriteString(" SECOND)") query := builder.String() diff --git a/pkg/sink/mysql/mysql_writer_test.go b/pkg/sink/mysql/mysql_writer_test.go index 7b169aaab6..bda2a959e9 100644 --- a/pkg/sink/mysql/mysql_writer_test.go +++ b/pkg/sink/mysql/mysql_writer_test.go @@ -646,7 +646,7 @@ func TestMysqlWriter_AsyncDDL(t *testing.T) { } { - // ensure the dml can be writen succesfully before add index finished + // ensure the dml can be written successfully before add index finished dmlEvent := helper.DML2Event("test", "t", "insert into t values (3, 'test3');") dmlEvent.CommitTs = 3 dmlEvent.ReplicatingTs = 4 diff --git a/pkg/sink/mysql/sql_builder.go b/pkg/sink/mysql/sql_builder.go index 54e0ec75da..17aeaf0b5a 100644 --- a/pkg/sink/mysql/sql_builder.go +++ b/pkg/sink/mysql/sql_builder.go @@ -45,12 +45,12 @@ func (d *preparedDMLs) LogWithoutValues() string { // Calculate total count totalCount := len(d.sqls) var logBuilder strings.Builder - logBuilder.WriteString(fmt.Sprintf("Total SQL Count: %d, Row Count: %d,", totalCount, d.rowCount)) + fmt.Fprintf(&logBuilder, "Total SQL Count: %d, Row Count: %d,", totalCount, d.rowCount) // Build SQL statements and arguments section for i, sql := range d.sqls { // Add formatted SQL and args to log content - logBuilder.WriteString(fmt.Sprintf("[%03d] Query: %s,", i+1, sql)) + fmt.Fprintf(&logBuilder, "[%03d] Query: %s,", i+1, sql) } logBuilder.WriteString("End") @@ -72,7 +72,7 @@ func (d *preparedDMLs) LogDebug(events []*commonEvent.DMLEvent, writerID int) { // Build complete log content in a single string var logBuilder strings.Builder - logBuilder.WriteString(fmt.Sprintf("Total SQL Count: %d, Row Count: %d, Writer ID: %d :", totalCount, d.rowCount, writerID)) + fmt.Fprintf(&logBuilder, "Total SQL Count: %d, Row Count: %d, Writer ID: %d :", totalCount, d.rowCount, writerID) // Build SQL statements and arguments section for i, sql := range d.sqls { @@ -81,8 +81,8 @@ func (d *preparedDMLs) LogDebug(events []*commonEvent.DMLEvent, writerID int) { args = d.values[i] } - logBuilder.WriteString(fmt.Sprintf("[%03d] Query: %s,", i+1, sql)) - logBuilder.WriteString(fmt.Sprintf(" Args: %s,", util.RedactArgs(args))) + fmt.Fprintf(&logBuilder, "[%03d] Query: %s,", i+1, sql) + fmt.Fprintf(&logBuilder, " Args: %s,", util.RedactArgs(args)) } // Build timestamp information @@ -93,8 +93,8 @@ func (d *preparedDMLs) LogDebug(events []*commonEvent.DMLEvent, writerID int) { startTsList[i] = event.GetStartTs() } - logBuilder.WriteString(fmt.Sprintf("CommitTs: %v,", commitTsList)) - logBuilder.WriteString(fmt.Sprintf("StartTs: %v,", startTsList)) + fmt.Fprintf(&logBuilder, "CommitTs: %v,", commitTsList) + fmt.Fprintf(&logBuilder, "StartTs: %v,", startTsList) logBuilder.WriteString("End") // Output the complete log content in a single call @@ -355,7 +355,7 @@ func buildActiveActiveUpsertSQL( if i > 0 { builder.WriteString(",") } - builder.WriteString(fmt.Sprintf("%s = IF((%s), VALUES(%s), %s)", quoted, cond, quoted, quoted)) + fmt.Fprintf(&builder, "%s = IF((%s), VALUES(%s), %s)", quoted, cond, quoted, quoted) } return builder.String(), args, common.RowTypeInsert diff --git a/pkg/tcpserver/tcp_server.go b/pkg/tcpserver/tcp_server.go index d02a5f326d..0f67753d94 100644 --- a/pkg/tcpserver/tcp_server.go +++ b/pkg/tcpserver/tcp_server.go @@ -16,6 +16,7 @@ package tcpserver import ( "context" "crypto/tls" + stderrors "errors" "net" "strings" "time" @@ -127,7 +128,7 @@ func (s *tcpServerImpl) Run(ctx context.Context) (err error) { errg.Go(func() error { err := s.mux.Serve() - if err == cmux.ErrServerClosed { + if stderrors.Is(err, cmux.ErrServerClosed) { return cerror.ErrTCPServerClosed.GenWithStackByArgs() } if err != nil && strings.Contains(err.Error(), "use of closed network connection") { diff --git a/pkg/upstream/upstream.go b/pkg/upstream/upstream.go index 7e61c1466a..9e5fa3cd66 100644 --- a/pkg/upstream/upstream.go +++ b/pkg/upstream/upstream.go @@ -138,10 +138,8 @@ func CreateTiStore(ctx context.Context, urls string, credential *security.Creden } func isCreateTiStoreRetryable(ctx context.Context, err error) bool { - switch errors.Cause(err) { - case context.Canceled: - // Only stop retrying if the caller's context is canceled. - // Otherwise treat it as transient (e.g. internal client cancellation). + switch { + case errors.Is(errors.Cause(err), context.Canceled): return ctx.Err() == nil } return true @@ -374,7 +372,7 @@ func (up *Upstream) registerTopologyInfo(ctx context.Context, cfg *NodeTopologyC } // register capture info to upstream pd key := fmt.Sprintf(topologyTiCDC, cfg.GCServiceID, cfg.AdvertiseAddr) - value, err := cfg.Info.Marshal() + value, err := cfg.Marshal() if err != nil { return errors.Trace(err) } diff --git a/pkg/version/check_test.go b/pkg/version/check_test.go index a6a379fdc1..25564c07ad 100644 --- a/pkg/version/check_test.go +++ b/pkg/version/check_test.go @@ -54,7 +54,7 @@ func (m *mockPDClient) ServeHTTP(resp http.ResponseWriter, _ *http.Request) { } if m.getPDVersion != nil { - _, _ = resp.Write([]byte(fmt.Sprintf(`{"version":"%s"}`, m.getPDVersion()))) + _, _ = fmt.Fprintf(resp, `{"version":"%s"}`, m.getPDVersion()) } } diff --git a/pkg/workerpool/async_pool_test.go b/pkg/workerpool/async_pool_test.go index 68ca2c015d..77e26fcf08 100644 --- a/pkg/workerpool/async_pool_test.go +++ b/pkg/workerpool/async_pool_test.go @@ -15,6 +15,7 @@ package workerpool import ( "context" + stderrors "errors" "math/rand" "sync" "sync/atomic" @@ -124,7 +125,7 @@ func runForDuration(ctx context.Context, duration time.Duration, f func(ctx cont case <-ctx.Done(): return ctx.Err() case err := <-errCh: - if errors.Cause(err) == context.DeadlineExceeded { + if stderrors.Is(errors.Cause(err), context.DeadlineExceeded) { return nil } return errors.Trace(err) diff --git a/server/module_election.go b/server/module_election.go index 6b0df0e266..7b6ab54c4f 100644 --- a/server/module_election.go +++ b/server/module_election.go @@ -156,7 +156,7 @@ func (e *elector) campaignCoordinator(ctx context.Context) error { // use a new context to prevent the context from being cancelled. resignCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second) if resignErr := e.resign(resignCtx); resignErr != nil { - if errors.Cause(resignErr) != context.DeadlineExceeded { + if !errors.Is(errors.Cause(resignErr), context.DeadlineExceeded) { log.Info("coordinator resign failed", zap.String("nodeID", nodeID), zap.Error(resignErr), zap.Int64("coordinatorVersion", coordinatorVersion)) cancel() @@ -176,7 +176,7 @@ func (e *elector) campaignCoordinator(ctx context.Context) error { // we should keep the loop running to try to election coordinator again. // So, regardless of the cause of the context.Canceled, we should not exit here. // We should proceed to the next iteration of the loop, allowing subsequent logic to make the determination. - if err != nil && err != context.Canceled { + if err != nil && !errors.Is(err, context.Canceled) { log.Warn("coordinator exited report error", zap.String("nodeID", nodeID), zap.Int64("coordinatorVersion", coordinatorVersion), zap.Error(err)) @@ -203,7 +203,7 @@ func (e *elector) campaignLogCoordinator(ctx context.Context) error { } err := rl.Wait(ctx) if err != nil { - if errors.Cause(err) == context.Canceled { + if errors.Is(errors.Cause(err), context.Canceled) { return nil } return errors.Trace(err) diff --git a/server/server.go b/server/server.go index e603f81b45..f5c9b5212b 100644 --- a/server/server.go +++ b/server/server.go @@ -376,7 +376,7 @@ func (c *server) Run(ctx context.Context) error { go func() { <-gctx.Done() time.Sleep(GracefulShutdownTimeout) - ch <- errors.ErrTimeout.FastGenByArgs("gracefull shutdown timeout") + ch <- errors.ErrTimeout.FastGenByArgs("graceful shutdown timeout") }() go func() { ch <- g.Wait() diff --git a/tests/integration_tests/api_v2/cases.go b/tests/integration_tests/api_v2/cases.go index 18a59fc08d..c0e489b598 100644 --- a/tests/integration_tests/api_v2/cases.go +++ b/tests/integration_tests/api_v2/cases.go @@ -416,7 +416,7 @@ func testSetLogLevel(ctx context.Context, client *CDCRESTClient) error { } func assertEmptyResponseBody(resp *Result) { - if "{}" != string(resp.body) { + if string(resp.body) != "{}" { log.Panic("failed call api", zap.String("body", string(resp.body))) } } diff --git a/tests/integration_tests/bank/case.go b/tests/integration_tests/bank/case.go index 4437afb37d..a6d880dc1d 100644 --- a/tests/integration_tests/bank/case.go +++ b/tests/integration_tests/bank/case.go @@ -17,6 +17,7 @@ import ( "bufio" "context" "database/sql" + stderrors "errors" "fmt" "io" "math/rand" @@ -561,7 +562,7 @@ func run( return ctx.Err() default: err := workload() - if err != nil && errors.Cause(err) != context.Canceled { + if err != nil && !stderrors.Is(errors.Cause(err), context.Canceled) { log.Warn("workload failed", zap.Error(err)) } diff --git a/tests/integration_tests/cdc/cdc.go b/tests/integration_tests/cdc/cdc.go index 3a2487ee3d..b5ab944b26 100644 --- a/tests/integration_tests/cdc/cdc.go +++ b/tests/integration_tests/cdc/cdc.go @@ -14,6 +14,7 @@ package main import ( + stderrors "errors" "flag" "os" @@ -27,9 +28,9 @@ import ( func main() { cfg := util.NewConfig() err := cfg.Parse(os.Args[1:]) - switch errors.Cause(err) { - case nil: - case flag.ErrHelp: + switch { + case errors.Cause(err) == nil: + case stderrors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/cdc/dailytest/case.go b/tests/integration_tests/cdc/dailytest/case.go index 6b0ddb150a..50524a4132 100644 --- a/tests/integration_tests/cdc/dailytest/case.go +++ b/tests/integration_tests/cdc/dailytest/case.go @@ -275,7 +275,7 @@ func caseUpdateWhileDroppingCol(db *sql.DB) { if i != 0 { builder.WriteRune(',') } - builder.WriteString(fmt.Sprintf("col%d VARCHAR(50) NOT NULL", i)) + fmt.Fprintf(&builder, "col%d VARCHAR(50) NOT NULL", i) } createSQL := fmt.Sprintf(` CREATE TABLE many_cols ( @@ -290,7 +290,7 @@ CREATE TABLE many_cols ( if i != 0 { builder.WriteRune(',') } - builder.WriteString(fmt.Sprintf("col%d", i)) + fmt.Fprintf(&builder, "col%d", i) } cols := builder.String() diff --git a/tests/integration_tests/cdc/dailytest/parser.go b/tests/integration_tests/cdc/dailytest/parser.go index 7ff2840309..217a0d2e27 100644 --- a/tests/integration_tests/cdc/dailytest/parser.go +++ b/tests/integration_tests/cdc/dailytest/parser.go @@ -56,7 +56,8 @@ func (col *column) parseRule(kvs []string) { key := strings.TrimSpace(kvs[0]) value := strings.TrimSpace(kvs[1]) - if key == "range" { + switch key { + case "range": fields := strings.Split(value, ",") if len(fields) == 1 { col.min = strings.TrimSpace(fields[0]) @@ -64,13 +65,13 @@ func (col *column) parseRule(kvs []string) { col.min = strings.TrimSpace(fields[0]) col.max = strings.TrimSpace(fields[1]) } - } else if key == "step" { + case "step": var err error col.step, err = strconv.ParseInt(value, 10, 64) if err != nil { log.S().Fatal(err) } - } else if key == "set" { + case "set": fields := strings.Split(value, ",") for _, field := range fields { col.set = append(col.set, strings.TrimSpace(field)) diff --git a/tests/integration_tests/complex_transaction/workload.go b/tests/integration_tests/complex_transaction/workload.go index 258124e4be..8d7c912ffb 100644 --- a/tests/integration_tests/complex_transaction/workload.go +++ b/tests/integration_tests/complex_transaction/workload.go @@ -16,6 +16,7 @@ package main import ( "context" "database/sql" + stderrors "errors" "fmt" "math/rand" "sync/atomic" @@ -204,7 +205,7 @@ func (w *WorkloadExecutor) cancelOrderTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT order_id, user_id, total_amount FROM orders WHERE status = 0 ORDER BY RAND() LIMIT 1`).Scan(&orderID, &userID, &totalAmount) - if err == sql.ErrNoRows { + if stderrors.Is(err, sql.ErrNoRows) { // No active orders to cancel return tx.Commit() } @@ -488,7 +489,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id, user_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID, &postUserID) - if err == sql.ErrNoRows { + if stderrors.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { @@ -521,7 +522,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID) - if err == sql.ErrNoRows { + if stderrors.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { diff --git a/tests/integration_tests/default_value/main.go b/tests/integration_tests/default_value/main.go index 4e609fae16..4d4fa06cb1 100644 --- a/tests/integration_tests/default_value/main.go +++ b/tests/integration_tests/default_value/main.go @@ -16,6 +16,7 @@ package main import ( "context" "database/sql" + stderrors "errors" "flag" "fmt" "os" @@ -52,9 +53,9 @@ var finishIdx atomic.Int32 func main() { cfg := util.NewConfig() err := cfg.Parse(os.Args[1:]) - switch errors.Cause(err) { - case nil: - case flag.ErrHelp: + switch { + case errors.Cause(err) == nil: + case stderrors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) @@ -875,7 +876,7 @@ func testMultiDDLs(srcs []*sql.DB, wg *sync.WaitGroup) { }() var wg1 sync.WaitGroup - // seperate every case to different table + // separate every case to different table for i, unit := range Units { wg1.Add(1) diff --git a/tests/integration_tests/many_pk_or_uk/main.go b/tests/integration_tests/many_pk_or_uk/main.go index 152e40acab..264ff2bb99 100644 --- a/tests/integration_tests/many_pk_or_uk/main.go +++ b/tests/integration_tests/many_pk_or_uk/main.go @@ -15,6 +15,7 @@ package main import ( "database/sql" + stderrors "errors" "flag" "fmt" "math" @@ -29,9 +30,9 @@ import ( func main() { cfg := util.NewConfig() err := cfg.Parse(os.Args[1:]) - switch errors.Cause(err) { - case nil: - case flag.ErrHelp: + switch { + case errors.Cause(err) == nil: + case stderrors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) @@ -108,7 +109,7 @@ func runPKorUKcases(db *sql.DB) { for j, pkOrUK := range []string{"UNIQUE NOT NULL", "PRIMARY KEY"} { g.Add(1) tableName := fmt.Sprintf("pk_or_uk_%d_%d", i, j) - pkOrUK := pkOrUK + c := c go func() { sql := fmt.Sprintf("CREATE TABLE %s(id %s %s)", tableName, c.Tp, pkOrUK) diff --git a/tests/integration_tests/multi_source/main.go b/tests/integration_tests/multi_source/main.go index 4803d4e4a4..4f43015911 100644 --- a/tests/integration_tests/multi_source/main.go +++ b/tests/integration_tests/multi_source/main.go @@ -16,6 +16,7 @@ package main import ( "context" "database/sql" + stderrors "errors" "flag" "fmt" "os" @@ -36,9 +37,9 @@ import ( func main() { cfg := util.NewConfig() err := cfg.Parse(os.Args[1:]) - switch errors.Cause(err) { - case nil: - case flag.ErrHelp: + switch { + case errors.Cause(err) == nil: + case stderrors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) @@ -210,7 +211,7 @@ func DropWithRecoverDDL(ctx context.Context, db *sql.DB) { return default: } - // get a rand number bewteen 0 and 1 + // get a rand number between 0 and 1 rand := time.Now().UnixNano() % 2 if rand == 0 { util.MustExec(db, drop_sql) @@ -343,14 +344,15 @@ func addDropColumnDDL(ctx context.Context, db *sql.DB) { var notNULL string var defaultValue interface{} - if value%5 == 0 { + switch value % 5 { + case 0: // use default not null notNULL = "not null" defaultValue = value - } else if value%5 == 1 { + case 1: // use default null defaultValue = nil - } else { + default: // use default defaultValue = value } @@ -386,13 +388,14 @@ func addDropColumnDDL2(ctx context.Context, db *sql.DB) { var defaultValue interface{} strValue := strconv.Itoa(value) - if value%5 == 0 { + switch value % 5 { + case 0: // use default defaultValue = strValue - } else if value%5 == 1 { + case 1: // use default null defaultValue = nil - } else { + default: // use default not null notNULL = "not null" defaultValue = strValue diff --git a/tests/integration_tests/resolve_lock/main.go b/tests/integration_tests/resolve_lock/main.go index 59c818847d..1eda183f56 100644 --- a/tests/integration_tests/resolve_lock/main.go +++ b/tests/integration_tests/resolve_lock/main.go @@ -18,6 +18,7 @@ import ( "context" "database/sql" "encoding/json" + stderrors "errors" "flag" "fmt" "io" @@ -45,9 +46,9 @@ import ( func main() { cfg := util.NewConfig() err := cfg.Parse(os.Args[1:]) - switch errors.Cause(err) { - case nil: - case flag.ErrHelp: + switch { + case errors.Cause(err) == nil: + case stderrors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/util/config.go b/tests/integration_tests/util/config.go index 3b875ed283..70093414e4 100644 --- a/tests/integration_tests/util/config.go +++ b/tests/integration_tests/util/config.go @@ -82,8 +82,8 @@ func (c *Config) Parse(arguments []string) error { return errors.Trace(err) } - if len(c.FlagSet.Args()) != 0 { - return errors.Errorf("'%s' is an invalid flag", c.FlagSet.Arg(0)) + if len(c.Args()) != 0 { + return errors.Errorf("'%s' is an invalid flag", c.Arg(0)) } return nil diff --git a/tests/integration_tests/util/db.go b/tests/integration_tests/util/db.go index 2c00e3ba0a..c10e68766e 100644 --- a/tests/integration_tests/util/db.go +++ b/tests/integration_tests/util/db.go @@ -16,6 +16,7 @@ package util import ( "context" "database/sql" + stderrors "errors" "fmt" "net/url" "time" @@ -152,7 +153,7 @@ func MustExec(db *sql.DB, sql string, args ...interface{}) { func MustExecWithConn(ctx context.Context, conn *sql.Conn, sql string, args ...interface{}) { var err error _, err = conn.ExecContext(ctx, sql, args...) - if err != nil && errors.Cause(err) == context.DeadlineExceeded && errors.Cause(err) == context.Canceled { + if err != nil && stderrors.Is(errors.Cause(err), context.DeadlineExceeded) && stderrors.Is(errors.Cause(err), context.Canceled) { log.S().Fatal(err) } } diff --git a/utils/chann/unlimited_chann.go b/utils/chann/unlimited_chann.go index aa441368a4..9ef1a631d7 100644 --- a/utils/chann/unlimited_chann.go +++ b/utils/chann/unlimited_chann.go @@ -173,10 +173,8 @@ func (c *UnlimitedChannel[T, G]) getMultiple(gmt getMultType, buffer []T, batchB switch gmt { case getMultNoGroup: - for { - if len(buffer) >= cap || bytes >= maxBytes { - break - } + for len(buffer) < cap && bytes < maxBytes { + v, ok := c.queue.PopFront() if !ok { break diff --git a/utils/threadpool/thread_pool_test.go b/utils/threadpool/thread_pool_test.go index 19cb964c10..7ec7f5281a 100644 --- a/utils/threadpool/thread_pool_test.go +++ b/utils/threadpool/thread_pool_test.go @@ -109,7 +109,7 @@ func (t *longRunTask) Execute() time.Time { func TestThreadPoolTiming(t *testing.T) { msgChan := make(chan TaskId, 1000) var wg sync.WaitGroup - var countDown int = 0 + countDown := 0 ts := newThreadPoolImpl(1) // To make the scheduler stop executing any tasks From a8421637c30bc00aab892567df3cf34ff204aa9f Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Tue, 12 May 2026 10:36:31 +0800 Subject: [PATCH 3/5] fix all lint issue --- .github/workflows/pr_build_and_test.yaml | 2 ++ cmd/storage-consumer/main.go | 2 +- coordinator/coordinator_test.go | 2 +- logservice/logpuller/region_request_worker.go | 3 +-- logservice/logpuller/subscription_client.go | 3 +-- logservice/schemastore/disk_format.go | 2 +- logservice/schemastore/multi_version_test.go | 2 +- logservice/schemastore/persist_storage_test.go | 2 +- pkg/etcd/client.go | 7 +++---- pkg/logger/log.go | 6 +++--- pkg/messaging/message_center.go | 3 +-- pkg/orchestrator/etcd_worker_test.go | 5 ++--- pkg/pdutil/api_client.go | 5 ++--- pkg/redo/reader/file.go | 7 +++---- pkg/retry/retry_test.go | 4 ++-- pkg/sink/codec/common/helper.go | 6 +++--- pkg/sink/kafka/options_test.go | 3 +-- pkg/sink/mysql/helper.go | 9 ++++----- pkg/sink/mysql/mysql_writer.go | 3 +-- pkg/sink/mysql/mysql_writer_dml_exec.go | 3 +-- .../mysql_writer_for_active_active_sync_stats.go | 4 ++-- pkg/tcpserver/tcp_server.go | 3 +-- pkg/txnutil/gc/gc_manager_nextgen_test.go | 9 ++++----- pkg/txnutil/gc/gc_manager_test.go | 13 ++++++------- pkg/workerpool/async_pool_test.go | 4 ++-- tests/integration_tests/bank/case.go | 3 +-- tests/integration_tests/cdc/cdc.go | 4 ++-- .../complex_transaction/workload.go | 8 ++++---- tests/integration_tests/default_value/main.go | 4 ++-- tests/integration_tests/many_pk_or_uk/main.go | 4 ++-- tests/integration_tests/multi_source/main.go | 4 ++-- tests/integration_tests/resolve_lock/main.go | 4 ++-- tests/integration_tests/util/db.go | 4 ++-- 33 files changed, 67 insertions(+), 80 deletions(-) diff --git a/.github/workflows/pr_build_and_test.yaml b/.github/workflows/pr_build_and_test.yaml index ec2bc583a5..befaebe095 100644 --- a/.github/workflows/pr_build_and_test.yaml +++ b/.github/workflows/pr_build_and_test.yaml @@ -36,6 +36,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Go environment uses: actions/setup-go@v6 diff --git a/cmd/storage-consumer/main.go b/cmd/storage-consumer/main.go index 7215d9c5ab..70256977f4 100644 --- a/cmd/storage-consumer/main.go +++ b/cmd/storage-consumer/main.go @@ -15,7 +15,6 @@ package main import ( "context" - "errors" "flag" "net/http" "net/url" @@ -27,6 +26,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/logger" "github.com/pingcap/ticdc/pkg/version" "go.uber.org/zap" diff --git a/coordinator/coordinator_test.go b/coordinator/coordinator_test.go index 5e51329bbd..608a1bf348 100644 --- a/coordinator/coordinator_test.go +++ b/coordinator/coordinator_test.go @@ -16,7 +16,6 @@ package coordinator import ( "context" "encoding/json" - "errors" "flag" "fmt" "net" @@ -36,6 +35,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/eventservice" "github.com/pingcap/ticdc/pkg/messaging" diff --git a/logservice/logpuller/region_request_worker.go b/logservice/logpuller/region_request_worker.go index 00b7023cc5..db2d611836 100644 --- a/logservice/logpuller/region_request_worker.go +++ b/logservice/logpuller/region_request_worker.go @@ -15,7 +15,6 @@ package logpuller import ( "context" - stderrors "errors" "sync" "sync/atomic" "time" @@ -106,7 +105,7 @@ func newRegionRequestWorker( } var regionErr error if err := version.CheckStoreVersion(ctx, worker.client.pd); err != nil { - if stderrors.Is(errors.Cause(err), context.Canceled) { + if cerror.Is(errors.Cause(err), context.Canceled) { return nil } log.Error("event feed check store version fails", diff --git a/logservice/logpuller/subscription_client.go b/logservice/logpuller/subscription_client.go index 484f7c83b7..93896e7c73 100644 --- a/logservice/logpuller/subscription_client.go +++ b/logservice/logpuller/subscription_client.go @@ -15,7 +15,6 @@ package logpuller import ( "context" - stderrors "errors" "sync" "sync/atomic" "time" @@ -846,7 +845,7 @@ func (s *subscriptionClient) handleErrors(ctx context.Context) error { func (s *subscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error { err := errors.Cause(errInfo.err) var rcErr *requestCancelledErr - if !stderrors.As(err, &rcErr) { + if !cerror.As(err, &rcErr) { log.Debug("cdc region error", zap.Uint64("subscriptionID", uint64(errInfo.subscribedSpan.subID)), zap.Uint64("regionID", errInfo.verID.GetID()), diff --git a/logservice/schemastore/disk_format.go b/logservice/schemastore/disk_format.go index 4a407ad5da..6355938bdc 100644 --- a/logservice/schemastore/disk_format.go +++ b/logservice/schemastore/disk_format.go @@ -17,7 +17,6 @@ import ( "bytes" "encoding/binary" "encoding/json" - "errors" "math" "strings" "time" @@ -26,6 +25,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" diff --git a/logservice/schemastore/multi_version_test.go b/logservice/schemastore/multi_version_test.go index f90af8688e..4272e393ff 100644 --- a/logservice/schemastore/multi_version_test.go +++ b/logservice/schemastore/multi_version_test.go @@ -14,10 +14,10 @@ package schemastore import ( - "errors" "testing" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/logservice/schemastore/persist_storage_test.go b/logservice/schemastore/persist_storage_test.go index 864d9958c1..8a9a612263 100644 --- a/logservice/schemastore/persist_storage_test.go +++ b/logservice/schemastore/persist_storage_test.go @@ -14,7 +14,6 @@ package schemastore import ( - "errors" "fmt" "math" "os" @@ -26,6 +25,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/ast" diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index 969db70ec5..10e0c03f90 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -16,7 +16,6 @@ package etcd import ( "context" "crypto/tls" - stderrors "errors" "fmt" "sync" "time" @@ -141,7 +140,7 @@ func retryRPC(rpcName string, metric prometheus.Counter, etcdRPC func() error) e // 16s = \sum_{n=0}^{6} 0.5*1.5^n return retry.Do(context.Background(), func() error { err := etcdRPC() - if err != nil && !stderrors.Is(errors.Cause(err), context.Canceled) { + if err != nil && !cerror.Is(errors.Cause(err), context.Canceled) { log.Warn("etcd RPC failed", zap.String("RPC", rpcName), zap.Error(err)) } if metric != nil { @@ -353,7 +352,7 @@ func isRetryableError(rpcName string) retry.IsRetryable { switch rpcName { case EtcdRevoke: var etcdErr v3rpc.EtcdError - if stderrors.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound { + if cerror.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound { // It means the etcd lease is already expired or revoked return false } @@ -616,5 +615,5 @@ func IsHealthy(ctx context.Context, client *clientv3.Client) bool { _, err := client.Get(ctx, healthyPath) // permission denied is OK since proposal goes through consensus to get it // See: https://github.com/etcd-io/etcd/blob/85b640cee793e25f3837c47200089d14a8392dc7/etcdctl/ctlv3/command/ep_command.go#L124 - return err == nil || stderrors.Is(err, rpctypes.ErrPermissionDenied) + return err == nil || cerror.Is(err, rpctypes.ErrPermissionDenied) } diff --git a/pkg/logger/log.go b/pkg/logger/log.go index 1ea37b1c52..862dc4c697 100644 --- a/pkg/logger/log.go +++ b/pkg/logger/log.go @@ -16,7 +16,6 @@ package logger import ( "bytes" "context" - stderrors "errors" "io" "os" "strconv" @@ -27,6 +26,7 @@ import ( "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc/grpclog" @@ -233,7 +233,7 @@ func initOptionalComponent(op *loggerOp, cfg *Config) error { func ZapErrorFilter(err error, filterErrors ...error) zap.Field { cause := errors.Cause(err) for _, ferr := range filterErrors { - if stderrors.Is(cause, ferr) { + if cerror.Is(cause, ferr) { return zap.Error(nil) } } @@ -335,7 +335,7 @@ func ErrorFilterContextCanceled(logger *zap.Logger, msg string, fields ...zap.Fi } case zapcore.ErrorType: err, ok := field.Interface.(error) - if ok && stderrors.Is(errors.Cause(err), context.Canceled) { + if ok && cerror.Is(errors.Cause(err), context.Canceled) { return } } diff --git a/pkg/messaging/message_center.go b/pkg/messaging/message_center.go index ab9a88aca8..2f7a871bf2 100644 --- a/pkg/messaging/message_center.go +++ b/pkg/messaging/message_center.go @@ -16,7 +16,6 @@ package messaging import ( "context" "encoding/json" - stderrors "errors" "fmt" "sync" "time" @@ -474,7 +473,7 @@ func (s *grpcServer) handleConnect(stream proto.MessageService_StreamMessagesSer } return nil }, retry.WithIsRetryableErr(func(err error) bool { - return !stderrors.Is(err, context.DeadlineExceeded) + return !pkgerror.Is(err, context.DeadlineExceeded) }), retry.WithMaxTries(10)) if err != nil { log.Error("Failed to get remote target", zap.Error(err)) diff --git a/pkg/orchestrator/etcd_worker_test.go b/pkg/orchestrator/etcd_worker_test.go index 413d1d33d2..27bc9392f2 100644 --- a/pkg/orchestrator/etcd_worker_test.go +++ b/pkg/orchestrator/etcd_worker_test.go @@ -16,7 +16,6 @@ package orchestrator import ( "context" "encoding/json" - stderrors "errors" "regexp" "strconv" "strings" @@ -273,8 +272,8 @@ func TestEtcdSum(t *testing.T) { } err = errg.Wait() - if err != nil && (stderrors.Is(errors.Cause(err), context.DeadlineExceeded) || - stderrors.Is(errors.Cause(err), context.Canceled) || + if err != nil && (cerrors.Is(errors.Cause(err), context.DeadlineExceeded) || + cerrors.Is(errors.Cause(err), context.Canceled) || strings.Contains(err.Error(), "etcdserver: request timeout")) { return } diff --git a/pkg/pdutil/api_client.go b/pkg/pdutil/api_client.go index 5c116299a8..f7d4d24e6b 100644 --- a/pkg/pdutil/api_client.go +++ b/pkg/pdutil/api_client.go @@ -19,7 +19,6 @@ import ( "crypto/tls" "encoding/hex" "encoding/json" - stderrors "errors" "fmt" "io" "net/http" @@ -189,7 +188,7 @@ func (pc *pdAPIClient) UpdateMetaLabel(ctx context.Context) error { retry.WithBackoffMaxDelay(4000), retry.WithIsRetryableErr(func(err error) bool { switch { - case stderrors.Is(errors.Cause(err), context.Canceled): + case cerror.Is(errors.Cause(err), context.Canceled): return false } return true @@ -366,7 +365,7 @@ func (pc *pdAPIClient) ListGcServiceSafePoint( return nil }, retry.WithMaxTries(defaultMaxRetry), retry.WithIsRetryableErr(func(err error) bool { switch { - case stderrors.Is(errors.Cause(err), context.Canceled): + case cerror.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/redo/reader/file.go b/pkg/redo/reader/file.go index 56229a8292..576265e62e 100644 --- a/pkg/redo/reader/file.go +++ b/pkg/redo/reader/file.go @@ -20,7 +20,6 @@ import ( "container/heap" "context" "encoding/binary" - stderrors "errors" "io" "math" "net/url" @@ -226,7 +225,7 @@ func readAllFromBuffer(buf []byte) (logHeap, error) { for { rl, err := r.Read() if err != nil { - if !stderrors.Is(err, io.EOF) { + if !cerror.Is(err, io.EOF) { return nil, err } break @@ -328,7 +327,7 @@ func (r *reader) Read() (*pevent.RedoLog, error) { lenField, err := readInt64(r.br) if err != nil { - if stderrors.Is(err, io.EOF) { + if cerror.Is(err, io.EOF) { return nil, err } return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) @@ -338,7 +337,7 @@ func (r *reader) Read() (*pevent.RedoLog, error) { data := make([]byte, recBytes+padBytes) _, err = io.ReadFull(r.br, data) if err != nil { - if stderrors.Is(err, io.EOF) || stderrors.Is(err, io.ErrUnexpectedEOF) { + if cerror.Is(err, io.EOF) || cerror.Is(err, io.ErrUnexpectedEOF) { log.Warn("read redo log have unexpected io error", zap.String("fileName", r.fileName), zap.Error(err)) diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index 73aa4d18a8..3a81183671 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -15,12 +15,12 @@ package retry import ( "context" - stderrors "errors" "math" "testing" "time" "github.com/pingcap/errors" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -66,7 +66,7 @@ func TestIsRetryable(t *testing.T) { err := Do(context.Background(), f, WithMaxTries(3), WithIsRetryableErr(func(err error) bool { switch { - case stderrors.Is(errors.Cause(err), context.Canceled): + case cerror.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/sink/codec/common/helper.go b/pkg/sink/codec/common/helper.go index b90332674b..c3da71fc83 100644 --- a/pkg/sink/codec/common/helper.go +++ b/pkg/sink/codec/common/helper.go @@ -16,7 +16,6 @@ package common import ( "context" "database/sql" - stderrors "errors" "fmt" "math" "strconv" @@ -27,6 +26,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" @@ -270,7 +270,7 @@ func queryRowChecksumAux( _, err := conn.ExecContext(ctx, query) if err != nil { mysqlErr := &mysqlDriver.MySQLError{} - ok := stderrors.As(errors.Cause(err), &mysqlErr) + ok := cerror.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { @@ -327,7 +327,7 @@ func MustSnapshotQuery( _, err = conn.ExecContext(ctx, query) if err != nil { mysqlErr := &mysqlDriver.MySQLError{} - ok := stderrors.As(errors.Cause(err), &mysqlErr) + ok := cerror.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { diff --git a/pkg/sink/kafka/options_test.go b/pkg/sink/kafka/options_test.go index 42f127f3e1..c5dfd8184d 100644 --- a/pkg/sink/kafka/options_test.go +++ b/pkg/sink/kafka/options_test.go @@ -15,7 +15,6 @@ package kafka import ( "context" - stderrors "errors" "fmt" "net/url" "strconv" @@ -834,7 +833,7 @@ func TestAdjustOptionsKeepAlive(t *testing.T) { require.Error(t, err) // The error should be a type conversion error. numError := &strconv.NumError{} - ok := stderrors.As(errors.Cause(err), &numError) + ok := cerror.As(errors.Cause(err), &numError) require.True(t, ok, "error should be of type strconv.NumError") }) diff --git a/pkg/sink/mysql/helper.go b/pkg/sink/mysql/helper.go index 1953c1e7c1..b18e241e86 100644 --- a/pkg/sink/mysql/helper.go +++ b/pkg/sink/mysql/helper.go @@ -17,7 +17,6 @@ import ( "context" "database/sql" "encoding/base64" - stderrors "errors" "fmt" "net" "strconv" @@ -72,7 +71,7 @@ func CheckIfBDRModeIsSupported(ctx context.Context, db *sql.DB) (bool, error) { _, err := db.ExecContext(ctx, query) if err != nil { mysqlErr := &dmysql.MySQLError{} - if stderrors.As(errors.Cause(err), &mysqlErr) { + if cerror.As(errors.Cause(err), &mysqlErr) { return false, nil } return false, err @@ -191,7 +190,7 @@ func GetTestDB(dbConfig *dmysql.Config) (*sql.DB, error) { if err != nil { // If access is denied and password is encoded by base64, try to decoded password. mysqlErr := &dmysql.MySQLError{} - if stderrors.As(errors.Cause(err), &mysqlErr) { + if cerror.As(errors.Cause(err), &mysqlErr) { if dePassword, decodeErr := base64.StdEncoding.DecodeString(password); decodeErr == nil && string(dePassword) != password { dbConfig.Passwd = string(dePassword) testDB, err = CreateMysqlDBConn(dbConfig.FormatDSN()) @@ -311,7 +310,7 @@ func checkCharsetSupport(db *sql.DB, charsetName string) (bool, error) { querySQL := "select character_set_name from information_schema.character_sets " + "where character_set_name = '" + charsetName + "';" err = db.QueryRowContext(context.Background(), querySQL).Scan(&characterSetName) - if err != nil && !stderrors.Is(err, sql.ErrNoRows) { + if err != nil && !cerror.Is(err, sql.ErrNoRows) { return false, cerror.WrapError(cerror.ErrMySQLQueryError, err) } if err != nil { @@ -473,7 +472,7 @@ func isRetryableDMLError(err error) bool { func getSQLErrCode(err error) (errors.ErrCode, bool) { mysqlErr := &dmysql.MySQLError{} - ok := stderrors.As(errors.Cause(err), &mysqlErr) + ok := cerror.As(errors.Cause(err), &mysqlErr) if !ok { return -1, false } diff --git a/pkg/sink/mysql/mysql_writer.go b/pkg/sink/mysql/mysql_writer.go index c5e3cb31f6..9bc2d6125d 100644 --- a/pkg/sink/mysql/mysql_writer.go +++ b/pkg/sink/mysql/mysql_writer.go @@ -16,7 +16,6 @@ package mysql import ( "context" "database/sql" - stderrors "errors" "strings" "sync" "time" @@ -261,7 +260,7 @@ func (w *Writer) checkIsDuplicateEntryError(err error) bool { if err == nil { return false } - if stderrors.Is(errors.Cause(err), cerror.ErrMySQLDuplicateEntry) || + if cerror.Is(errors.Cause(err), cerror.ErrMySQLDuplicateEntry) || strings.Contains(err.Error(), "Duplicate entry") { if !w.isInErrorCausedSafeMode { w.isInErrorCausedSafeMode = true diff --git a/pkg/sink/mysql/mysql_writer_dml_exec.go b/pkg/sink/mysql/mysql_writer_dml_exec.go index 954fca29a4..f06daf58ff 100644 --- a/pkg/sink/mysql/mysql_writer_dml_exec.go +++ b/pkg/sink/mysql/mysql_writer_dml_exec.go @@ -17,7 +17,6 @@ import ( "context" "database/sql" "database/sql/driver" - stderrors "errors" "fmt" "strings" "time" @@ -159,7 +158,7 @@ func (w *Writer) sequenceExecute( if execError != nil { log.Error("ExecContext", zap.Error(execError), zap.Any("dmls", dmls), zap.Int("writerID", w.id)) if rbErr := tx.Rollback(); rbErr != nil { - if !stderrors.Is(errors.Cause(rbErr), context.Canceled) { + if !cerror.Is(errors.Cause(rbErr), context.Canceled) { log.Warn("failed to rollback txn", zap.Error(rbErr), zap.Int("writerID", w.id)) } } diff --git a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go index d11646b0f9..5162ebb32f 100644 --- a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go +++ b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go @@ -17,13 +17,13 @@ import ( "context" "database/sql" "encoding/json" - stderrors "errors" "sync" dmysql "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" tidbmysql "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/prometheus/client_golang/prometheus" @@ -43,7 +43,7 @@ func CheckActiveActiveSyncStatsSupported(ctx context.Context, db *sql.DB) (bool, var v sql.NullString if err := row.Scan(&v); err != nil { mysqlErr := &dmysql.MySQLError{} - if stderrors.As(errors.Cause(err), &mysqlErr) && + if cerror.As(errors.Cause(err), &mysqlErr) && mysqlErr.Number == tidbmysql.ErrUnknownSystemVariable { return false, nil } diff --git a/pkg/tcpserver/tcp_server.go b/pkg/tcpserver/tcp_server.go index 0f67753d94..dacc4bfe0b 100644 --- a/pkg/tcpserver/tcp_server.go +++ b/pkg/tcpserver/tcp_server.go @@ -16,7 +16,6 @@ package tcpserver import ( "context" "crypto/tls" - stderrors "errors" "net" "strings" "time" @@ -128,7 +127,7 @@ func (s *tcpServerImpl) Run(ctx context.Context) (err error) { errg.Go(func() error { err := s.mux.Serve() - if stderrors.Is(err, cmux.ErrServerClosed) { + if cerror.Is(err, cmux.ErrServerClosed) { return cerror.ErrTCPServerClosed.GenWithStackByArgs() } if err != nil && strings.Contains(err.Error(), "use of closed network connection") { diff --git a/pkg/txnutil/gc/gc_manager_nextgen_test.go b/pkg/txnutil/gc/gc_manager_nextgen_test.go index c8143d0526..38e3d84d28 100644 --- a/pkg/txnutil/gc/gc_manager_nextgen_test.go +++ b/pkg/txnutil/gc/gc_manager_nextgen_test.go @@ -18,13 +18,12 @@ package gc import ( "context" - stderrors "errors" "testing" "time" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/stretchr/testify/require" pdgc "github.com/tikv/pd/client/clients/gc" @@ -53,7 +52,7 @@ func TestTryUpdateKeyspaceGCBarrierDoesNotReturnSnapshotLost(t *testing.T) { return gcStatesClient }, UpdateServiceGCSafePointFunc: func(ctx context.Context, serviceID string, ttl int64, safePoint uint64) (uint64, error) { - return 0, stderrors.New("not used") + return 0, errors.New("not used") }, } @@ -67,7 +66,7 @@ func TestTryUpdateKeyspaceGCBarrierDoesNotReturnSnapshotLost(t *testing.T) { cfID := common.NewChangeFeedIDWithName("test-changefeed", keyspaceName) err := m.CheckStaleCheckpointTs(keyspaceID, cfID, checkpointTs) require.Error(t, err) - errCode, ok := cerrors.RFCCode(err) + errCode, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrSnapshotLostByGC.RFCCode(), errCode) + require.Equal(t, errors.ErrSnapshotLostByGC.RFCCode(), errCode) } diff --git a/pkg/txnutil/gc/gc_manager_test.go b/pkg/txnutil/gc/gc_manager_test.go index 1b1761b827..ca55f4b438 100644 --- a/pkg/txnutil/gc/gc_manager_test.go +++ b/pkg/txnutil/gc/gc_manager_test.go @@ -18,14 +18,13 @@ package gc import ( "context" - stderrors "errors" "math" "testing" "time" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/stretchr/testify/require" ) @@ -37,7 +36,7 @@ func TestTryUpdateServiceGCSafepointReturnsErrorOnUpdateFailure(t *testing.T) { pdClient := &MockPDClient{ UpdateServiceGCSafePointFunc: func(ctx context.Context, serviceID string, ttl int64, safePoint uint64) (uint64, error) { updateCalls++ - return 0, stderrors.New("pd is unstable") + return 0, errors.New("pd is unstable") }, } @@ -48,9 +47,9 @@ func TestTryUpdateServiceGCSafepointReturnsErrorOnUpdateFailure(t *testing.T) { err := m.TryUpdateServiceGCSafepoint(ctx, common.Ts(100)) require.Error(t, err) - errCode, ok := cerrors.RFCCode(err) + errCode, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrUpdateServiceSafepointFailed.RFCCode(), errCode) + require.Equal(t, errors.ErrUpdateServiceSafepointFailed.RFCCode(), errCode) require.Equal(t, 1, updateCalls) } @@ -93,9 +92,9 @@ func TestTryUpdateServiceGCSafepointDoesNotReturnSnapshotLost(t *testing.T) { cfID := common.NewChangeFeedIDWithName("test-changefeed", "test") err := m.CheckStaleCheckpointTs(0, cfID, checkpointTs) require.Error(t, err) - errCode, ok := cerrors.RFCCode(err) + errCode, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrSnapshotLostByGC.RFCCode(), errCode) + require.Equal(t, errors.ErrSnapshotLostByGC.RFCCode(), errCode) } func TestTryDeleteServiceGCSafepointClearsCachedState(t *testing.T) { diff --git a/pkg/workerpool/async_pool_test.go b/pkg/workerpool/async_pool_test.go index 77e26fcf08..782f22c0ee 100644 --- a/pkg/workerpool/async_pool_test.go +++ b/pkg/workerpool/async_pool_test.go @@ -15,7 +15,6 @@ package workerpool import ( "context" - stderrors "errors" "math/rand" "sync" "sync/atomic" @@ -24,6 +23,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) @@ -125,7 +125,7 @@ func runForDuration(ctx context.Context, duration time.Duration, f func(ctx cont case <-ctx.Done(): return ctx.Err() case err := <-errCh: - if stderrors.Is(errors.Cause(err), context.DeadlineExceeded) { + if cerrors.Is(errors.Cause(err), context.DeadlineExceeded) { return nil } return errors.Trace(err) diff --git a/tests/integration_tests/bank/case.go b/tests/integration_tests/bank/case.go index a6d880dc1d..9c2b5e85fb 100644 --- a/tests/integration_tests/bank/case.go +++ b/tests/integration_tests/bank/case.go @@ -17,7 +17,6 @@ import ( "bufio" "context" "database/sql" - stderrors "errors" "fmt" "io" "math/rand" @@ -562,7 +561,7 @@ func run( return ctx.Err() default: err := workload() - if err != nil && !stderrors.Is(errors.Cause(err), context.Canceled) { + if err != nil && !cerror.Is(errors.Cause(err), context.Canceled) { log.Warn("workload failed", zap.Error(err)) } diff --git a/tests/integration_tests/cdc/cdc.go b/tests/integration_tests/cdc/cdc.go index b5ab944b26..bf82b7f55f 100644 --- a/tests/integration_tests/cdc/cdc.go +++ b/tests/integration_tests/cdc/cdc.go @@ -14,13 +14,13 @@ package main import ( - stderrors "errors" "flag" "os" _ "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/cdc/dailytest" "github.com/pingcap/ticdc/tests/integration_tests/util" ) @@ -30,7 +30,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case stderrors.Is(errors.Cause(err), flag.ErrHelp): + case cerror.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/complex_transaction/workload.go b/tests/integration_tests/complex_transaction/workload.go index 8d7c912ffb..1919914a70 100644 --- a/tests/integration_tests/complex_transaction/workload.go +++ b/tests/integration_tests/complex_transaction/workload.go @@ -16,7 +16,6 @@ package main import ( "context" "database/sql" - stderrors "errors" "fmt" "math/rand" "sync/atomic" @@ -24,6 +23,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -205,7 +205,7 @@ func (w *WorkloadExecutor) cancelOrderTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT order_id, user_id, total_amount FROM orders WHERE status = 0 ORDER BY RAND() LIMIT 1`).Scan(&orderID, &userID, &totalAmount) - if stderrors.Is(err, sql.ErrNoRows) { + if cerror.Is(err, sql.ErrNoRows) { // No active orders to cancel return tx.Commit() } @@ -489,7 +489,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id, user_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID, &postUserID) - if stderrors.Is(err, sql.ErrNoRows) { + if cerror.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { @@ -522,7 +522,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID) - if stderrors.Is(err, sql.ErrNoRows) { + if cerror.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { diff --git a/tests/integration_tests/default_value/main.go b/tests/integration_tests/default_value/main.go index 4d4fa06cb1..eefe7fca4d 100644 --- a/tests/integration_tests/default_value/main.go +++ b/tests/integration_tests/default_value/main.go @@ -16,7 +16,6 @@ package main import ( "context" "database/sql" - stderrors "errors" "flag" "fmt" "os" @@ -30,6 +29,7 @@ import ( guuid "github.com/google/uuid" "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/workerpool" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" @@ -55,7 +55,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case stderrors.Is(errors.Cause(err), flag.ErrHelp): + case cerror.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/many_pk_or_uk/main.go b/tests/integration_tests/many_pk_or_uk/main.go index 264ff2bb99..55397ea2fb 100644 --- a/tests/integration_tests/many_pk_or_uk/main.go +++ b/tests/integration_tests/many_pk_or_uk/main.go @@ -15,7 +15,6 @@ package main import ( "database/sql" - stderrors "errors" "flag" "fmt" "math" @@ -24,6 +23,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" ) @@ -32,7 +32,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case stderrors.Is(errors.Cause(err), flag.ErrHelp): + case cerror.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/multi_source/main.go b/tests/integration_tests/multi_source/main.go index 4f43015911..25dcc84ea0 100644 --- a/tests/integration_tests/multi_source/main.go +++ b/tests/integration_tests/multi_source/main.go @@ -16,7 +16,6 @@ package main import ( "context" "database/sql" - stderrors "errors" "flag" "fmt" "os" @@ -30,6 +29,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" ) @@ -39,7 +39,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case stderrors.Is(errors.Cause(err), flag.ErrHelp): + case cerror.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/resolve_lock/main.go b/tests/integration_tests/resolve_lock/main.go index 1eda183f56..343d199b3f 100644 --- a/tests/integration_tests/resolve_lock/main.go +++ b/tests/integration_tests/resolve_lock/main.go @@ -18,7 +18,6 @@ import ( "context" "database/sql" "encoding/json" - stderrors "errors" "flag" "fmt" "io" @@ -32,6 +31,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/log" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" @@ -48,7 +48,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case stderrors.Is(errors.Cause(err), flag.ErrHelp): + case cerror.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/util/db.go b/tests/integration_tests/util/db.go index c10e68766e..53f1327f36 100644 --- a/tests/integration_tests/util/db.go +++ b/tests/integration_tests/util/db.go @@ -16,7 +16,6 @@ package util import ( "context" "database/sql" - stderrors "errors" "fmt" "net/url" "time" @@ -24,6 +23,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/diff" + cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" ) @@ -153,7 +153,7 @@ func MustExec(db *sql.DB, sql string, args ...interface{}) { func MustExecWithConn(ctx context.Context, conn *sql.Conn, sql string, args ...interface{}) { var err error _, err = conn.ExecContext(ctx, sql, args...) - if err != nil && stderrors.Is(errors.Cause(err), context.DeadlineExceeded) && stderrors.Is(errors.Cause(err), context.Canceled) { + if err != nil && cerror.Is(errors.Cause(err), context.DeadlineExceeded) && cerror.Is(errors.Cause(err), context.Canceled) { log.S().Fatal(err) } } From ef2f1c0f22a06506f2dc30c3bbd2cfe0c2f9142f Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Tue, 12 May 2026 11:40:30 +0800 Subject: [PATCH 4/5] fix all lint --- api/v2/failpoint.go | 11 ++-- api/v2/log.go | 2 +- api/v2/log_test.go | 2 +- api/v2/unsafe.go | 8 +-- cmd/cdc/cli/cli_changefeed_create.go | 2 +- cmd/cdc/cli/cli_changefeed_helper.go | 8 +-- cmd/cdc/cli/cli_changefeed_list_test.go | 2 +- cmd/cdc/cli/cli_changefeed_pause_test.go | 2 +- cmd/cdc/cli/cli_changefeed_query.go | 5 +- cmd/cdc/cli/cli_changefeed_query_test.go | 2 +- cmd/cdc/cli/cli_changefeed_remove.go | 4 +- cmd/cdc/cli/cli_changefeed_remove_test.go | 7 +-- cmd/cdc/cli/cli_changefeed_resume.go | 8 +-- cmd/cdc/cli/cli_changefeed_resume_test.go | 5 +- cmd/cdc/cli/cli_changefeed_update_test.go | 2 +- cmd/cdc/cli/cli_unsafe.go | 2 +- .../cli_unsafe_delete_service_gc_safepoint.go | 2 +- cmd/cdc/cli/cli_unsafe_reset.go | 2 +- cmd/cdc/cli/cli_unsafe_show_metadata.go | 2 +- cmd/cdc/redo/apply.go | 4 +- cmd/cdc/server/server.go | 2 +- cmd/cdc/server/server_redact_test.go | 2 +- cmd/cdc/server/server_test.go | 8 +-- cmd/kafka-consumer/consumer.go | 7 +-- cmd/kafka-consumer/writer.go | 2 +- cmd/oauth2-server/main.go | 4 +- cmd/storage-consumer/consumer.go | 2 +- coordinator/changefeed/backoff.go | 7 +-- coordinator/changefeed/etcd_backend.go | 15 +++-- coordinator/changefeed/etcd_backend_test.go | 2 +- .../dispatchermanager/heartbeat_collector.go | 2 +- .../sink/eventrouter/event_router.go | 8 +-- downstreamadapter/sink/kafka/sink_test.go | 2 +- downstreamadapter/sink/pulsar/sink_test.go | 6 +- .../sink/topicmanager/kafka_topic_manager.go | 9 ++- logservice/eventstore/event_store.go | 2 +- logservice/logpuller/errors.go | 2 +- logservice/logpuller/priority_queue.go | 2 +- logservice/logpuller/region_request_worker.go | 7 +-- .../logpuller/region_request_worker_test.go | 2 +- logservice/logpuller/subscription_client.go | 9 ++- .../logpuller/subscription_client_test.go | 2 +- logservice/schemastore/gc_keeper_test.go | 2 +- .../persist_storage_ddl_handlers.go | 11 ++-- logservice/schemastore/schema_store_test.go | 4 +- logservice/schemastore/utils.go | 2 +- logservice/schemastore/validator.go | 7 +-- maintainer/maintainer_controller_test.go | 6 +- pkg/api/util.go | 17 +++--- pkg/binlog-filter/filter.go | 2 +- pkg/binlog-filter/filter_test.go | 2 +- pkg/binlog-filter/util.go | 2 +- pkg/check/active_active_tso_indexes.go | 59 +++++++++---------- pkg/check/active_active_tso_indexes_test.go | 27 ++++----- pkg/check/cluster.go | 24 ++++---- pkg/check/cluster_test.go | 7 +-- pkg/common/event/checksum.go | 2 +- pkg/common/event/chunk.go | 2 +- pkg/common/event/codec.go | 25 ++++---- pkg/common/event/dml_event_redaction_test.go | 2 +- pkg/common/span_op.go | 5 +- pkg/common/urls.go | 13 ++-- pkg/config/capture.go | 11 ++-- pkg/config/changefeed.go | 15 +++-- pkg/config/debug.go | 2 +- pkg/config/integrity.go | 6 +- pkg/config/large_message.go | 12 ++-- pkg/config/large_message_test.go | 12 ++-- pkg/config/replica_config.go | 39 ++++++------ pkg/config/scheduler_config.go | 15 +++-- pkg/config/server.go | 23 ++++---- pkg/config/sink.go | 57 +++++++++--------- pkg/config/upstream.go | 7 +-- pkg/diff/checkpoint.go | 2 +- pkg/diff/chunk.go | 2 +- pkg/diff/diff.go | 2 +- pkg/encryption/cipher.go | 17 +++--- pkg/encryption/data_key_id.go | 4 +- pkg/encryption/data_key_id_24be.go | 6 +- pkg/encryption/encryption_manager.go | 20 +++---- pkg/encryption/encryption_manager_test.go | 11 ++-- pkg/encryption/format.go | 12 ++-- pkg/encryption/format_test.go | 6 +- pkg/encryption/kms/client.go | 24 ++++---- pkg/encryption/kms/mock_client.go | 10 ++-- pkg/encryption/manager.go | 30 +++++----- pkg/encryption/mock_tikv_client.go | 8 +-- pkg/encryption/mock_tikv_client_test.go | 4 +- pkg/encryption/tikv_http_client.go | 17 +++--- pkg/encryption/tikv_http_client_test.go | 8 +-- pkg/errors/reexport.go | 46 +++++++++++++++ pkg/etcd/client.go | 14 ++--- pkg/etcd/client_test.go | 2 +- pkg/etcd/etcd_test.go | 11 ++-- pkg/filter/expr_filter.go | 21 ++++--- pkg/filter/expr_filter_test.go | 4 +- pkg/filter/sql_event_filter.go | 11 ++-- pkg/filter/sql_event_filter_test.go | 7 +-- pkg/filter/utils.go | 4 +- pkg/fsutil/disk_info_freebsd.go | 7 +-- pkg/fsutil/disk_info_generic.go | 9 +-- pkg/fsutil/filelock.go | 5 +- pkg/fsutil/fileutil.go | 17 +++--- pkg/httputil/httputil.go | 2 +- pkg/logger/log.go | 7 +-- pkg/messaging/message_center.go | 13 ++-- pkg/messaging/remote_target.go | 2 +- pkg/migrate/migrate.go | 25 ++++---- pkg/migrate/migrate_test.go | 2 +- pkg/orchestrator/etcd_worker_test.go | 25 ++++---- pkg/orchestrator/reactor_state.go | 15 +++-- pkg/orchestrator/reactor_state_tester.go | 7 +-- pkg/pdutil/api_client.go | 9 ++- pkg/pdutil/api_client_test.go | 4 +- pkg/pdutil/clock.go | 2 +- pkg/pdutil/utils.go | 6 +- pkg/redo/reader/file.go | 29 +++++---- pkg/retry/error_retry.go | 4 +- pkg/retry/error_retry_test.go | 2 +- pkg/retry/retry_test.go | 5 +- pkg/retry/retry_with_opt.go | 7 +-- pkg/security/sasl.go | 2 +- pkg/sink/codec/avro/glue_client.go | 2 +- pkg/sink/codec/builder.go | 3 +- .../codec/canal/canal_json_encoder_test.go | 4 +- pkg/sink/codec/common/compress.go | 2 +- pkg/sink/codec/common/helper.go | 7 +-- pkg/sink/codec/common/log_info.go | 2 +- pkg/sink/codec/common/verify_checksum.go | 2 +- pkg/sink/codec/open/codec_test.go | 8 +-- .../codec/simple/marshaller_bench_test.go | 2 +- pkg/sink/kafka/claimcheck/claim_check.go | 2 +- pkg/sink/kafka/logutil.go | 2 +- pkg/sink/kafka/oauth2_token_provider.go | 2 +- pkg/sink/kafka/options.go | 37 ++++++------ pkg/sink/kafka/options_test.go | 9 ++- pkg/sink/kafka/sarama_async_producer.go | 7 +-- pkg/sink/kafka/sarama_config_test.go | 2 +- pkg/sink/mysql/config.go | 37 ++++++------ pkg/sink/mysql/ddl_index_rewrite.go | 2 +- pkg/sink/mysql/helper.go | 27 ++++----- pkg/sink/mysql/mysql_writer.go | 5 +- pkg/sink/mysql/mysql_writer_dml_batch.go | 12 ++-- pkg/sink/mysql/mysql_writer_dml_exec.go | 13 ++-- pkg/sink/mysql/mysql_writer_dml_session.go | 2 +- ...sql_writer_for_active_active_sync_stats.go | 5 +- pkg/sink/mysql/mysql_writer_for_syncpoint.go | 17 +++--- pkg/sink/mysql/mysql_writer_test.go | 5 +- pkg/sink/mysql/progress_table_writer.go | 11 ++-- pkg/sink/pulsar/factory.go | 4 +- pkg/tcpserver/tcp_server.go | 11 ++-- pkg/txnutil/gc/gc_service_test.go | 9 ++- pkg/upstream/manager.go | 6 +- pkg/upstream/manager_test.go | 2 +- pkg/upstream/upstream_test.go | 2 +- pkg/util/redact.go | 2 +- pkg/util/redact_test.go | 2 +- pkg/util/util.go | 2 +- pkg/version/check.go | 35 ++++++----- pkg/workerpool/async_pool_impl.go | 13 ++-- pkg/workerpool/async_pool_test.go | 5 +- pkg/workerpool/pool_impl.go | 17 +++--- pkg/workerpool/pool_test.go | 9 ++- server/watcher/etcd_watcher.go | 13 ++-- tests/integration_tests/api_v2/main.go | 2 +- tests/integration_tests/api_v2/model.go | 2 +- tests/integration_tests/api_v2/request.go | 9 ++- tests/integration_tests/bank/case.go | 9 ++- tests/integration_tests/cdc/cdc.go | 5 +- tests/integration_tests/cdc/dailytest/case.go | 2 +- tests/integration_tests/cdc/dailytest/db.go | 2 +- tests/integration_tests/cdc/dailytest/job.go | 2 +- .../integration_tests/cdc/dailytest/parser.go | 2 +- .../complex_transaction/workload.go | 9 ++- tests/integration_tests/default_value/main.go | 5 +- tests/integration_tests/many_pk_or_uk/main.go | 5 +- tests/integration_tests/multi_source/main.go | 5 +- tests/integration_tests/resolve_lock/main.go | 5 +- tests/integration_tests/util/config.go | 2 +- tests/integration_tests/util/db.go | 5 +- tests/utils/gen_kafka_big_messages/main.go | 2 +- tools/workload/app.go | 2 +- tools/workload/ddl_app.go | 2 +- tools/workload/ddl_config.go | 2 +- tools/workload/ddl_executor.go | 2 +- tools/workload/ddl_runner.go | 2 +- 186 files changed, 766 insertions(+), 793 deletions(-) diff --git a/api/v2/failpoint.go b/api/v2/failpoint.go index e3af58ab4d..e0b610946e 100644 --- a/api/v2/failpoint.go +++ b/api/v2/failpoint.go @@ -19,10 +19,11 @@ import ( "strings" "sync" + "github.com/pingcap/ticdc/pkg/errors" + "github.com/gin-gonic/gin" "github.com/pingcap/failpoint" "github.com/pingcap/ticdc/pkg/api" - cerror "github.com/pingcap/ticdc/pkg/errors" ) type FailpointRequest struct { @@ -74,13 +75,13 @@ var failpointState = newFailpointRegistry() func (h *OpenAPIV2) EnableFailpoint(c *gin.Context) { req := &FailpointRequest{} if err := c.BindJSON(req); err != nil { - _ = c.Error(cerror.ErrAPIInvalidParam.GenWithStack("invalid request: %s", err.Error())) + _ = c.Error(errors.ErrAPIInvalidParam.GenWithStack("invalid request: %s", err.Error())) return } req.Name = strings.TrimSpace(req.Name) req.Expr = strings.TrimSpace(req.Expr) if req.Name == "" || req.Expr == "" { - _ = c.Error(cerror.ErrAPIInvalidParam.GenWithStackByArgs("name and expr are required")) + _ = c.Error(errors.ErrAPIInvalidParam.GenWithStackByArgs("name and expr are required")) return } @@ -98,13 +99,13 @@ func (h *OpenAPIV2) DisableFailpoint(c *gin.Context) { if name == "" { req := &FailpointRequest{} if err := c.BindJSON(req); err != nil { - _ = c.Error(cerror.ErrAPIInvalidParam.GenWithStack("invalid request: %s", err.Error())) + _ = c.Error(errors.ErrAPIInvalidParam.GenWithStack("invalid request: %s", err.Error())) return } name = strings.TrimSpace(req.Name) } if name == "" { - _ = c.Error(cerror.ErrAPIInvalidParam.GenWithStackByArgs("name is required")) + _ = c.Error(errors.ErrAPIInvalidParam.GenWithStackByArgs("name is required")) return } diff --git a/api/v2/log.go b/api/v2/log.go index ab5b19bb20..0379db6a66 100644 --- a/api/v2/log.go +++ b/api/v2/log.go @@ -18,7 +18,7 @@ import ( "strings" "github.com/gin-gonic/gin" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/logger" diff --git a/api/v2/log_test.go b/api/v2/log_test.go index 08129db3e2..ddfa603bcc 100644 --- a/api/v2/log_test.go +++ b/api/v2/log_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/gin-gonic/gin" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/api/v2/unsafe.go b/api/v2/unsafe.go index 629b6ea41f..963fb1f062 100644 --- a/api/v2/unsafe.go +++ b/api/v2/unsafe.go @@ -20,8 +20,8 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/log" "github.com/pingcap/ticdc/api/middleware" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/logservice/txnutil" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/txnutil/gc" "go.uber.org/zap" ) @@ -47,7 +47,7 @@ func (h *OpenAPIV2) CDCMetaData(c *gin.Context) { func (h *OpenAPIV2) ResolveLock(c *gin.Context) { var resolveLockReq ResolveLockReq if err := c.BindJSON(&resolveLockReq); err != nil { - _ = c.Error(cerror.ErrAPIInvalidParam.Wrap(err)) + _ = c.Error(errors.ErrAPIInvalidParam.Wrap(err)) return } @@ -77,7 +77,7 @@ func (h *OpenAPIV2) ResolveLock(c *gin.Context) { func (h *OpenAPIV2) DeleteServiceGcSafePoint(c *gin.Context) { upstreamConfig := &UpstreamConfig{} if err := c.BindJSON(upstreamConfig); err != nil { - _ = c.Error(cerror.WrapError(cerror.ErrAPIInvalidParam, err)) + _ = c.Error(errors.WrapError(errors.ErrAPIInvalidParam, err)) return } pdClient := h.server.GetPdClient() @@ -91,7 +91,7 @@ func (h *OpenAPIV2) DeleteServiceGcSafePoint(c *gin.Context) { h.server.GetEtcdClient().GetGCServiceID(), ) if err != nil { - _ = c.Error(cerror.WrapError(cerror.ErrInternalServerError, err)) + _ = c.Error(errors.WrapError(errors.ErrInternalServerError, err)) } c.JSON(http.StatusOK, &EmptyResponse{}) } diff --git a/cmd/cdc/cli/cli_changefeed_create.go b/cmd/cdc/cli/cli_changefeed_create.go index 97ccb3c05f..b040c045da 100644 --- a/cmd/cdc/cli/cli_changefeed_create.go +++ b/cmd/cdc/cli/cli_changefeed_create.go @@ -20,7 +20,7 @@ import ( "strings" "github.com/fatih/color" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" diff --git a/cmd/cdc/cli/cli_changefeed_helper.go b/cmd/cdc/cli/cli_changefeed_helper.go index 5a655672e9..5c01a6621a 100644 --- a/cmd/cdc/cli/cli_changefeed_helper.go +++ b/cmd/cdc/cli/cli_changefeed_helper.go @@ -21,7 +21,7 @@ import ( "time" v2 "github.com/pingcap/ticdc/api/v2" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" "github.com/tikv/client-go/v2/oracle" ) @@ -66,7 +66,7 @@ func confirmLargeDataGap(cmd *cobra.Command, currentPhysical int64, startTs uint confirmed := readYOrN(cmd) if !confirmed { cmd.Printf("Abort changefeed %s.\n", command) - return cerror.ErrCliAborted.FastGenByArgs(fmt.Sprintf("cli changefeed %s", command)) + return errors.ErrCliAborted.FastGenByArgs(fmt.Sprintf("cli changefeed %s", command)) } } @@ -84,7 +84,7 @@ func confirmOverwriteCheckpointTs( confirmed := readYOrN(cmd) if !confirmed { cmd.Printf("Abort changefeed resume.\n") - return cerror.ErrCliAborted.FastGenByArgs("cli changefeed resume") + return errors.ErrCliAborted.FastGenByArgs("cli changefeed resume") } return nil @@ -99,7 +99,7 @@ func confirmIgnoreIneligibleTables(cmd *cobra.Command) (bool, error) { confirmed := readYOrN(cmd) if !confirmed { cmd.Printf("No changefeed is created because you don't want to ignore some tables.\n") - return false, cerror.ErrCliAborted.FastGenByArgs("cli changefeed create") + return false, errors.ErrCliAborted.FastGenByArgs("cli changefeed create") } return true, nil diff --git a/cmd/cdc/cli/cli_changefeed_list_test.go b/cmd/cdc/cli/cli_changefeed_list_test.go index 48113bbaea..218baa1948 100644 --- a/cmd/cdc/cli/cli_changefeed_list_test.go +++ b/cmd/cdc/cli/cli_changefeed_list_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" "github.com/pingcap/ticdc/pkg/api/v2/mock" diff --git a/cmd/cdc/cli/cli_changefeed_pause_test.go b/cmd/cdc/cli/cli_changefeed_pause_test.go index 0d9f3a76a2..c7c66a2078 100644 --- a/cmd/cdc/cli/cli_changefeed_pause_test.go +++ b/cmd/cdc/cli/cli_changefeed_pause_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/api/v2/mock" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_changefeed_query.go b/cmd/cdc/cli/cli_changefeed_query.go index 1fe44310a2..f45a5347a9 100644 --- a/cmd/cdc/cli/cli_changefeed_query.go +++ b/cmd/cdc/cli/cli_changefeed_query.go @@ -14,14 +14,13 @@ package cli import ( - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/pkg/api" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) @@ -91,7 +90,7 @@ func (o *queryChangefeedOptions) run(cmd *cobra.Command) error { return util.JSONPrint(cmd, info) } } - return cerror.ErrChangeFeedNotExists.GenWithStackByArgs(o.changefeedID) + return errors.ErrChangeFeedNotExists.GenWithStackByArgs(o.changefeedID) } detail, err := o.apiClientV2.Changefeeds().Get(ctx, o.keyspace, o.changefeedID) diff --git a/cmd/cdc/cli/cli_changefeed_query_test.go b/cmd/cdc/cli/cli_changefeed_query_test.go index cd974686a0..c8ed7a05ae 100644 --- a/cmd/cdc/cli/cli_changefeed_query_test.go +++ b/cmd/cdc/cli/cli_changefeed_query_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" "github.com/pingcap/ticdc/pkg/api/v2/mock" diff --git a/cmd/cdc/cli/cli_changefeed_remove.go b/cmd/cdc/cli/cli_changefeed_remove.go index a03c76d754..871fdaa683 100644 --- a/cmd/cdc/cli/cli_changefeed_remove.go +++ b/cmd/cdc/cli/cli_changefeed_remove.go @@ -19,7 +19,7 @@ import ( "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) @@ -84,7 +84,7 @@ func (o *removeChangefeedOptions) run(cmd *cobra.Command) error { // Tick and in that Tick, the in-memory data structure and the metadata stored in // etcd is already deleted. if err == nil { - err = cerror.ErrChangeFeedDeletionUnfinished.GenWithStackByArgs(o.changefeedID) + err = errors.ErrChangeFeedDeletionUnfinished.GenWithStackByArgs(o.changefeedID) } if strings.Contains(err.Error(), "ErrChangeFeedNotExists") { diff --git a/cmd/cdc/cli/cli_changefeed_remove_test.go b/cmd/cdc/cli/cli_changefeed_remove_test.go index 400625beb8..671a56073c 100644 --- a/cmd/cdc/cli/cli_changefeed_remove_test.go +++ b/cmd/cdc/cli/cli_changefeed_remove_test.go @@ -18,10 +18,9 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api/v2/mock" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -36,11 +35,11 @@ func TestChangefeedRemoveCli(t *testing.T) { cf.EXPECT().Get(gomock.Any(), "test", "abc").Return(&v2.ChangeFeedInfo{}, nil) cf.EXPECT().Delete(gomock.Any(), "test", "abc").Return(nil) cf.EXPECT().Get(gomock.Any(), "test", "abc").Return(nil, - cerror.ErrChangeFeedNotExists.GenWithStackByArgs("abc")) + errors.ErrChangeFeedNotExists.GenWithStackByArgs("abc")) os.Args = []string{"remove", "--changefeed-id=abc", "--keyspace=test"} require.Nil(t, cmd.Execute()) cf.EXPECT().Get(gomock.Any(), "default", "abc").Return(nil, - cerror.ErrChangeFeedNotExists.GenWithStackByArgs("abc")) + errors.ErrChangeFeedNotExists.GenWithStackByArgs("abc")) os.Args = []string{"remove", "--changefeed-id=abc", "--keyspace=default"} require.Nil(t, cmd.Execute()) diff --git a/cmd/cdc/cli/cli_changefeed_resume.go b/cmd/cdc/cli/cli_changefeed_resume.go index 4565b3b47a..6475d23eef 100644 --- a/cmd/cdc/cli/cli_changefeed_resume.go +++ b/cmd/cdc/cli/cli_changefeed_resume.go @@ -22,7 +22,7 @@ import ( "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiClient "github.com/pingcap/ticdc/pkg/api/v2" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" putil "github.com/pingcap/ticdc/pkg/util" "github.com/spf13/cobra" "github.com/tikv/client-go/v2/oracle" @@ -180,15 +180,15 @@ func (o *resumeChangefeedOptions) validateParams(ctx context.Context) error { checkpointTs, err := strconv.ParseUint(o.overwriteCheckpointTs, 10, 64) if err != nil { - return cerror.ErrCliInvalidCheckpointTs.GenWithStackByArgs(o.overwriteCheckpointTs) + return errors.ErrCliInvalidCheckpointTs.GenWithStackByArgs(o.overwriteCheckpointTs) } if checkpointTs == 0 { - return cerror.ErrCliInvalidCheckpointTs.GenWithStackByArgs(o.overwriteCheckpointTs) + return errors.ErrCliInvalidCheckpointTs.GenWithStackByArgs(o.overwriteCheckpointTs) } if checkpointTs > oracle.ComposeTS(tso.Timestamp, tso.LogicTime) { - return cerror.ErrCliCheckpointTsIsInFuture.GenWithStackByArgs(checkpointTs) + return errors.ErrCliCheckpointTsIsInFuture.GenWithStackByArgs(checkpointTs) } o.checkpointTs = checkpointTs diff --git a/cmd/cdc/cli/cli_changefeed_resume_test.go b/cmd/cdc/cli/cli_changefeed_resume_test.go index 1af5034509..e7e309af20 100644 --- a/cmd/cdc/cli/cli_changefeed_resume_test.go +++ b/cmd/cdc/cli/cli_changefeed_resume_test.go @@ -20,10 +20,9 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "github.com/tikv/client-go/v2/oracle" ) @@ -176,7 +175,7 @@ func TestChangefeedResumeWithNewCheckpointTs(t *testing.T) { f.changefeeds.EXPECT().Resume(gomock.Any(), &v2.ResumeChangefeedConfig{ OverwriteCheckpointTs: 262144, }, gomock.Any(), "abc"). - Return(cerror.ErrStartTsBeforeGC) + Return(errors.ErrStartTsBeforeGC) o.overwriteCheckpointTs = "262144" require.NotNil(t, o.run(cmd)) } diff --git a/cmd/cdc/cli/cli_changefeed_update_test.go b/cmd/cdc/cli/cli_changefeed_update_test.go index 1b8e439222..b7a81e36bb 100644 --- a/cmd/cdc/cli/cli_changefeed_update_test.go +++ b/cmd/cdc/cli/cli_changefeed_update_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/config" diff --git a/cmd/cdc/cli/cli_unsafe.go b/cmd/cdc/cli/cli_unsafe.go index 780812568c..b7e31f41b3 100644 --- a/cmd/cdc/cli/cli_unsafe.go +++ b/cmd/cdc/cli/cli_unsafe.go @@ -14,7 +14,7 @@ package cli import ( - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/spf13/cobra" ) diff --git a/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go b/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go index 21956a6f3b..570311a036 100644 --- a/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go +++ b/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go @@ -16,7 +16,7 @@ package cli import ( "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" diff --git a/cmd/cdc/cli/cli_unsafe_reset.go b/cmd/cdc/cli/cli_unsafe_reset.go index 086fd8fa9d..cdf242f466 100644 --- a/cmd/cdc/cli/cli_unsafe_reset.go +++ b/cmd/cdc/cli/cli_unsafe_reset.go @@ -16,7 +16,7 @@ package cli import ( "context" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" diff --git a/cmd/cdc/cli/cli_unsafe_show_metadata.go b/cmd/cdc/cli/cli_unsafe_show_metadata.go index 2c89c875d0..7234aa7655 100644 --- a/cmd/cdc/cli/cli_unsafe_show_metadata.go +++ b/cmd/cdc/cli/cli_unsafe_show_metadata.go @@ -14,7 +14,7 @@ package cli import ( - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" diff --git a/cmd/cdc/redo/apply.go b/cmd/cdc/redo/apply.go index 585f21176d..730432ad0b 100644 --- a/cmd/cdc/redo/apply.go +++ b/cmd/cdc/redo/apply.go @@ -22,7 +22,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/applier" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/logger" "github.com/pingcap/ticdc/pkg/util" "github.com/spf13/cobra" @@ -59,7 +59,7 @@ func (o *applyRedoOptions) complete(cmd *cobra.Command) error { // parse sinkURI as a URI sinkURI, err := url.Parse(o.sinkURI) if err != nil { - return cerror.WrapError(cerror.ErrSinkURIInvalid, err) + return errors.WrapError(errors.ErrSinkURIInvalid, err) } rawQuery := sinkURI.Query() // set safe-mode to true if not set diff --git a/cmd/cdc/server/server.go b/cmd/cdc/server/server.go index 78f89a58a1..4fe4f69655 100644 --- a/cmd/cdc/server/server.go +++ b/cmd/cdc/server/server.go @@ -22,7 +22,7 @@ import ( "time" "github.com/fatih/color" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/pkg/config" diff --git a/cmd/cdc/server/server_redact_test.go b/cmd/cdc/server/server_redact_test.go index 331d0ffd63..6814be7119 100644 --- a/cmd/cdc/server/server_redact_test.go +++ b/cmd/cdc/server/server_redact_test.go @@ -16,7 +16,7 @@ package server import ( "testing" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/util" "github.com/stretchr/testify/require" diff --git a/cmd/cdc/server/server_test.go b/cmd/cdc/server/server_test.go index f906e30f4a..e0d43f2963 100644 --- a/cmd/cdc/server/server_test.go +++ b/cmd/cdc/server/server_test.go @@ -18,7 +18,7 @@ import ( "strings" "testing" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -141,7 +141,7 @@ func TestIsNormalServerShutdown(t *testing.T) { }, { name: "wrapped context canceled by shutdown", - err: cerror.Trace(context.Canceled), + err: errors.Trace(context.Canceled), cancelCtx: true, expected: true, }, @@ -152,12 +152,12 @@ func TestIsNormalServerShutdown(t *testing.T) { }, { name: "wrapped context canceled without shutdown", - err: cerror.Trace(context.Canceled), + err: errors.Trace(context.Canceled), expected: false, }, { name: "other error", - err: cerror.New("boom"), + err: errors.New("boom"), expected: false, }, } diff --git a/cmd/kafka-consumer/consumer.go b/cmd/kafka-consumer/consumer.go index f88a67bae4..0e458cd913 100644 --- a/cmd/kafka-consumer/consumer.go +++ b/cmd/kafka-consumer/consumer.go @@ -46,11 +46,8 @@ func getPartitionNum(o *option) (int32, error) { for i := 0; i <= 30; i++ { resp, err := admin.GetMetadata(&o.topic, false, timeout) if err != nil { - if func() kafka.Error { - var target kafka.Error - _ = errors.As(err, &target) - return target - }().Code() == kafka.ErrTransport { + var target kafka.Error + if errors.As(err, &target) && target.Code() == kafka.ErrTransport { log.Info("retry get partition number", zap.Int("retryTime", i), zap.Int("timeout", timeout)) timeout += 100 continue diff --git a/cmd/kafka-consumer/writer.go b/cmd/kafka-consumer/writer.go index 3962d088e0..821eddd0b7 100644 --- a/cmd/kafka-consumer/writer.go +++ b/cmd/kafka-consumer/writer.go @@ -64,7 +64,7 @@ func (p *partitionProgress) updateWatermark(newWatermark uint64, offset kafka.Of zap.Uint64("watermark", newWatermark)) return } - readOldOffset := !(offset > p.watermarkOffset) + readOldOffset := offset <= p.watermarkOffset log.Warn("partition resolved ts fall back, ignore it", zap.Bool("readOldOffset", readOldOffset), diff --git a/cmd/oauth2-server/main.go b/cmd/oauth2-server/main.go index 5ee68f13c1..3ea7730f75 100644 --- a/cmd/oauth2-server/main.go +++ b/cmd/oauth2-server/main.go @@ -152,8 +152,8 @@ func run(_ *cobra.Command, _ []string) { } }))) http.Handle("/.well-known/openid-configuration", logMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - _, _ = fmt.Fprintf(w, openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port) - w.WriteHeader(200) + w.Header().Set("Content-Type", "application/json") + fmt.Fprintf(w, openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port) }))) log.Info("starting auth2 server", zap.Int("port", serverConfig.port)) log.Panic("run auth2 server failed", zap.Error(http.ListenAndServe(fmt.Sprintf(":%d", serverConfig.port), nil))) diff --git a/cmd/storage-consumer/consumer.go b/cmd/storage-consumer/consumer.go index 00020124c4..172bf17f87 100644 --- a/cmd/storage-consumer/consumer.go +++ b/cmd/storage-consumer/consumer.go @@ -21,7 +21,7 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/downstreamadapter/sink" diff --git a/coordinator/changefeed/backoff.go b/coordinator/changefeed/backoff.go index 42fed64c68..224d0dfee8 100644 --- a/coordinator/changefeed/backoff.go +++ b/coordinator/changefeed/backoff.go @@ -17,12 +17,11 @@ import ( "time" "github.com/cenkalti/backoff/v4" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/atomic" "go.uber.org/zap" ) @@ -182,13 +181,13 @@ func (m *Backoff) StartFinished() { // ShouldFailChangefeed return true if a running error contains a changefeed not retry error. func ShouldFailChangefeed(e *heartbeatpb.RunningError) bool { - return cerrors.ShouldFailChangefeed(errors.New(e.Message + e.Code)) + return errors.ShouldFailChangefeed(errors.New(e.Message + e.Code)) } func (m *Backoff) HandleError(errs []*heartbeatpb.RunningError) (bool, *heartbeatpb.RunningError) { // if there are a fastFail error in errs, we can just fastFail the changefeed for _, err := range errs { - if cerrors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(err.Code)) || + if errors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(err.Code)) || ShouldFailChangefeed(err) { return true, err } diff --git a/coordinator/changefeed/etcd_backend.go b/coordinator/changefeed/etcd_backend.go index 6d9de399e3..e9a922e190 100644 --- a/coordinator/changefeed/etcd_backend.go +++ b/coordinator/changefeed/etcd_backend.go @@ -19,11 +19,10 @@ import ( "fmt" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" @@ -154,7 +153,7 @@ func (b *EtcdBackend) CreateChangefeed(ctx context.Context, return errors.Trace(err) } if !resp.Succeeded { - err = cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("create changefeed %s", info.ChangefeedID.Name())) + err = errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("create changefeed %s", info.ChangefeedID.Name())) return errors.Trace(err) } return nil @@ -186,7 +185,7 @@ func (b *EtcdBackend) UpdateChangefeed(ctx context.Context, info *config.ChangeF return errors.Trace(err) } if !putResp.Succeeded { - err = cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("update changefeed %s failed", info.ChangefeedID.Name())) + err = errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("update changefeed %s failed", info.ChangefeedID.Name())) return errors.Trace(err) } return nil @@ -223,7 +222,7 @@ func (b *EtcdBackend) PauseChangefeed(ctx context.Context, id common.ChangeFeedI return errors.Trace(err) } if !putResp.Succeeded { - err = cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("pause changefeed %s failed", id.DisplayName)) + err = errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("pause changefeed %s failed", id.DisplayName)) return errors.Trace(err) } return nil @@ -242,7 +241,7 @@ func (b *EtcdBackend) DeleteChangefeed(ctx context.Context, return errors.Trace(err) } if !resp.Succeeded { - err = cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("delete changefeed %s", changefeedID.Name())) + err = errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("delete changefeed %s", changefeedID.Name())) return errors.Trace(err) } return nil @@ -284,7 +283,7 @@ func (b *EtcdBackend) ResumeChangefeed(ctx context.Context, return errors.Trace(err) } if !putResp.Succeeded { - err = cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("resume changefeed %s", info.ChangefeedID.Name())) + err = errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("resume changefeed %s", info.ChangefeedID.Name())) return errors.Trace(err) } return nil @@ -336,7 +335,7 @@ func (b *EtcdBackend) SetChangefeedProgress(ctx context.Context, id common.Chang } } - err := cerror.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("update changefeed to %s-%d", id.DisplayName, progress)) + err := errors.ErrMetaOpFailed.GenWithStackByArgs(fmt.Sprintf("update changefeed to %s-%d", id.DisplayName, progress)) return errors.Trace(err) } diff --git a/coordinator/changefeed/etcd_backend_test.go b/coordinator/changefeed/etcd_backend_test.go index 223c1db098..530a704988 100644 --- a/coordinator/changefeed/etcd_backend_test.go +++ b/coordinator/changefeed/etcd_backend_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/etcd" diff --git a/downstreamadapter/dispatchermanager/heartbeat_collector.go b/downstreamadapter/dispatchermanager/heartbeat_collector.go index 99ef678b14..9727118da4 100644 --- a/downstreamadapter/dispatchermanager/heartbeat_collector.go +++ b/downstreamadapter/dispatchermanager/heartbeat_collector.go @@ -18,7 +18,7 @@ import ( "sync" "sync/atomic" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/downstreamadapter/dispatcher" "github.com/pingcap/ticdc/heartbeatpb" diff --git a/downstreamadapter/sink/eventrouter/event_router.go b/downstreamadapter/sink/eventrouter/event_router.go index c29f94c22a..9b710f6855 100644 --- a/downstreamadapter/sink/eventrouter/event_router.go +++ b/downstreamadapter/sink/eventrouter/event_router.go @@ -20,7 +20,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" tableFilter "github.com/pingcap/tidb/pkg/util/table-filter" ) @@ -55,7 +55,7 @@ func NewEventRouter( for _, ruleConfig := range ruleConfigs { f, err := tableFilter.Parse(ruleConfig.Matcher) if err != nil { - return nil, cerror.WrapError(cerror.ErrFilterRuleInvalid, err, ruleConfig.Matcher) + return nil, errors.WrapError(errors.ErrFilterRuleInvalid, err, ruleConfig.Matcher) } if !util.GetOrZero(sinkConfig.CaseSensitive) { f = tableFilter.CaseInsensitive(f) @@ -163,14 +163,14 @@ func (s *EventRouter) VerifyTables(infos []*common.TableInfo) error { if v.IndexName != "" { index := table.GetIndex(v.IndexName) if index == nil { - return cerror.ErrDispatcherFailed.GenWithStack( + return errors.ErrDispatcherFailed.GenWithStack( "index not found when verify the table, table: %v, index: %s", table.TableName, v.IndexName) } // only allow the unique index to be set. // For the non-unique index, if any column belongs to the index is updated, // the event is not split, it may cause incorrect data consumption. if !index.Unique { - return cerror.ErrDispatcherFailed.GenWithStack( + return errors.ErrDispatcherFailed.GenWithStack( "index is not unique when verify the table, table: %v, index: %s", table.TableName, v.IndexName) } } diff --git a/downstreamadapter/sink/kafka/sink_test.go b/downstreamadapter/sink/kafka/sink_test.go index bfbd704901..0b3f56103c 100644 --- a/downstreamadapter/sink/kafka/sink_test.go +++ b/downstreamadapter/sink/kafka/sink_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/IBM/sarama/mocks" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/downstreamadapter/sink/helper" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" diff --git a/downstreamadapter/sink/pulsar/sink_test.go b/downstreamadapter/sink/pulsar/sink_test.go index 3e8d104baf..cfa8d39b06 100644 --- a/downstreamadapter/sink/pulsar/sink_test.go +++ b/downstreamadapter/sink/pulsar/sink_test.go @@ -22,9 +22,9 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/pingcap/ticdc/downstreamadapter/sink/helper" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/utils/chann" "github.com/stretchr/testify/require" @@ -142,7 +142,7 @@ func TestPulsarSinkBatchConfig(t *testing.T) { func TestPulsarSinkNewWithComponentReturnsDMLProducerError(t *testing.T) { changefeedID := common.NewChangefeedID4Test("test", "test") - expectedErr := cerror.ErrPulsarNewProducer.GenWithStackByArgs() + expectedErr := errors.ErrPulsarNewProducer.GenWithStackByArgs() ddlProducerCreated := false var err error @@ -171,7 +171,7 @@ func TestPulsarSinkNewWithComponentReturnsDMLProducerError(t *testing.T) { func TestPulsarSinkNewWithComponentReturnsDDLProducerError(t *testing.T) { changefeedID := common.NewChangefeedID4Test("test", "test") - expectedErr := cerror.ErrPulsarNewProducer.GenWithStackByArgs() + expectedErr := errors.ErrPulsarNewProducer.GenWithStackByArgs() var err error require.NotPanics(t, func() { diff --git a/downstreamadapter/sink/topicmanager/kafka_topic_manager.go b/downstreamadapter/sink/topicmanager/kafka_topic_manager.go index c6963573d8..42127903cd 100644 --- a/downstreamadapter/sink/topicmanager/kafka_topic_manager.go +++ b/downstreamadapter/sink/topicmanager/kafka_topic_manager.go @@ -19,10 +19,9 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/sink/kafka" "go.uber.org/zap" @@ -66,7 +65,7 @@ func GetTopicManagerAndTryCreateTopic( ) if _, err := topicManager.CreateTopicAndWaitUntilVisible(ctx, topic); err != nil { - return nil, cerror.WrapError(cerror.ErrKafkaCreateTopic, err) + return nil, errors.WrapError(errors.ErrKafkaCreateTopic, err) } return topicManager, nil @@ -248,7 +247,7 @@ func (m *kafkaTopicManager) createTopic( topicName string, ) (int32, error) { if !m.cfg.AutoCreate { - return 0, cerror.ErrKafkaInvalidConfig.GenWithStack( + return 0, errors.ErrKafkaInvalidConfig.GenWithStack( fmt.Sprintf("`auto-create-topic` is false, "+ "and %s not found", topicName)) } @@ -270,7 +269,7 @@ func (m *kafkaTopicManager) createTopic( zap.Error(err), zap.Duration("duration", time.Since(start)), ) - return 0, cerror.WrapError(cerror.ErrKafkaCreateTopic, err) + return 0, errors.WrapError(errors.ErrKafkaCreateTopic, err) } log.Info( diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index beb98e6257..ced52fb225 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -27,7 +27,7 @@ import ( "github.com/cockroachdb/pebble" "github.com/klauspost/compress/zstd" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/logservice/logpuller" diff --git a/logservice/logpuller/errors.go b/logservice/logpuller/errors.go index eb25ad7059..fdd2b30225 100644 --- a/logservice/logpuller/errors.go +++ b/logservice/logpuller/errors.go @@ -16,7 +16,7 @@ package logpuller import ( "fmt" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/tikv/client-go/v2/tikv" ) diff --git a/logservice/logpuller/priority_queue.go b/logservice/logpuller/priority_queue.go index f19b6d34b9..c2838240f6 100644 --- a/logservice/logpuller/priority_queue.go +++ b/logservice/logpuller/priority_queue.go @@ -17,7 +17,7 @@ import ( "context" "sync" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/utils/heap" ) diff --git a/logservice/logpuller/region_request_worker.go b/logservice/logpuller/region_request_worker.go index db2d611836..82c6a99e58 100644 --- a/logservice/logpuller/region_request_worker.go +++ b/logservice/logpuller/region_request_worker.go @@ -19,12 +19,11 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/pkg/version" @@ -105,14 +104,14 @@ func newRegionRequestWorker( } var regionErr error if err := version.CheckStoreVersion(ctx, worker.client.pd); err != nil { - if cerror.Is(errors.Cause(err), context.Canceled) { + if errors.Is(errors.Cause(err), context.Canceled) { return nil } log.Error("event feed check store version fails", zap.Uint64("workerID", worker.workerID), zap.String("addr", worker.store.storeAddr), zap.Error(err)) - if cerror.Is(err, cerror.ErrGetAllStoresFailed) { + if errors.Is(err, errors.ErrGetAllStoresFailed) { regionErr = &getStoreErr{} } else { regionErr = &storeStreamErr{} diff --git a/logservice/logpuller/region_request_worker_test.go b/logservice/logpuller/region_request_worker_test.go index f9752a0eb3..f36cfb3a86 100644 --- a/logservice/logpuller/region_request_worker_test.go +++ b/logservice/logpuller/region_request_worker_test.go @@ -18,7 +18,7 @@ import ( "io" "testing" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/ticdc/logservice/logpuller/regionlock" diff --git a/logservice/logpuller/subscription_client.go b/logservice/logpuller/subscription_client.go index 93896e7c73..c9ca36814d 100644 --- a/logservice/logpuller/subscription_client.go +++ b/logservice/logpuller/subscription_client.go @@ -19,7 +19,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" @@ -28,7 +28,6 @@ import ( "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" @@ -845,7 +844,7 @@ func (s *subscriptionClient) handleErrors(ctx context.Context) error { func (s *subscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error { err := errors.Cause(errInfo.err) var rcErr *requestCancelledErr - if !cerror.As(err, &rcErr) { + if !errors.As(err, &rcErr) { log.Debug("cdc region error", zap.Uint64("subscriptionID", uint64(errInfo.subscribedSpan.subID)), zap.Uint64("regionID", errInfo.verID.GetID()), @@ -887,10 +886,10 @@ func (s *subscriptionClient) doHandleError(ctx context.Context, errInfo regionEr return errors.New("duplicate request") } if compatibility := innerErr.GetCompatibility(); compatibility != nil { - return cerror.ErrVersionIncompatible.GenWithStackByArgs(compatibility) + return errors.ErrVersionIncompatible.GenWithStackByArgs(compatibility) } if mismatch := innerErr.GetClusterIdMismatch(); mismatch != nil { - return cerror.ErrClusterIDMismatch.GenWithStackByArgs(mismatch.Current, mismatch.Request) + return errors.ErrClusterIDMismatch.GenWithStackByArgs(mismatch.Current, mismatch.Request) } log.Warn("empty or unknown cdc error", diff --git a/logservice/logpuller/subscription_client_test.go b/logservice/logpuller/subscription_client_test.go index 0b782cfa76..bdd64d6e03 100644 --- a/logservice/logpuller/subscription_client_test.go +++ b/logservice/logpuller/subscription_client_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/logservice/logpuller/regionlock" diff --git a/logservice/schemastore/gc_keeper_test.go b/logservice/schemastore/gc_keeper_test.go index 756944f4a6..a968788881 100644 --- a/logservice/schemastore/gc_keeper_test.go +++ b/logservice/schemastore/gc_keeper_test.go @@ -20,7 +20,7 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/config/kerneltype" diff --git a/logservice/schemastore/persist_storage_ddl_handlers.go b/logservice/schemastore/persist_storage_ddl_handlers.go index 58170d8c86..77f78e331f 100644 --- a/logservice/schemastore/persist_storage_ddl_handlers.go +++ b/logservice/schemastore/persist_storage_ddl_handlers.go @@ -14,14 +14,13 @@ package schemastore import ( - "errors" "fmt" "strings" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser" @@ -2321,7 +2320,7 @@ func buildDDLEventForRenameTable(rawEvent *PersistedDDLEvent, tableFilter filter } } else if !ignoreCurrentTable { // ignorePrevTable & !ignoreCurrentTable is not allowed as in: https://docs.pingcap.com/tidb/dev/ticdc-ddl - ddlEvent.Err = cerror.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() + ddlEvent.Err = errors.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() } else { // if the table is both filtered out before and after rename table, the ddl should not be fetched log.Panic("should not build a ignored rename table ddl", @@ -2379,7 +2378,7 @@ func buildDDLEventForRenameTable(rawEvent *PersistedDDLEvent, tableFilter filter } } else if !ignoreCurrentTable { // ignorePrevTable & !ignoreCurrentTable is not allowed as in: https://docs.pingcap.com/tidb/dev/ticdc-ddl - ddlEvent.Err = cerror.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() + ddlEvent.Err = errors.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() } else { // if the table is both filtered out before and after rename table, the ddl should not be fetched log.Panic("should not build a ignored rename table ddl", @@ -2759,7 +2758,7 @@ func buildDDLEventForRenameTables(rawEvent *PersistedDDLEvent, tableFilter filte } } else if !ignoreCurrentTable { // ignorePrevTable & !ignoreCurrentTable is not allowed as in: https://docs.pingcap.com/tidb/dev/ticdc-ddl - ddlEvent.Err = cerror.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() + ddlEvent.Err = errors.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() } else { // if the table is both filtered out before and after rename table, ignore } @@ -2826,7 +2825,7 @@ func buildDDLEventForRenameTables(rawEvent *PersistedDDLEvent, tableFilter filte } } else if !ignoreCurrentTable { // ignorePrevTable & !ignoreCurrentTable is not allowed as in: https://docs.pingcap.com/tidb/dev/ticdc-ddl - ddlEvent.Err = cerror.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() + ddlEvent.Err = errors.ErrSyncRenameTableFailed.GenWithStackByArgs(rawEvent.TableID, rawEvent.Query).Error() } else { // ignore } diff --git a/logservice/schemastore/schema_store_test.go b/logservice/schemastore/schema_store_test.go index 6168bef86f..ee834493d0 100644 --- a/logservice/schemastore/schema_store_test.go +++ b/logservice/schemastore/schema_store_test.go @@ -20,7 +20,7 @@ import ( "github.com/pingcap/log" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/stretchr/testify/require" "go.uber.org/zap" @@ -124,7 +124,7 @@ func TestGetAllPhysicalTablesReturnsSnapshotLostByGCError(t *testing.T) { _, err := pstorage.getAllPhysicalTables(99, nil) require.Error(t, err) - require.True(t, cerror.ErrSnapshotLostByGC.Equal(err)) + require.True(t, errors.ErrSnapshotLostByGC.Equal(err)) require.Contains(t, err.Error(), "checkpoint-ts 99 is earlier than or equal to GC safepoint at 100") require.NotContains(t, err.Error(), "%!d") } diff --git a/logservice/schemastore/utils.go b/logservice/schemastore/utils.go index 0b54043f9c..ffb102c516 100644 --- a/logservice/schemastore/utils.go +++ b/logservice/schemastore/utils.go @@ -16,7 +16,7 @@ package schemastore import ( "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/tidb/pkg/meta/model" diff --git a/logservice/schemastore/validator.go b/logservice/schemastore/validator.go index 80575f9f8d..3e3a0119b7 100644 --- a/logservice/schemastore/validator.go +++ b/logservice/schemastore/validator.go @@ -18,10 +18,9 @@ import ( "strings" "sync" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" tidbkv "github.com/pingcap/tidb/pkg/kv" timodel "github.com/pingcap/tidb/pkg/meta/model" @@ -177,7 +176,7 @@ func VerifyTables(f filter.Filter, storage tidbkv.Storage, startTs uint64) ( meta := getSnapshotMeta(storage, startTs) dbinfos, err := meta.ListDatabases() if err != nil { - return nil, nil, nil, nil, cerror.WrapError(cerror.ErrMetaListDatabases, err) + return nil, nil, nil, nil, errors.WrapError(errors.ErrMetaListDatabases, err) } verifier := newTableVerifier(f, tableWorkers) @@ -198,7 +197,7 @@ dbLoop: rawTables, err := meta.GetMetasByDBID(dbinfo.ID) if err != nil { - verifier.setErr(cerror.WrapError(cerror.ErrMetaListDatabases, err)) + verifier.setErr(errors.WrapError(errors.ErrMetaListDatabases, err)) break } diff --git a/maintainer/maintainer_controller_test.go b/maintainer/maintainer_controller_test.go index fe263c4a93..2f4cfcecd6 100644 --- a/maintainer/maintainer_controller_test.go +++ b/maintainer/maintainer_controller_test.go @@ -23,13 +23,13 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/maintainer/operator" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/maintainer/testutil" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/eventservice" "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/pdutil" @@ -1462,9 +1462,9 @@ func TestFinishBootstrapReturnsErrorWhenCheckpointMissing(t *testing.T) { }, false) require.Nil(t, postBootstrapRequest) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrChangefeedInitTableTriggerDispatcherFailed.RFCCode(), code) + require.Equal(t, errors.ErrChangefeedInitTableTriggerDispatcherFailed.RFCCode(), code) require.Contains(t, err.Error(), "all bootstrap responses reported empty checkpointTs") require.False(t, controller.bootstrapped) } diff --git a/pkg/api/util.go b/pkg/api/util.go index 465b8a279d..c4a5d16ebf 100644 --- a/pkg/api/util.go +++ b/pkg/api/util.go @@ -19,9 +19,8 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" ) @@ -57,7 +56,7 @@ type HTTPError struct { // NewHTTPError wrap a err into HTTPError func NewHTTPError(err error) HTTPError { - errCode, _ := cerror.RFCCode(err) + errCode, _ := errors.RFCCode(err) return HTTPError{ Error: err.Error(), Code: string(errCode), @@ -66,11 +65,11 @@ func NewHTTPError(err error) HTTPError { // httpBadRequestError is some errors that will cause a BadRequestError in http handler var httpBadRequestError = []*errors.Error{ - cerror.ErrAPIInvalidParam, cerror.ErrSinkURIInvalid, cerror.ErrStartTsBeforeGC, - cerror.ErrChangeFeedNotExists, cerror.ErrTargetTsBeforeStartTs, cerror.ErrTableIneligible, - cerror.ErrFilterRuleInvalid, cerror.ErrChangefeedUpdateRefused, cerror.ErrMySQLConnectionError, - cerror.ErrMySQLInvalidConfig, cerror.ErrCaptureNotExist, cerror.ErrSchedulerRequestFailed, - cerror.ErrActiveActiveTSOIndexIncompatible, + errors.ErrAPIInvalidParam, errors.ErrSinkURIInvalid, errors.ErrStartTsBeforeGC, + errors.ErrChangeFeedNotExists, errors.ErrTargetTsBeforeStartTs, errors.ErrTableIneligible, + errors.ErrFilterRuleInvalid, errors.ErrChangefeedUpdateRefused, errors.ErrMySQLConnectionError, + errors.ErrMySQLInvalidConfig, errors.ErrCaptureNotExist, errors.ErrSchedulerRequestFailed, + errors.ErrActiveActiveTSOIndexIncompatible, } const ( @@ -107,7 +106,7 @@ func IsHTTPBadRequestError(err error) bool { return true } - rfcCode, ok := cerror.RFCCode(err) + rfcCode, ok := errors.RFCCode(err) if ok && e.RFCCode() == rfcCode { return true } diff --git a/pkg/binlog-filter/filter.go b/pkg/binlog-filter/filter.go index cdfb5d97f7..6478dc056f 100644 --- a/pkg/binlog-filter/filter.go +++ b/pkg/binlog-filter/filter.go @@ -17,7 +17,7 @@ import ( "regexp" "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" selector "github.com/pingcap/tidb/pkg/util/table-rule-selector" "go.uber.org/zap" diff --git a/pkg/binlog-filter/filter_test.go b/pkg/binlog-filter/filter_test.go index 5b3ddb0d81..cb04e455bd 100644 --- a/pkg/binlog-filter/filter_test.go +++ b/pkg/binlog-filter/filter_test.go @@ -16,7 +16,7 @@ package filter import ( "testing" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" selector "github.com/pingcap/tidb/pkg/util/table-rule-selector" "github.com/stretchr/testify/require" ) diff --git a/pkg/binlog-filter/util.go b/pkg/binlog-filter/util.go index e076ba62ee..7009495a6c 100644 --- a/pkg/binlog-filter/util.go +++ b/pkg/binlog-filter/util.go @@ -16,7 +16,7 @@ package filter import ( "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/parser/ast" ) diff --git a/pkg/check/active_active_tso_indexes.go b/pkg/check/active_active_tso_indexes.go index b662da5b9a..9587262543 100644 --- a/pkg/check/active_active_tso_indexes.go +++ b/pkg/check/active_active_tso_indexes.go @@ -23,7 +23,6 @@ import ( "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/errors" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/pdutil" pd "github.com/tikv/pd/client" pdhttp "github.com/tikv/pd/client/http" @@ -55,7 +54,7 @@ func ValidateActiveActiveTSOIndexes( changefeedCfg *config.ChangefeedConfig, ) error { if changefeedCfg == nil { - return cerrors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs("changefeed config is nil") + return errors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs("changefeed config is nil") } if !changefeedCfg.EnableActiveActive { return nil @@ -71,8 +70,8 @@ func ValidateActiveActiveTSOIndexes( downUnique, downMax, err := getDownstreamTSOIndexes(ctx, changefeedCfg, sinkURI) if err != nil { - return cerrors.WrapError( - cerrors.ErrActiveActiveTSOIndexIncompatible, + return errors.WrapError( + errors.ErrActiveActiveTSOIndexIncompatible, err, "failed to read downstream tso index config", ) @@ -80,8 +79,8 @@ func ValidateActiveActiveTSOIndexes( upUnique, upMax, err := getUpstreamTSOIndexes(ctx, upPD) if err != nil { - return cerrors.WrapError( - cerrors.ErrActiveActiveTSOIndexIncompatible, + return errors.WrapError( + errors.ErrActiveActiveTSOIndexIncompatible, err, fmt.Sprintf("failed to read upstream tso index config, downstream unique=%d, downstream max=%d", downUnique, downMax), @@ -92,13 +91,13 @@ func ValidateActiveActiveTSOIndexes( // downstream to avoid TSO collisions, while `tso-max-index` must match to guarantee // the same logical index range. if upUnique == downUnique { - return cerrors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs( + return errors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs( fmt.Sprintf("active active tso index mismatch, upstream and downstream share the same tso-unique-index=%d, upstream max=%d, downstream max=%d", upUnique, upMax, downMax), ) } if upMax != downMax { - return cerrors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs( + return errors.ErrActiveActiveTSOIndexIncompatible.GenWithStackByArgs( fmt.Sprintf("active active tso index mismatch, upstream unique=%d, upstream max=%d, downstream unique=%d, downstream max=%d", upUnique, upMax, downUnique, downMax), ) @@ -121,18 +120,18 @@ func getDownstreamTSOIndexes( sinkURI *url.URL, ) (unique int64, max int64, err error) { if changefeedCfg == nil { - return 0, 0, cerrors.New("changefeed config is nil") + return 0, 0, errors.New("changefeed config is nil") } mysqlCfg, db, err := newMySQLConfigAndDBFn(ctx, changefeedCfg.ChangefeedID, sinkURI, changefeedCfg) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } defer func() { _ = db.Close() }() readTimeout, err := time.ParseDuration(mysqlCfg.ReadTimeout) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } // Bound the downstream query by the sink read timeout to keep the validation @@ -142,7 +141,7 @@ func getDownstreamTSOIndexes( rows, err := db.QueryContext(queryCtx, showPDConfigQuery) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } defer func() { _ = rows.Close() }() @@ -157,13 +156,13 @@ func getDownstreamTSOIndexes( // Columns: Type | Instance | Name | Value var typ, instance, name, value string if err := rows.Scan(&typ, &instance, &name, &value); err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } switch name { case pdTSOUniqueIndexKey: parsed, err := strconv.ParseInt(value, 10, 64) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } if !uniqueSet { unique = parsed @@ -171,12 +170,12 @@ func getDownstreamTSOIndexes( continue } if unique != parsed { - return 0, 0, cerrors.New("downstream TiDB reports inconsistent tso-unique-index across instances") + return 0, 0, errors.New("downstream TiDB reports inconsistent tso-unique-index across instances") } case pdTSOMaxIndexKey: parsed, err := strconv.ParseInt(value, 10, 64) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } if !maxSet { max = parsed @@ -184,20 +183,20 @@ func getDownstreamTSOIndexes( continue } if max != parsed { - return 0, 0, cerrors.New("downstream TiDB reports inconsistent tso-max-index across instances") + return 0, 0, errors.New("downstream TiDB reports inconsistent tso-max-index across instances") } default: } } if err := rows.Err(); err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } if !uniqueSet { - return 0, 0, cerrors.Errorf("downstream TiDB does not report %s", pdTSOUniqueIndexKey) + return 0, 0, errors.Errorf("downstream TiDB does not report %s", pdTSOUniqueIndexKey) } if !maxSet { - return 0, 0, cerrors.Errorf("downstream TiDB does not report %s", pdTSOMaxIndexKey) + return 0, 0, errors.Errorf("downstream TiDB does not report %s", pdTSOMaxIndexKey) } return unique, max, nil } @@ -215,27 +214,27 @@ func getUpstreamTSOIndexes( upPD pd.Client, ) (unique int64, max int64, err error) { if upPD == nil { - return 0, 0, cerrors.New("pd client is nil") + return 0, 0, errors.New("pd client is nil") } httpClient, err := newPDHTTPClientFn(upPD) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } defer httpClient.Close() cfg, err := httpClient.GetConfig(ctx) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } unique, err = parsePDConfigInt64(cfg, pdTSOUniqueIndexKey) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } max, err = parsePDConfigInt64(cfg, pdTSOMaxIndexKey) if err != nil { - return 0, 0, cerrors.Trace(err) + return 0, 0, errors.Trace(err) } return unique, max, nil } @@ -243,7 +242,7 @@ func getUpstreamTSOIndexes( func parsePDConfigInt64(cfg map[string]any, key string) (int64, error) { v, ok := cfg[key] if !ok { - return 0, cerrors.Errorf("pd config key not found: %s", key) + return 0, errors.Errorf("pd config key not found: %s", key) } // PD stores `tso-unique-index` and `tso-max-index` as int64 values. @@ -263,16 +262,16 @@ func parsePDConfigInt64(cfg map[string]any, key string) (int64, error) { // on overflow. const maxExactIntInFloat64 = float64(1 << 53) if math.IsNaN(x) || math.IsInf(x, 0) { - return 0, cerrors.New("value is not a finite number") + return 0, errors.New("value is not a finite number") } if math.Trunc(x) != x { - return 0, cerrors.New("value is not an integer") + return 0, errors.New("value is not an integer") } if x > maxExactIntInFloat64 || x < -maxExactIntInFloat64 { - return 0, cerrors.Errorf("value for %s exceeds exact integer range for float64", key) + return 0, errors.Errorf("value for %s exceeds exact integer range for float64", key) } return int64(x), nil default: - return 0, cerrors.Errorf("unexpected value type for %s: %T", key, v) + return 0, errors.Errorf("unexpected value type for %s: %T", key, v) } } diff --git a/pkg/check/active_active_tso_indexes_test.go b/pkg/check/active_active_tso_indexes_test.go index 575f985214..43d4f310ee 100644 --- a/pkg/check/active_active_tso_indexes_test.go +++ b/pkg/check/active_active_tso_indexes_test.go @@ -16,15 +16,14 @@ package check import ( "context" "database/sql" - "errors" "net/url" "regexp" "testing" "github.com/DATA-DOG/go-sqlmock" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" mysqlsink "github.com/pingcap/ticdc/pkg/sink/mysql" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" @@ -79,9 +78,9 @@ func TestValidateActiveActiveTSOIndexes_DownstreamMissingKey(t *testing.T) { EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } @@ -105,9 +104,9 @@ func TestValidateActiveActiveTSOIndexes_DownstreamInconsistentAcrossInstances(t EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } @@ -131,9 +130,9 @@ func TestValidateActiveActiveTSOIndexes_UpstreamReadError(t *testing.T) { EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } @@ -159,9 +158,9 @@ func TestValidateActiveActiveTSOIndexes_UpstreamMissingKey(t *testing.T) { EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } @@ -188,9 +187,9 @@ func TestValidateActiveActiveTSOIndexes_Mismatch(t *testing.T) { EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } @@ -217,9 +216,9 @@ func TestValidateActiveActiveTSOIndexes_MaxIndexMismatch(t *testing.T) { EnableActiveActive: true, }) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) + require.Equal(t, errors.ErrActiveActiveTSOIndexIncompatible.RFCCode(), code) require.NoError(t, mock.ExpectationsWereMet()) } diff --git a/pkg/check/cluster.go b/pkg/check/cluster.go index d320297a94..8bb60081d2 100644 --- a/pkg/check/cluster.go +++ b/pkg/check/cluster.go @@ -23,7 +23,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/mysql" "github.com/pingcap/ticdc/pkg/util" pd "github.com/tikv/pd/client" @@ -50,10 +50,10 @@ func IsSameUpstreamDownstream( ctx context.Context, upPD pd.Client, changefeedCfg *config.ChangefeedConfig, ) (bool, error) { if upPD == nil { - return false, cerrors.New("pd client is nil") + return false, errors.New("pd client is nil") } if changefeedCfg == nil { - return false, cerrors.New("changefeed config is nil") + return false, errors.New("changefeed config is nil") } upID := upPD.GetClusterID(ctx) @@ -74,7 +74,7 @@ func IsSameUpstreamDownstream( log.Error("failed to get cluster ID from sink URI", zap.String("sinkURI", util.MaskSensitiveDataInURI(changefeedCfg.SinkURI)), zap.Error(err)) - return false, cerrors.Trace(err) + return false, errors.Trace(err) } if !isTiDB { return false, nil @@ -103,7 +103,7 @@ func getClusterIDBySinkURI( ) (uint64, string, bool, error) { uri, err := url.Parse(sinkURI) if err != nil { - return 0, "", false, cerrors.WrapError(cerrors.ErrSinkURIInvalid, err, sinkURI) + return 0, "", false, errors.WrapError(errors.ErrSinkURIInvalid, err, sinkURI) } scheme := config.GetScheme(uri) @@ -113,7 +113,7 @@ func getClusterIDBySinkURI( _, db, err := newMySQLConfigAndDBFn(ctx, changefeedCfg.ChangefeedID, uri, changefeedCfg) if err != nil { - return 0, "", true, cerrors.Trace(err) + return 0, "", true, errors.Trace(err) } defer func() { _ = db.Close() }() @@ -133,7 +133,7 @@ func getClusterIDBySinkURI( } clusterID, err := strconv.ParseUint(clusterIDStr, 10, 64) if err != nil { - return 0, "", true, cerrors.Trace(err) + return 0, "", true, errors.Trace(err) } keyspace, err := getTiDBKeyspaceName(ctx, db) @@ -154,7 +154,7 @@ func getTiDBKeyspaceName(ctx context.Context, db *sql.DB) (string, error) { rows, err := db.QueryContext(ctx, "show config where type = 'tidb' and name = 'keyspace-name'") if err != nil { - return "", cerrors.Trace(err) + return "", errors.Trace(err) } defer func() { _ = rows.Close() }() @@ -164,7 +164,7 @@ func getTiDBKeyspaceName(ctx context.Context, db *sql.DB) (string, error) { // Columns: Type | Instance | Name | Value var typ, instance, name, value string if err := rows.Scan(&typ, &instance, &name, &value); err != nil { - return "", cerrors.Trace(err) + return "", errors.Trace(err) } if !hasRow { keyspace = value @@ -172,14 +172,14 @@ func getTiDBKeyspaceName(ctx context.Context, db *sql.DB) (string, error) { continue } if value != keyspace { - return "", cerrors.New("downstream TiDB reports inconsistent keyspace-name across instances") + return "", errors.New("downstream TiDB reports inconsistent keyspace-name across instances") } } if err := rows.Err(); err != nil { - return "", cerrors.Trace(err) + return "", errors.Trace(err) } if !hasRow { - return "", cerrors.Trace(sql.ErrNoRows) + return "", errors.Trace(sql.ErrNoRows) } return keyspace, nil } diff --git a/pkg/check/cluster_test.go b/pkg/check/cluster_test.go index 88ee9863ac..c08bd2f15c 100644 --- a/pkg/check/cluster_test.go +++ b/pkg/check/cluster_test.go @@ -16,15 +16,14 @@ package check import ( "context" "database/sql" - "errors" "net/url" "regexp" "testing" "github.com/DATA-DOG/go-sqlmock" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" mysqlsink "github.com/pingcap/ticdc/pkg/sink/mysql" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" @@ -68,9 +67,9 @@ func TestGetClusterIDBySinkURI(t *testing.T) { t.Run("invalid uri", func(t *testing.T) { id, keyspace, isTiDB, err := getClusterIDBySinkURI(context.Background(), "mysql://[::1", changefeedCfg) require.Error(t, err) - code, ok := cerrors.RFCCode(err) + code, ok := errors.RFCCode(err) require.True(t, ok) - require.Equal(t, cerrors.ErrSinkURIInvalid.RFCCode(), code) + require.Equal(t, errors.ErrSinkURIInvalid.RFCCode(), code) require.False(t, isTiDB) require.Equal(t, uint64(0), id) require.Equal(t, "", keyspace) diff --git a/pkg/common/event/checksum.go b/pkg/common/event/checksum.go index d1db84c4de..3e93c8df35 100644 --- a/pkg/common/event/checksum.go +++ b/pkg/common/event/checksum.go @@ -16,7 +16,7 @@ package event import ( "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/tidb/pkg/kv" diff --git a/pkg/common/event/chunk.go b/pkg/common/event/chunk.go index 7b81707a1a..6ff52bd4b5 100644 --- a/pkg/common/event/chunk.go +++ b/pkg/common/event/chunk.go @@ -19,7 +19,7 @@ import ( "time" "unsafe" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/tidb/pkg/kv" diff --git a/pkg/common/event/codec.go b/pkg/common/event/codec.go index 1a17038f2d..b6ed9438e5 100644 --- a/pkg/common/event/codec.go +++ b/pkg/common/event/codec.go @@ -17,9 +17,8 @@ import ( "bytes" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/tablecodec" @@ -61,12 +60,12 @@ const ( func decodeTableID(key []byte) (rest []byte, tableID int64, err error) { if len(key) < prefixTableIDLen || !bytes.HasPrefix(key, tablePrefix) { - return nil, 0, cerror.ErrInvalidRecordKey.GenWithStackByArgs(key) + return nil, 0, errors.ErrInvalidRecordKey.GenWithStackByArgs(key) } key = key[tablePrefixLen:] rest, tableID, err = codec.DecodeInt(key) if err != nil { - return nil, 0, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, 0, errors.WrapError(errors.ErrCodecDecode, err) } return } @@ -106,22 +105,22 @@ func decodeRowV1(b []byte, tableInfo *common.TableInfo, tz *time.Location) (map[ // Get col id. data, b, err = codec.CutOne(b) if err != nil { - return nil, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, errors.WrapError(errors.ErrCodecDecode, err) } _, cid, err := codec.DecodeOne(data) if err != nil { - return nil, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, errors.WrapError(errors.ErrCodecDecode, err) } id := cid.GetInt64() // Get col value. data, b, err = codec.CutOne(b) if err != nil { - return nil, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, errors.WrapError(errors.ErrCodecDecode, err) } _, v, err := codec.DecodeOne(data) if err != nil { - return nil, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, errors.WrapError(errors.ErrCodecDecode, err) } // unflatten value @@ -133,7 +132,7 @@ func decodeRowV1(b []byte, tableInfo *common.TableInfo, tz *time.Location) (map[ fieldType := &colInfo.FieldType datum, err := unflatten(v, fieldType, tz) if err != nil { - return nil, cerror.WrapError(cerror.ErrCodecDecode, err) + return nil, errors.WrapError(errors.ErrCodecDecode, err) } row[id] = datum } @@ -149,7 +148,7 @@ func decodeRowV2( ) (map[int64]types.Datum, error) { datums, err := decoder.DecodeToDatumMap(data, nil) if err != nil { - return datums, cerror.WrapError(cerror.ErrDecodeRowToDatum, err) + return datums, errors.WrapError(errors.ErrDecodeRowToDatum, err) } return datums, nil } @@ -174,12 +173,12 @@ func unflatten(datum types.Datum, ft *types.FieldType, loc *time.Location) (type var err error err = t.FromPackedUint(datum.GetUint64()) if err != nil { - return datum, cerror.WrapError(cerror.ErrDatumUnflatten, err) + return datum, errors.WrapError(errors.ErrDatumUnflatten, err) } if ft.GetType() == mysql.TypeTimestamp && !t.IsZero() { err = t.ConvertTimeZone(time.UTC, loc) if err != nil { - return datum, cerror.WrapError(cerror.ErrDatumUnflatten, err) + return datum, errors.WrapError(errors.ErrDatumUnflatten, err) } } datum.SetUint64(0) @@ -200,7 +199,7 @@ func unflatten(datum types.Datum, ft *types.FieldType, loc *time.Location) (type case mysql.TypeSet: set, err := types.ParseSetValue(ft.GetElems(), datum.GetUint64()) if err != nil { - return datum, cerror.WrapError(cerror.ErrDatumUnflatten, err) + return datum, errors.WrapError(errors.ErrDatumUnflatten, err) } datum.SetMysqlSet(set, ft.GetCollate()) return datum, nil diff --git a/pkg/common/event/dml_event_redaction_test.go b/pkg/common/event/dml_event_redaction_test.go index f87923fe0f..7cda639581 100644 --- a/pkg/common/event/dml_event_redaction_test.go +++ b/pkg/common/event/dml_event_redaction_test.go @@ -16,7 +16,7 @@ package event import ( "testing" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/chunk" "github.com/stretchr/testify/require" diff --git a/pkg/common/span_op.go b/pkg/common/span_op.go index 16033dc2e8..f63d36b1ca 100644 --- a/pkg/common/span_op.go +++ b/pkg/common/span_op.go @@ -16,12 +16,11 @@ package common import ( "bytes" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/config/kerneltype" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/metadef" "github.com/pingcap/tidb/pkg/tablecodec" @@ -115,7 +114,7 @@ func GetKeyspaceTableRange(keyspaceID uint32, tableID int64) (startKey, endKey [ // DefaultKeyspaceID is not a valid keyspaceID on Next Gen if keyspaceID == DefaultKeyspaceID { - return startKey, endKey, errors.Trace(cerror.ErrKeyspaceIDInvalid) + return startKey, endKey, errors.Trace(errors.ErrKeyspaceIDInvalid) } // The tikv.NewCodecV2 method requires a keyspace meta diff --git a/pkg/common/urls.go b/pkg/common/urls.go index c00d0b1afa..a00ffdccc0 100644 --- a/pkg/common/urls.go +++ b/pkg/common/urls.go @@ -19,8 +19,7 @@ import ( "sort" "strings" - "github.com/pingcap/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // URLs defines a slice of URLs as a type @@ -30,24 +29,24 @@ type URLs []url.URL func NewURLs(strs []string) (URLs, error) { all := make([]url.URL, len(strs)) if len(all) == 0 { - return nil, cerror.WrapError(cerror.ErrURLFormatInvalid, errors.New("no valid URLs given")) + return nil, errors.WrapError(errors.ErrURLFormatInvalid, errors.New("no valid URLs given")) } for i, in := range strs { in = strings.TrimSpace(in) u, err := url.Parse(in) if err != nil { - return nil, cerror.WrapError(cerror.ErrURLFormatInvalid, err) + return nil, errors.WrapError(errors.ErrURLFormatInvalid, err) } if u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "unix" && u.Scheme != "unixs" { - return nil, cerror.WrapError(cerror.ErrURLFormatInvalid, + return nil, errors.WrapError(errors.ErrURLFormatInvalid, errors.Errorf("URL scheme must be http, https, unix, or unixs: %s", in)) } if _, _, err := net.SplitHostPort(u.Host); err != nil { - return nil, cerror.WrapError(cerror.ErrURLFormatInvalid, + return nil, errors.WrapError(errors.ErrURLFormatInvalid, errors.Errorf(`URL address does not have the form "host:port": %s`, in)) } if u.Path != "" { - return nil, cerror.WrapError(cerror.ErrURLFormatInvalid, + return nil, errors.WrapError(errors.ErrURLFormatInvalid, errors.Errorf("URL must not contain a path: %s", in)) } all[i] = *u diff --git a/pkg/config/capture.go b/pkg/config/capture.go index 65bd9d433f..16242f42cd 100644 --- a/pkg/config/capture.go +++ b/pkg/config/capture.go @@ -15,9 +15,8 @@ package config import ( "encoding/json" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" ) type CaptureID = string @@ -56,7 +55,7 @@ type CaptureInfo struct { func (c *CaptureInfo) Marshal() ([]byte, error) { data, err := json.Marshal(c) if err != nil { - return nil, cerror.WrapError(cerror.ErrMarshalFailed, err) + return nil, errors.WrapError(errors.ErrMarshalFailed, err) } return data, nil @@ -65,7 +64,7 @@ func (c *CaptureInfo) Marshal() ([]byte, error) { // Unmarshal from binary data. func (c *CaptureInfo) Unmarshal(data []byte) error { err := json.Unmarshal(data, c) - return errors.Annotatef(cerror.WrapError(cerror.ErrUnmarshalFailed, err), + return errors.Annotatef(errors.WrapError(errors.ErrUnmarshalFailed, err), "unmarshal data: %v", data) } @@ -93,14 +92,14 @@ type TaskPosition struct { // Marshal returns the json marshal format of a TaskStatus func (tp *TaskPosition) Marshal() (string, error) { data, err := json.Marshal(tp) - return string(data), cerror.WrapError(cerror.ErrMarshalFailed, err) + return string(data), errors.WrapError(errors.ErrMarshalFailed, err) } // Unmarshal unmarshals into *TaskStatus from json marshal byte slice func (tp *TaskPosition) Unmarshal(data []byte) error { err := json.Unmarshal(data, tp) return errors.Annotatef( - cerror.WrapError(cerror.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) + errors.WrapError(errors.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) } // String implements fmt.Stringer interface. diff --git a/pkg/config/changefeed.go b/pkg/config/changefeed.go index a7c9364f97..f49273faa6 100644 --- a/pkg/config/changefeed.go +++ b/pkg/config/changefeed.go @@ -20,10 +20,9 @@ import ( "net/url" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/pkg/version" "github.com/tikv/client-go/v2/oracle" @@ -313,7 +312,7 @@ func (info *ChangeFeedInfo) isFailedByGC() bool { log.Panic("changefeed info is not consistent", zap.Any("state", info.State), zap.Any("error", info.Error)) } - return cerror.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(info.Error.Code)) + return errors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(info.Error.Code)) } // String implements fmt.Stringer interface, but hide some sensitive information @@ -388,7 +387,7 @@ func (info *ChangeFeedInfo) MarshalWithTruncation(truncateError bool) (string, e } data, err := json.Marshal(dataToMarshal) - return string(data), cerror.WrapError(cerror.ErrMarshalFailed, err) + return string(data), errors.WrapError(errors.ErrMarshalFailed, err) } // Unmarshal unmarshals into *ChangeFeedInfo from json marshal byte slice @@ -396,7 +395,7 @@ func (info *ChangeFeedInfo) Unmarshal(data []byte) error { err := json.Unmarshal(data, &info) if err != nil { return errors.Annotatef( - cerror.WrapError(cerror.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) + errors.WrapError(errors.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) } return nil } @@ -591,7 +590,7 @@ func (info *ChangeFeedInfo) fixState() { // This corresponds to the case of failure or error. case AdminNone, AdminResume: if info.Error != nil { - if cerror.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(info.Error.Code)) { + if errors.IsChangefeedGCFastFailErrorCode(errors.RFCErrorCode(info.Error.Code)) { state = StateFailed } else { state = StateWarning @@ -741,14 +740,14 @@ type ChangeFeedStatus struct { // Marshal returns json encoded string of ChangeFeedStatus, only contains necessary fields stored in storage func (status *ChangeFeedStatus) Marshal() (string, error) { data, err := json.Marshal(status) - return string(data), cerror.WrapError(cerror.ErrMarshalFailed, err) + return string(data), errors.WrapError(errors.ErrMarshalFailed, err) } // Unmarshal into *ChangeFeedStatus from json marshal byte slice func (status *ChangeFeedStatus) Unmarshal(data []byte) error { err := json.Unmarshal(data, status) return errors.Annotatef( - cerror.WrapError(cerror.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) + errors.WrapError(errors.ErrUnmarshalFailed, err), "Unmarshal data: %v", data) } // GetMaintainerAddr returns the address of the changefeed's maintainer diff --git a/pkg/config/debug.go b/pkg/config/debug.go index 148e927430..5efe1009a5 100644 --- a/pkg/config/debug.go +++ b/pkg/config/debug.go @@ -16,7 +16,7 @@ package config import ( "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // DebugConfig represents config for ticdc unexposed feature configurations diff --git a/pkg/config/integrity.go b/pkg/config/integrity.go index c12f5578f9..c1456304a6 100644 --- a/pkg/config/integrity.go +++ b/pkg/config/integrity.go @@ -16,7 +16,7 @@ package config import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/eventpb" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -45,11 +45,11 @@ const ( func (c *IntegrityConfig) Validate() error { if c.IntegrityCheckLevel != CheckLevelNone && c.IntegrityCheckLevel != CheckLevelCorrectness { - return cerror.ErrInvalidReplicaConfig.GenWithStackByArgs() + return errors.ErrInvalidReplicaConfig.GenWithStackByArgs() } if c.CorruptionHandleLevel != CorruptionHandleLevelWarn && c.CorruptionHandleLevel != CorruptionHandleLevelError { - return cerror.ErrInvalidReplicaConfig.GenWithStackByArgs() + return errors.ErrInvalidReplicaConfig.GenWithStackByArgs() } if c.Enabled() { diff --git a/pkg/config/large_message.go b/pkg/config/large_message.go index d04584b451..b295695c0a 100644 --- a/pkg/config/large_message.go +++ b/pkg/config/large_message.go @@ -15,7 +15,7 @@ package config import ( "github.com/pingcap/ticdc/pkg/compression" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) const ( @@ -55,7 +55,7 @@ func (c *LargeMessageHandleConfig) AdjustAndValidate(protocol Protocol, enableTi // compression can be enabled independently if !compression.Supported(c.LargeMessageHandleCompression) { - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "large message handle compression is not supported, got %s", c.LargeMessageHandleCompression) } if c.LargeMessageHandleOption == LargeMessageHandleOptionNone { @@ -66,23 +66,23 @@ func (c *LargeMessageHandleConfig) AdjustAndValidate(protocol Protocol, enableTi case ProtocolOpen, ProtocolSimple: case ProtocolCanalJSON: if !enableTiDBExtension { - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "large message handle is set to %s, protocol is %s, but enable-tidb-extension is false", c.LargeMessageHandleOption, protocol.String()) } default: - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "large message handle is set to %s, protocol is %s, it's not supported", c.LargeMessageHandleOption, protocol.String()) } if c.LargeMessageHandleOption == LargeMessageHandleOptionClaimCheck { if c.ClaimCheckStorageURI == "" { - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "large message handle is set to claim-check, but the claim-check-storage-uri is empty") } if c.ClaimCheckRawValue && protocol == ProtocolOpen { - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "large message handle is set to claim-check, raw value is not supported for the open protocol") } } diff --git a/pkg/config/large_message_test.go b/pkg/config/large_message_test.go index ad3345643e..e8caf14f7c 100644 --- a/pkg/config/large_message_test.go +++ b/pkg/config/large_message_test.go @@ -17,7 +17,7 @@ import ( "testing" "github.com/pingcap/ticdc/pkg/compression" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -30,7 +30,7 @@ func TestLargeMessageHandle4Compression(t *testing.T) { largeMessageHandle.LargeMessageHandleCompression = "zstd" err := largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, false) - require.ErrorIs(t, err, cerror.ErrInvalidReplicaConfig) + require.ErrorIs(t, err, errors.ErrInvalidReplicaConfig) largeMessageHandle.LargeMessageHandleCompression = compression.LZ4 err = largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, false) @@ -55,7 +55,7 @@ func TestLargeMessageHandle4NotSupportedProtocol(t *testing.T) { largeMessageHandle.LargeMessageHandleOption = LargeMessageHandleOptionHandleKeyOnly err = largeMessageHandle.AdjustAndValidate(ProtocolCanal, true) - require.ErrorIs(t, err, cerror.ErrInvalidReplicaConfig) + require.ErrorIs(t, err, errors.ErrInvalidReplicaConfig) } func TestHandleKeyOnly4CanalJSON(t *testing.T) { @@ -72,7 +72,7 @@ func TestHandleKeyOnly4CanalJSON(t *testing.T) { // `enable-tidb-extension` is false, return error err = largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, false) - require.ErrorIs(t, err, cerror.ErrInvalidReplicaConfig) + require.ErrorIs(t, err, errors.ErrInvalidReplicaConfig) // `enable-tidb-extension` is true, no error err = largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, true) @@ -97,7 +97,7 @@ func TestClaimCheck4CanalJSON(t *testing.T) { largeMessageHandle.ClaimCheckRawValue = rawValue // `enable-tidb-extension` is false, return error err = largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, false) - require.ErrorIs(t, err, cerror.ErrInvalidReplicaConfig) + require.ErrorIs(t, err, errors.ErrInvalidReplicaConfig) // `enable-tidb-extension` is true, no error err = largeMessageHandle.AdjustAndValidate(ProtocolCanalJSON, true) @@ -151,7 +151,7 @@ func TestClaimCheck4OpenProtocol(t *testing.T) { largeMessageHandle.ClaimCheckRawValue = true err = largeMessageHandle.AdjustAndValidate(ProtocolOpen, true) - require.ErrorIs(t, err, cerror.ErrInvalidReplicaConfig) + require.ErrorIs(t, err, errors.ErrInvalidReplicaConfig) } func TestHandleKeyOnly4SimpleProtocol(t *testing.T) { diff --git a/pkg/config/replica_config.go b/pkg/config/replica_config.go index c2c54c766c..ee41fec2ba 100644 --- a/pkg/config/replica_config.go +++ b/pkg/config/replica_config.go @@ -21,10 +21,9 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config/outdated" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/integrity" "github.com/pingcap/ticdc/pkg/redo" "github.com/pingcap/ticdc/pkg/util" @@ -226,7 +225,7 @@ func (c *ReplicaConfig) Scan(value interface{}) error { func (c *ReplicaConfig) Marshal() (string, error) { cfg, err := json.Marshal(c) if err != nil { - return "", cerror.WrapError(cerror.ErrEncodeFailed, errors.Annotatef(err, "Unmarshal data: %v", c)) + return "", errors.WrapError(errors.ErrEncodeFailed, errors.Annotatef(err, "Unmarshal data: %v", c)) } return string(cfg), nil } @@ -238,12 +237,12 @@ func (c *ReplicaConfig) UnmarshalJSON(data []byte) error { r := (*replicaConfig)(c) err := json.Unmarshal(data, &r) if err != nil { - return cerror.WrapError(cerror.ErrDecodeFailed, err) + return errors.WrapError(errors.ErrDecodeFailed, err) } v1 := outdated.ReplicaConfigV1{} err = v1.Unmarshal(data) if err != nil { - return cerror.WrapError(cerror.ErrDecodeFailed, err) + return errors.WrapError(errors.ErrDecodeFailed, err) } r.fillFromV1(&v1) return nil @@ -254,13 +253,13 @@ func (c *ReplicaConfig) Clone() *ReplicaConfig { str, err := c.Marshal() if err != nil { log.Panic("failed to marshal replica config", - zap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err))) + zap.Error(errors.WrapError(errors.ErrDecodeFailed, err))) } clone := new(ReplicaConfig) err = clone.UnmarshalJSON([]byte(str)) if err != nil { log.Panic("failed to unmarshal replica config", - zap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err))) + zap.Error(errors.WrapError(errors.ErrDecodeFailed, err))) } if c.EnableRedoIOCheck != nil { clone.EnableRedoIOCheck = util.AddressOf(*c.EnableRedoIOCheck) @@ -304,12 +303,12 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin // check sync point config if util.GetOrZero(c.EnableSyncPoint) { if !IsMySQLCompatibleScheme(GetScheme(sinkURI)) { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("The SyncPoint must be disabled when the downstream is not tidb or mysql") } if c.SyncPointInterval != nil && *c.SyncPointInterval < minSyncPointInterval { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs( fmt.Sprintf("The SyncPointInterval:%s must be larger than %s", c.SyncPointInterval.String(), @@ -317,7 +316,7 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin } if c.SyncPointRetention != nil && *c.SyncPointRetention < minSyncPointRetention { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs( fmt.Sprintf("The SyncPointRetention:%s must be larger than %s", c.SyncPointRetention.String(), @@ -352,7 +351,7 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin if c.Integrity.Enabled() && len(c.Sink.ColumnSelectors) != 0 { log.Error("it's not allowed to enable the integrity check and column selector at the same time") - return cerror.ErrInvalidReplicaConfig.GenWithStack( + return errors.ErrInvalidReplicaConfig.GenWithStack( "integrity check enabled and column selector set, not allowed") } @@ -360,7 +359,7 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin if c.ChangefeedErrorStuckDuration != nil && *c.ChangefeedErrorStuckDuration < minChangeFeedErrorStuckDuration { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs( fmt.Sprintf("The ChangefeedErrorStuckDuration:%f must be larger than %f Seconds", c.ChangefeedErrorStuckDuration.Seconds(), @@ -369,22 +368,22 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin // allow the batch count and batch bytes set to 0, to disable the batch mechanism if c.EventCollectorBatchCount != nil && *c.EventCollectorBatchCount < 0 { - return cerror.ErrInvalidReplicaConfig.FastGenByArgs("event-collector-batch-count must be set not smaller than 0") + return errors.ErrInvalidReplicaConfig.FastGenByArgs("event-collector-batch-count must be set not smaller than 0") } if c.EventCollectorBatchCount != nil && *c.EventCollectorBatchCount > MaxEventCollectorBatchCount { - return cerror.ErrInvalidReplicaConfig.FastGenByArgs( + return errors.ErrInvalidReplicaConfig.FastGenByArgs( "event-collector-batch-count must be set not larger than %d", MaxEventCollectorBatchCount, ) } if c.EventCollectorBatchBytes != nil && *c.EventCollectorBatchBytes < 0 { - return cerror.ErrInvalidReplicaConfig.FastGenByArgs("event-collector-batch-bytes must be set not smaller than 0") + return errors.ErrInvalidReplicaConfig.FastGenByArgs("event-collector-batch-bytes must be set not smaller than 0") } if c.ActiveActiveProgressInterval == nil { interval := defaultActiveActiveProgressInterval c.ActiveActiveProgressInterval = util.AddressOf(interval) } if *c.ActiveActiveProgressInterval <= 0 { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("the active-active-progress-interval must be larger than 0") } @@ -393,7 +392,7 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin c.ActiveActiveSyncStatsInterval = util.AddressOf(interval) } if *c.ActiveActiveSyncStatsInterval < 0 { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("the active-active-sync-stats-interval must be larger than or equal to 0") } @@ -401,15 +400,15 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin scheme := GetScheme(sinkURI) if IsMySQLCompatibleScheme(scheme) { if !util.GetOrZero(c.BDRMode) { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("enable-active-active with mysql-class downstream requires bdr-mode to be true") } } else if !IsStorageScheme(scheme) { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("enable-active-active only supports tidb sink and storage sink") } if c.Consistent != nil && redo.IsConsistentEnabled(util.GetOrZero(c.Consistent.Level)) { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. FastGenByArgs("enable-active-active is incompatible with redo log/consistency feature, please disable redo") } } diff --git a/pkg/config/scheduler_config.go b/pkg/config/scheduler_config.go index 89298f4b54..d8567a8095 100644 --- a/pkg/config/scheduler_config.go +++ b/pkg/config/scheduler_config.go @@ -14,12 +14,11 @@ package config import ( - "errors" "net/url" "time" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" ) @@ -205,27 +204,27 @@ func NewDefaultSchedulerConfig() *SchedulerConfig { // ValidateAndAdjust verifies that each parameter is valid. func (c *SchedulerConfig) ValidateAndAdjust() error { if c.HeartbeatTick <= 0 { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "heartbeat-tick must be larger than 0") } if c.CollectStatsTick <= 0 { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "collect-stats-tick must be larger than 0") } if c.MaxTaskConcurrency <= 0 { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "max-task-concurrency must be larger than 0") } if time.Duration(c.CheckBalanceInterval) <= time.Second { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "check-balance-interval must be larger than 1s") } if c.AddTableBatchSize <= 0 { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "add-table-batch-size must be large than 0") } if c.BalanceMoveBatchSize <= 0 { - return cerror.ErrInvalidServerOption.GenWithStackByArgs( + return errors.ErrInvalidServerOption.GenWithStackByArgs( "balance-move-batch-size must be larger than 0") } return nil diff --git a/pkg/config/server.go b/pkg/config/server.go index 887051eb8a..e08407ca12 100644 --- a/pkg/config/server.go +++ b/pkg/config/server.go @@ -22,9 +22,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "go.uber.org/zap" ) @@ -173,7 +172,7 @@ type ServerConfig struct { func (c *ServerConfig) Marshal() (string, error) { cfg, err := json.Marshal(c) if err != nil { - return "", cerror.WrapError(cerror.ErrEncodeFailed, errors.Annotatef(err, "Unmarshal data: %v", c)) + return "", errors.WrapError(errors.ErrEncodeFailed, errors.Annotatef(err, "Unmarshal data: %v", c)) } return string(cfg), nil } @@ -182,7 +181,7 @@ func (c *ServerConfig) Marshal() (string, error) { func (c *ServerConfig) Unmarshal(data []byte) error { err := json.Unmarshal(data, c) if err != nil { - return cerror.WrapError(cerror.ErrDecodeFailed, err) + return errors.WrapError(errors.ErrDecodeFailed, err) } return nil } @@ -198,13 +197,13 @@ func (c *ServerConfig) Clone() *ServerConfig { str, err := c.Marshal() if err != nil { log.Panic("failed to marshal replica config", - zap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err))) + zap.Error(errors.WrapError(errors.ErrDecodeFailed, err))) } clone := new(ServerConfig) err = clone.Unmarshal([]byte(str)) if err != nil { log.Panic("failed to unmarshal replica config", - zap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err))) + zap.Error(errors.WrapError(errors.ErrDecodeFailed, err))) } return clone } @@ -212,13 +211,13 @@ func (c *ServerConfig) Clone() *ServerConfig { // ValidateAndAdjust validates and adjusts the server configuration func (c *ServerConfig) ValidateAndAdjust() error { if !isValidClusterID(c.ClusterID) { - return cerror.ErrInvalidServerOption.GenWithStack(fmt.Sprintf("bad cluster-id"+ + return errors.ErrInvalidServerOption.GenWithStack(fmt.Sprintf("bad cluster-id"+ "please match the pattern \"^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$\", and not the list of"+ " following reserved world: %s"+ "eg, \"simple-cluster-id\"", strings.Join(ReservedClusterIDs, ","))) } if c.Addr == "" { - return cerror.ErrInvalidServerOption.GenWithStack("empty address") + return errors.ErrInvalidServerOption.GenWithStack("empty address") } if c.AdvertiseAddr == "" { c.AdvertiseAddr = c.Addr @@ -228,13 +227,13 @@ func (c *ServerConfig) ValidateAndAdjust() error { ip := net.ParseIP(c.AdvertiseAddr[:idx]) // Skip nil as it could be a domain name. if ip != nil && ip.IsUnspecified() { - return cerror.ErrInvalidServerOption.GenWithStack("advertise address must be specified as a valid IP") + return errors.ErrInvalidServerOption.GenWithStack("advertise address must be specified as a valid IP") } } else { - return cerror.ErrInvalidServerOption.GenWithStack("advertise address or address does not contain a port") + return errors.ErrInvalidServerOption.GenWithStack("advertise address or address does not contain a port") } if c.GcTTL == 0 { - return cerror.ErrInvalidServerOption.GenWithStack("empty GC TTL is not allowed") + return errors.ErrInvalidServerOption.GenWithStack("empty GC TTL is not allowed") } // 5s is minimum lease ttl in etcd(PD) if c.CaptureSessionTTL < 5 { @@ -246,7 +245,7 @@ func (c *ServerConfig) ValidateAndAdjust() error { if c.Security.ClientUserRequired { if len(c.Security.ClientAllowedUser) == 0 { log.Error("client-allowed-user should not be empty when client-user-required is true") - return cerror.ErrInvalidServerOption.GenWithStack("client-allowed-user should not be empty when client-user-required is true") + return errors.ErrInvalidServerOption.GenWithStack("client-allowed-user should not be empty when client-user-required is true") } if !c.Security.IsTLSEnabled() { log.Warn("client-allowed-user is true, but tls is not enabled." + diff --git a/pkg/config/sink.go b/pkg/config/sink.go index d939b5c281..96ebd0b20b 100644 --- a/pkg/config/sink.go +++ b/pkg/config/sink.go @@ -23,9 +23,8 @@ import ( "github.com/apache/pulsar-client-go/pulsar" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" ) @@ -126,11 +125,11 @@ func (l AtomicityLevel) validate(scheme string) error { // MqSink only support `noneTxnAtomicity`. if IsMQScheme(scheme) { errMsg := fmt.Sprintf("%s level atomicity is not supported by %s scheme", l, scheme) - return cerror.ErrSinkURIInvalid.GenWithStackByArgs(errMsg) + return errors.ErrSinkURIInvalid.GenWithStackByArgs(errMsg) } default: errMsg := fmt.Sprintf("%s level atomicity is not supported by %s scheme", l, scheme) - return cerror.ErrSinkURIInvalid.GenWithStackByArgs(errMsg) + return errors.ErrSinkURIInvalid.GenWithStackByArgs(errMsg) } return nil } @@ -279,13 +278,13 @@ func (c *CSVConfig) validateAndAdjust() error { // validate quote if len(c.Quote) > 1 { - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config quote contains more than one character")) } if len(c.Quote) == 1 { quote := c.Quote[0] if quote == CR || quote == LF { - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config quote cannot be line break character")) } } @@ -293,15 +292,15 @@ func (c *CSVConfig) validateAndAdjust() error { // validate delimiter switch len(c.Delimiter) { case 0: - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config delimiter cannot be empty")) case 1, 2, 3: if strings.ContainsRune(c.Delimiter, CR) || strings.ContainsRune(c.Delimiter, LF) { - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config delimiter contains line break characters")) } default: - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config delimiter contains more than three characters, note that escape "+ "sequences can only be used in double quotes in toml configuration items.")) } @@ -309,7 +308,7 @@ func (c *CSVConfig) validateAndAdjust() error { if len(c.Quote) > 0 { for _, r := range c.Delimiter { if strings.ContainsRune(c.Quote, r) { - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config quote and delimiter has common characters which is not allowed")) } } @@ -319,7 +318,7 @@ func (c *CSVConfig) validateAndAdjust() error { switch c.BinaryEncodingMethod { case BinaryEncodingHex, BinaryEncodingBase64: default: - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New("csv config binary-encoding-method can only be hex or base64")) } @@ -349,7 +348,7 @@ func (d *DateSeparator) FromString(separator string) error { case "day": *d = DateSeparatorDay default: - return cerror.ErrStorageSinkInvalidDateSeparator.GenWithStackByArgs(separator) + return errors.ErrStorageSinkInvalidDateSeparator.GenWithStackByArgs(separator) } return nil @@ -751,7 +750,7 @@ func CheckUseTableIDAsPathCompatibility( if util.GetOrZero(useTableIDAsPathFromConfig) == util.GetOrZero(useTableIDAsPathFromURI) { return nil } - return cerror.ErrIncompatibleSinkConfig.GenWithStackByArgs( + return errors.ErrIncompatibleSinkConfig.GenWithStackByArgs( fmt.Sprintf("%s=%t", UseTableIDAsPathKey, util.GetOrZero(useTableIDAsPathFromURI)), fmt.Sprintf("%s=%t", UseTableIDAsPathKey, util.GetOrZero(useTableIDAsPathFromConfig)), ) @@ -795,7 +794,7 @@ func (s *SinkConfig) validateAndAdjust(sinkURI *url.URL) error { if s.SchemaRegistry != nil && (s.KafkaConfig != nil && s.KafkaConfig.GlueSchemaRegistryConfig != nil) { - return cerror.ErrInvalidReplicaConfig. + return errors.ErrInvalidReplicaConfig. GenWithStackByArgs("schema-registry and glue-schema-registry-config" + "cannot be set at the same time," + "schema-registry is used by confluent schema registry, " + @@ -823,7 +822,7 @@ func (s *SinkConfig) validateAndAdjust(sinkURI *url.URL) error { for _, rule := range s.DispatchRules { if rule.DispatcherRule != "" && rule.PartitionRule != "" { log.Error("dispatcher and partition cannot be configured both", zap.Any("rule", rule)) - return cerror.WrapError(cerror.ErrSinkInvalidConfig, + return errors.WrapError(errors.ErrSinkInvalidConfig, errors.New(fmt.Sprintf("dispatcher and partition cannot be "+ "configured both for rule:%v", rule))) } @@ -837,7 +836,7 @@ func (s *SinkConfig) validateAndAdjust(sinkURI *url.URL) error { } if util.GetOrZero(s.EncoderConcurrency) < 0 { - return cerror.ErrSinkInvalidConfig.GenWithStack( + return errors.ErrSinkInvalidConfig.GenWithStack( "encoder-concurrency should greater than 0, but got %d", s.EncoderConcurrency) } @@ -847,7 +846,7 @@ func (s *SinkConfig) validateAndAdjust(sinkURI *url.URL) error { } if util.GetOrZero(s.DeleteOnlyOutputHandleKeyColumns) && protocol == ProtocolCsv { - return cerror.ErrSinkInvalidConfig.GenWithStack( + return errors.ErrSinkInvalidConfig.GenWithStack( "CSV protocol always output all columns for the delete event, " + "do not set `delete-only-output-handle-key-columns` to true") } @@ -858,7 +857,7 @@ func (s *SinkConfig) validateAndAdjust(sinkURI *url.URL) error { if len(util.GetOrZero(s.DateSeparator)) > 0 { var separator DateSeparator if err := separator.FromString(util.GetOrZero(s.DateSeparator)); err != nil { - return cerror.WrapError(cerror.ErrSinkInvalidConfig, err) + return errors.WrapError(errors.ErrSinkInvalidConfig, err) } } @@ -906,7 +905,7 @@ func (s *SinkConfig) validateAndAdjustSinkURI(sinkURI *url.URL) error { } if err := s.applyParameterBySinkURI(sinkURI); err != nil { - if !cerror.ErrIncompatibleSinkConfig.Equal(err) { + if !errors.ErrIncompatibleSinkConfig.Equal(err) { return err } // Ignore `ErrIncompatibleSinkConfig` here to: @@ -927,7 +926,7 @@ func (s *SinkConfig) validateAndAdjustSinkURI(sinkURI *url.URL) error { // Check that protocol config is compatible with the scheme. if IsMySQLCompatibleScheme(sinkURI.Scheme) && s.Protocol != nil { - return cerror.ErrSinkURIInvalid.GenWithStackByArgs(fmt.Sprintf("protocol %s "+ + return errors.ErrSinkURIInvalid.GenWithStackByArgs(fmt.Sprintf("protocol %s "+ "is incompatible with %s scheme", util.GetOrZero(s.Protocol), sinkURI.Scheme)) } // For testing purposes, any protocol should be legal for blackhole. @@ -1027,7 +1026,7 @@ func (s *SinkConfig) applyParameterBySinkURI(sinkURI *url.URL) error { } return errMsg.String()[0 : errMsg.Len()-2] } - return cerror.ErrIncompatibleSinkConfig.GenWithStackByArgs( + return errors.ErrIncompatibleSinkConfig.GenWithStackByArgs( getErrMsg(cfgInSinkURI), getErrMsg(cfgInFile)) } return getError() @@ -1039,7 +1038,7 @@ func (s *SinkConfig) CheckCompatibilityWithSinkURI( ) error { sinkURI, err := url.Parse(sinkURIStr) if err != nil { - return cerror.WrapError(cerror.ErrSinkURIInvalid, err) + return errors.WrapError(errors.ErrSinkURIInvalid, err) } var useTableIDAsPathFromURI *bool @@ -1048,7 +1047,7 @@ func (s *SinkConfig) CheckCompatibilityWithSinkURI( if useTableIDAsPathValue != "" { enabled, parseErr := strconv.ParseBool(useTableIDAsPathValue) if parseErr != nil { - return cerror.WrapError(cerror.ErrSinkURIInvalid, parseErr) + return errors.WrapError(errors.ErrSinkURIInvalid, parseErr) } useTableIDAsPathFromURI = util.AddressOf(enabled) } @@ -1079,7 +1078,7 @@ func (s *SinkConfig) CheckCompatibilityWithSinkURI( isURIParamsChanged := func(oldCfg SinkConfig) bool { err := oldCfg.applyParameterBySinkURI(sinkURI) - if cerror.ErrIncompatibleSinkConfig.Equal(err) { + if errors.ErrIncompatibleSinkConfig.Equal(err) { return true } if useTableIDAsPathFromURI == nil { @@ -1100,7 +1099,7 @@ func (s *SinkConfig) CheckCompatibilityWithSinkURI( } compatibilityError := s.applyParameterBySinkURI(sinkURI) - if uriParamsChanged && cerror.ErrIncompatibleSinkConfig.Equal(compatibilityError) { + if uriParamsChanged && errors.ErrIncompatibleSinkConfig.Equal(compatibilityError) { // Ignore compatibility error if the sinkURI make such changes. return nil } @@ -1123,15 +1122,15 @@ type GlueSchemaRegistryConfig struct { // Validate the GlueSchemaRegistryConfig. func (g *GlueSchemaRegistryConfig) Validate() error { if g.RegistryName == "" { - return cerror.ErrInvalidGlueSchemaRegistryConfig. + return errors.ErrInvalidGlueSchemaRegistryConfig. GenWithStack("registry-name is empty, is must be set") } if g.Region == "" { - return cerror.ErrInvalidGlueSchemaRegistryConfig. + return errors.ErrInvalidGlueSchemaRegistryConfig. GenWithStack("region is empty, is must be set") } if g.AccessKey != "" && g.SecretAccessKey == "" { - return cerror.ErrInvalidGlueSchemaRegistryConfig. + return errors.ErrInvalidGlueSchemaRegistryConfig. GenWithStack("access-key is set, but access-key-secret is empty, they must be set together") } return nil @@ -1162,7 +1161,7 @@ func validateRoutingExpression(fieldName, expr string) error { if expr == "" || validRoutingExpressionRegexp.MatchString(expr) { return nil } - return cerror.ErrInvalidTableRoutingRule.GenWithStack( + return errors.ErrInvalidTableRoutingRule.GenWithStack( "%s %q must contain only literal text, {schema}, and {table}", fieldName, expr, diff --git a/pkg/config/upstream.go b/pkg/config/upstream.go index bf2a0b167f..c2f2a9e807 100644 --- a/pkg/config/upstream.go +++ b/pkg/config/upstream.go @@ -15,8 +15,7 @@ package config import ( "encoding/json" - "github.com/pingcap/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // UpstreamID is the type for upstream ID @@ -36,7 +35,7 @@ type UpstreamInfo struct { func (c *UpstreamInfo) Marshal() ([]byte, error) { data, err := json.Marshal(c) if err != nil { - return nil, cerror.WrapError(cerror.ErrMarshalFailed, err) + return nil, errors.WrapError(errors.ErrMarshalFailed, err) } return data, nil @@ -45,7 +44,7 @@ func (c *UpstreamInfo) Marshal() ([]byte, error) { // Unmarshal from binary data. func (c *UpstreamInfo) Unmarshal(data []byte) error { err := json.Unmarshal(data, c) - return errors.Annotatef(cerror.WrapError(cerror.ErrUnmarshalFailed, err), + return errors.Annotatef(errors.WrapError(errors.ErrUnmarshalFailed, err), "unmarshal data: %v", data) } diff --git a/pkg/diff/checkpoint.go b/pkg/diff/checkpoint.go index 5f9e63c72b..9babe45505 100644 --- a/pkg/diff/checkpoint.go +++ b/pkg/diff/checkpoint.go @@ -22,7 +22,7 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" diff --git a/pkg/diff/chunk.go b/pkg/diff/chunk.go index 84ba6d8c19..4dfd26e832 100644 --- a/pkg/diff/chunk.go +++ b/pkg/diff/chunk.go @@ -21,7 +21,7 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/util/dbutil" diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 29d1d6e49c..89c599cee0 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -27,7 +27,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/util" diff --git a/pkg/encryption/cipher.go b/pkg/encryption/cipher.go index 63d64fb0a3..85c85db59e 100644 --- a/pkg/encryption/cipher.go +++ b/pkg/encryption/cipher.go @@ -18,7 +18,8 @@ import ( "crypto/cipher" "crypto/rand" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" + ) // Cipher is the interface for encryption/decryption operations @@ -58,15 +59,15 @@ func isValidAESKeySize(key []byte) bool { // Encrypt encrypts data using AES-CTR. func (c *AES256CTRCipher) Encrypt(data, key, iv []byte) ([]byte, error) { if !isValidAESKeySize(key) { - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("key must be 16, 24, or 32 bytes for AES-CTR") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("key must be 16, 24, or 32 bytes for AES-CTR") } if len(iv) != c.IVSize() { - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("IV must be 16 bytes") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("IV must be 16 bytes") } block, err := aes.NewCipher(key) if err != nil { - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } stream := cipher.NewCTR(block, iv) @@ -79,15 +80,15 @@ func (c *AES256CTRCipher) Encrypt(data, key, iv []byte) ([]byte, error) { // Decrypt decrypts data using AES-CTR. func (c *AES256CTRCipher) Decrypt(data, key, iv []byte) ([]byte, error) { if !isValidAESKeySize(key) { - return nil, cerrors.ErrDecryptionFailed.GenWithStackByArgs("key must be 16, 24, or 32 bytes for AES-CTR") + return nil, errors.ErrDecryptionFailed.GenWithStackByArgs("key must be 16, 24, or 32 bytes for AES-CTR") } if len(iv) != c.IVSize() { - return nil, cerrors.ErrDecryptionFailed.GenWithStackByArgs("IV must be 16 bytes") + return nil, errors.ErrDecryptionFailed.GenWithStackByArgs("IV must be 16 bytes") } block, err := aes.NewCipher(key) if err != nil { - return nil, cerrors.ErrDecryptionFailed.Wrap(err) + return nil, errors.ErrDecryptionFailed.Wrap(err) } stream := cipher.NewCTR(block, iv) @@ -101,7 +102,7 @@ func (c *AES256CTRCipher) Decrypt(data, key, iv []byte) ([]byte, error) { func GenerateIV(size int) ([]byte, error) { iv := make([]byte, size) if _, err := rand.Read(iv); err != nil { - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } return iv, nil } diff --git a/pkg/encryption/data_key_id.go b/pkg/encryption/data_key_id.go index 8df36878bb..97b53d022d 100644 --- a/pkg/encryption/data_key_id.go +++ b/pkg/encryption/data_key_id.go @@ -13,7 +13,7 @@ package encryption -import cerrors "github.com/pingcap/ticdc/pkg/errors" +import "github.com/pingcap/ticdc/pkg/errors" // DataKeyID represents a 3-byte data key identifier in the encryption header. type DataKeyID [3]byte @@ -26,7 +26,7 @@ func (id DataKeyID) ToString() string { // DataKeyIDFromString creates DataKeyID from string (must be 3 bytes). func DataKeyIDFromString(s string) (DataKeyID, error) { if len(s) != 3 { - return DataKeyID{}, cerrors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be exactly 3 bytes") + return DataKeyID{}, errors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be exactly 3 bytes") } var id DataKeyID copy(id[:], s) diff --git a/pkg/encryption/data_key_id_24be.go b/pkg/encryption/data_key_id_24be.go index 18a9cad6e6..5218d0fa69 100644 --- a/pkg/encryption/data_key_id_24be.go +++ b/pkg/encryption/data_key_id_24be.go @@ -13,11 +13,11 @@ package encryption -import cerrors "github.com/pingcap/ticdc/pkg/errors" +import "github.com/pingcap/ticdc/pkg/errors" func encodeDataKeyID24BE(id uint32) (string, error) { if id > 0xFFFFFF { - return "", cerrors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID exceeds 24-bit range") + return "", errors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID exceeds 24-bit range") } b := [3]byte{byte(id >> 16), byte(id >> 8), byte(id)} return string(b[:]), nil @@ -25,7 +25,7 @@ func encodeDataKeyID24BE(id uint32) (string, error) { func decodeDataKeyID24BE(id string) (uint32, error) { if len(id) != 3 { - return 0, cerrors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be 3 bytes") + return 0, errors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be 3 bytes") } b := []byte(id) return uint32(b[0])<<16 | uint32(b[1])<<8 | uint32(b[2]), nil diff --git a/pkg/encryption/encryption_manager.go b/pkg/encryption/encryption_manager.go index 4fea198626..630c3109ab 100644 --- a/pkg/encryption/encryption_manager.go +++ b/pkg/encryption/encryption_manager.go @@ -18,7 +18,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -64,7 +64,7 @@ func (m *encryptionManager) EncryptData(ctx context.Context, keyspaceID uint32, log.Error("failed to get current data key", zap.Uint32("keyspaceID", keyspaceID), zap.Error(err)) - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } if len(dataKey) == 0 { @@ -81,7 +81,7 @@ func (m *encryptionManager) EncryptData(ctx context.Context, keyspaceID uint32, log.Error("failed to generate IV", zap.Uint32("keyspaceID", keyspaceID), zap.Error(err)) - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } // Encrypt data @@ -90,7 +90,7 @@ func (m *encryptionManager) EncryptData(ctx context.Context, keyspaceID uint32, log.Error("failed to encrypt data", zap.Uint32("keyspaceID", keyspaceID), zap.Error(err)) - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } // Prepend IV to encrypted data @@ -106,7 +106,7 @@ func (m *encryptionManager) EncryptData(ctx context.Context, keyspaceID uint32, zap.Uint8("version", version), zap.Binary("dataKeyID", []byte(currentDataKeyID)), zap.Error(err)) - return nil, cerrors.ErrEncryptionFailed.Wrap(err) + return nil, errors.ErrEncryptionFailed.Wrap(err) } log.Debug("data encrypted successfully", @@ -135,7 +135,7 @@ func (m *encryptionManager) DecryptData(ctx context.Context, keyspaceID uint32, zap.Uint32("keyspaceID", keyspaceID), zap.Int("encryptedSize", len(encryptedData)), zap.Error(err)) - return nil, cerrors.ErrDecryptionFailed.Wrap(err) + return nil, errors.ErrDecryptionFailed.Wrap(err) } if version == VersionUnencrypted { @@ -150,7 +150,7 @@ func (m *encryptionManager) DecryptData(ctx context.Context, keyspaceID uint32, zap.Uint8("version", version), zap.Binary("dataKeyID", []byte(dataKeyID)), zap.Error(err)) - return nil, cerrors.ErrDecryptionFailed.Wrap(err) + return nil, errors.ErrDecryptionFailed.Wrap(err) } if len(dataKey) == 0 { @@ -158,7 +158,7 @@ func (m *encryptionManager) DecryptData(ctx context.Context, keyspaceID uint32, zap.Uint32("keyspaceID", keyspaceID), zap.Uint8("version", version), zap.Binary("dataKeyID", []byte(dataKeyID))) - return nil, cerrors.ErrDecryptionFailed.GenWithStackByArgs("data key is empty") + return nil, errors.ErrDecryptionFailed.GenWithStackByArgs("data key is empty") } cipherImpl := NewAES256CTRCipher() @@ -172,7 +172,7 @@ func (m *encryptionManager) DecryptData(ctx context.Context, keyspaceID uint32, zap.Binary("dataKeyID", []byte(dataKeyID)), zap.Int("dataWithIVSize", len(dataWithIV)), zap.Int("expectedIVSize", ivSize)) - return nil, cerrors.ErrDecryptionFailed.GenWithStackByArgs("data too short for IV") + return nil, errors.ErrDecryptionFailed.GenWithStackByArgs("data too short for IV") } iv := dataWithIV[:ivSize] @@ -186,7 +186,7 @@ func (m *encryptionManager) DecryptData(ctx context.Context, keyspaceID uint32, zap.Uint8("version", version), zap.Binary("dataKeyID", []byte(dataKeyID)), zap.Error(err)) - return nil, cerrors.ErrDecryptionFailed.Wrap(err) + return nil, errors.ErrDecryptionFailed.Wrap(err) } log.Debug("data decrypted successfully", diff --git a/pkg/encryption/encryption_manager_test.go b/pkg/encryption/encryption_manager_test.go index 9d87895c89..acba22e8e4 100644 --- a/pkg/encryption/encryption_manager_test.go +++ b/pkg/encryption/encryption_manager_test.go @@ -18,8 +18,9 @@ import ( "context" "testing" + "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -44,11 +45,11 @@ func (m *mockMetaManager) GetDataKey(ctx context.Context, keyspaceID uint32, dat if m.currentKeyID == dataKeyID && len(m.currentKey) > 0 { return m.currentKey, nil } - return nil, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found") + return nil, errors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found") } key, ok := m.dataKeys[dataKeyID] if !ok { - return nil, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found") + return nil, errors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found") } return key, nil } @@ -72,7 +73,7 @@ func TestEncryptDataAllowDegradeOnError(t *testing.T) { defer restore() meta := &mockMetaManager{ - currentKeyErr: cerrors.ErrEncryptionFailed.GenWithStackByArgs("boom"), + currentKeyErr: errors.ErrEncryptionFailed.GenWithStackByArgs("boom"), } manager := NewEncryptionManager(meta) input := []byte("payload") @@ -87,7 +88,7 @@ func TestEncryptDataDisallowDegradeOnError(t *testing.T) { defer restore() meta := &mockMetaManager{ - currentKeyErr: cerrors.ErrEncryptionFailed.GenWithStackByArgs("boom"), + currentKeyErr: errors.ErrEncryptionFailed.GenWithStackByArgs("boom"), } manager := NewEncryptionManager(meta) _, err := manager.EncryptData(context.Background(), 1, []byte("payload")) diff --git a/pkg/encryption/format.go b/pkg/encryption/format.go index db0e4d5392..caf837d2b7 100644 --- a/pkg/encryption/format.go +++ b/pkg/encryption/format.go @@ -14,7 +14,7 @@ package encryption import ( - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) const ( @@ -38,11 +38,11 @@ type EncryptionHeader struct { // The version byte comes from the encryption metadata obtained from TiKV func EncodeEncryptedData(data []byte, version byte, dataKeyID string) ([]byte, error) { if len(dataKeyID) != 3 { - return nil, cerrors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be 3 bytes") + return nil, errors.ErrInvalidDataKeyID.GenWithStackByArgs("data key ID must be 3 bytes") } if version == VersionUnencrypted { - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("version cannot be 0 for encrypted data") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("version cannot be 0 for encrypted data") } result := make([]byte, EncryptionHeaderSize+len(data)) @@ -57,7 +57,7 @@ func EncodeEncryptedData(data []byte, version byte, dataKeyID string) ([]byte, e // Returns: (version, dataKeyID, encryptedData, error) func DecodeEncryptedData(data []byte) (byte, string, []byte, error) { if len(data) < EncryptionHeaderSize { - return 0, "", nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("data too short for encryption header") + return 0, "", nil, errors.ErrDecodeFailed.GenWithStackByArgs("data too short for encryption header") } version := data[0] @@ -136,7 +136,7 @@ func DecodeUnencryptedData(data []byte) ([]byte, error) { // ExtractDataKeyID extracts the data key ID from encrypted data func ExtractDataKeyID(data []byte) (string, error) { if len(data) < EncryptionHeaderSize { - return "", cerrors.ErrDecodeFailed.GenWithStackByArgs("data too short") + return "", errors.ErrDecodeFailed.GenWithStackByArgs("data too short") } version := data[0] @@ -153,5 +153,5 @@ func ExtractDataKeyID(data []byte) (string, error) { } // Otherwise, this is not encrypted data (legacy data or new-format unencrypted) - return "", cerrors.ErrDecodeFailed.GenWithStackByArgs("data is not encrypted") + return "", errors.ErrDecodeFailed.GenWithStackByArgs("data is not encrypted") } diff --git a/pkg/encryption/format_test.go b/pkg/encryption/format_test.go index f37a310b82..3de378b080 100644 --- a/pkg/encryption/format_test.go +++ b/pkg/encryption/format_test.go @@ -16,7 +16,7 @@ package encryption import ( "testing" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -24,11 +24,11 @@ func TestEncodeEncryptedDataInvalidKey(t *testing.T) { // Key ID must be exactly 3 bytes _, err := EncodeEncryptedData([]byte("payload"), 0x01, "ab") require.Error(t, err) - require.True(t, cerrors.ErrInvalidDataKeyID.Equal(err)) + require.True(t, errors.ErrInvalidDataKeyID.Equal(err)) _, err = EncodeEncryptedData([]byte("payload"), 0x01, "abcd") require.Error(t, err) - require.True(t, cerrors.ErrInvalidDataKeyID.Equal(err)) + require.True(t, errors.ErrInvalidDataKeyID.Equal(err)) } func TestEncodeEncryptedDataInvalidVersion(t *testing.T) { diff --git a/pkg/encryption/kms/client.go b/pkg/encryption/kms/client.go index 5248801957..1d27af06eb 100644 --- a/pkg/encryption/kms/client.go +++ b/pkg/encryption/kms/client.go @@ -20,7 +20,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -116,7 +116,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("vendor", vendor), zap.String("keyID", keyID), zap.String("endpoint", awsCfg.Endpoint)) - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("aws kms region is empty") + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("aws kms region is empty") } decryptor, err := c.getAWSDecryptor(ctx, awsCfg) if err != nil { @@ -126,7 +126,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("region", awsCfg.Region), zap.String("endpoint", awsCfg.Endpoint), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } plaintext, err := decryptor.Decrypt(ctx, keyID, ciphertext) if err != nil { @@ -136,7 +136,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("region", awsCfg.Region), zap.String("endpoint", awsCfg.Endpoint), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } return plaintext, nil case vendorGCP: @@ -148,7 +148,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("keyID", keyID), zap.String("endpoint", gcpCfg.Endpoint), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } plaintext, err := decryptor.Decrypt(ctx, keyID, ciphertext) if err != nil { @@ -157,7 +157,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("keyID", keyID), zap.String("endpoint", gcpCfg.Endpoint), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } return plaintext, nil default: @@ -165,7 +165,7 @@ func (c *client) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID zap.String("vendor", vendor), zap.String("normalizedVendor", normalizedVendor), zap.String("keyID", keyID)) - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("unsupported KMS vendor: " + vendor) + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("unsupported KMS vendor: " + vendor) } } @@ -206,10 +206,10 @@ func (c *client) validateConfig() error { awsCfg := c.cfg.KMS.AWS if awsCfg.AccessKey != "" || awsCfg.SecretAccessKey != "" || awsCfg.SessionToken != "" { if awsCfg.AccessKey == "" || awsCfg.SecretAccessKey == "" { - return cerrors.ErrEncryptionFailed.GenWithStackByArgs("aws kms access-key and secret-access-key must be set together") + return errors.ErrEncryptionFailed.GenWithStackByArgs("aws kms access-key and secret-access-key must be set together") } if awsCfg.Profile != "" { - return cerrors.ErrEncryptionFailed.GenWithStackByArgs("aws kms profile and static credentials are mutually exclusive") + return errors.ErrEncryptionFailed.GenWithStackByArgs("aws kms profile and static credentials are mutually exclusive") } } } @@ -217,7 +217,7 @@ func (c *client) validateConfig() error { if c.cfg.KMS.GCP != nil { gcpCfg := c.cfg.KMS.GCP if gcpCfg.CredentialsFile != "" && gcpCfg.CredentialsJSON != "" { - return cerrors.ErrEncryptionFailed.GenWithStackByArgs("gcp kms credentials-file and credentials-json are mutually exclusive") + return errors.ErrEncryptionFailed.GenWithStackByArgs("gcp kms credentials-file and credentials-json are mutually exclusive") } } @@ -267,7 +267,7 @@ func (c *client) resolveGCP(metaEndpoint string) gcpClientConfig { func (c *client) getAWSDecryptor(ctx context.Context, cfg awsClientConfig) (awsDecryptor, error) { if c.awsFactory == nil { log.Warn("aws kms decryptor factory is nil") - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("aws kms decryptor factory is nil") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("aws kms decryptor factory is nil") } key := awsClientKey{region: cfg.Region, endpoint: cfg.Endpoint} @@ -302,7 +302,7 @@ func (c *client) getAWSDecryptor(ctx context.Context, cfg awsClientConfig) (awsD func (c *client) getGCPDecryptor(ctx context.Context, cfg gcpClientConfig) (gcpDecryptor, error) { if c.gcpFactory == nil { log.Warn("gcp kms decryptor factory is nil") - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("gcp kms decryptor factory is nil") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("gcp kms decryptor factory is nil") } key := gcpClientKey{endpoint: cfg.Endpoint} diff --git a/pkg/encryption/kms/mock_client.go b/pkg/encryption/kms/mock_client.go index fcbb39f32c..a90b6bbbc9 100644 --- a/pkg/encryption/kms/mock_client.go +++ b/pkg/encryption/kms/mock_client.go @@ -20,7 +20,7 @@ import ( "crypto/rand" "github.com/pingcap/log" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -56,7 +56,7 @@ func NewMockKMSClient() *MockKMSClient { // In a real implementation, this would call the actual KMS service func (c *MockKMSClient) DecryptMasterKey(ctx context.Context, ciphertext []byte, keyID string, vendor string, region string, endpoint string) ([]byte, error) { if len(ciphertext) < aes.BlockSize { - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("ciphertext too short") + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("ciphertext too short") } log.Debug("mock KMS client: decrypting master key", @@ -69,7 +69,7 @@ func (c *MockKMSClient) DecryptMasterKey(ctx context.Context, ciphertext []byte, // The ciphertext is encrypted with the mock key block, err := aes.NewCipher(c.mockKey) if err != nil { - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } // Extract IV from the beginning of ciphertext @@ -89,13 +89,13 @@ func (c *MockKMSClient) DecryptMasterKey(ctx context.Context, ciphertext []byte, func (c *MockKMSClient) EncryptMasterKey(plaintext []byte) ([]byte, error) { block, err := aes.NewCipher(c.mockKey) if err != nil { - return nil, cerrors.ErrEncodeFailed.Wrap(err) + return nil, errors.ErrEncodeFailed.Wrap(err) } // Generate random IV iv := make([]byte, aes.BlockSize) if _, err := rand.Read(iv); err != nil { - return nil, cerrors.ErrEncodeFailed.Wrap(err) + return nil, errors.ErrEncodeFailed.Wrap(err) } // Encrypt using CTR mode diff --git a/pkg/encryption/manager.go b/pkg/encryption/manager.go index d5c8cd2d66..5415fc9ee7 100644 --- a/pkg/encryption/manager.go +++ b/pkg/encryption/manager.go @@ -22,7 +22,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/encryption/kms" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -117,7 +117,7 @@ func (m *encryptionMetaManager) GetCurrentDataKey(ctx context.Context, keyspaceI if meta.Current == nil || meta.Current.DataKeyId == 0 { log.Warn("encryption meta current data key ID is empty", zap.Uint32("keyspaceID", keyspaceID)) - return nil, "", 0, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("current data key ID is empty") + return nil, "", 0, errors.ErrDataKeyNotFound.GenWithStackByArgs("current data key ID is empty") } currentKeyID, err := encodeDataKeyID24BE(meta.Current.DataKeyId) @@ -134,7 +134,7 @@ func (m *encryptionMetaManager) GetCurrentDataKey(ctx context.Context, keyspaceI log.Warn("invalid encryption meta version derived from current data key ID", zap.Uint32("keyspaceID", keyspaceID), zap.Uint32("dataKeyID", meta.Current.DataKeyId)) - return nil, "", 0, cerrors.ErrEncryptionFailed.GenWithStackByArgs("version must be non-zero") + return nil, "", 0, errors.ErrEncryptionFailed.GenWithStackByArgs("version must be non-zero") } // Check cache first. @@ -156,7 +156,7 @@ func (m *encryptionMetaManager) GetCurrentDataKey(ctx context.Context, keyspaceI log.Warn("current data key not found in encryption meta", zap.Uint32("keyspaceID", keyspaceID), zap.Uint32("dataKeyID", meta.Current.DataKeyId)) - return nil, "", 0, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("current data key not found") + return nil, "", 0, errors.ErrDataKeyNotFound.GenWithStackByArgs("current data key not found") } plaintextKey, err := m.decryptDataKey(ctx, meta.MasterKey, dataKey.Ciphertext) @@ -215,7 +215,7 @@ func (m *encryptionMetaManager) GetDataKey(ctx context.Context, keyspaceID uint3 log.Warn("encryption not enabled when looking up data key", zap.Uint32("keyspaceID", keyspaceID), zap.Binary("dataKeyID", []byte(dataKeyID))) - return nil, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("encryption not enabled") + return nil, errors.ErrDataKeyNotFound.GenWithStackByArgs("encryption not enabled") } id, err := decodeDataKeyID24BE(dataKeyID) @@ -233,7 +233,7 @@ func (m *encryptionMetaManager) GetDataKey(ctx context.Context, keyspaceID uint3 zap.Uint32("keyspaceID", keyspaceID), zap.Uint32("dataKeyID", id), zap.Binary("dataKeyIDBytes", []byte(dataKeyID))) - return nil, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found: " + dataKeyID) + return nil, errors.ErrDataKeyNotFound.GenWithStackByArgs("data key not found: " + dataKeyID) } // Decrypt the data key using master key @@ -292,7 +292,7 @@ func (m *encryptionMetaManager) getMeta(ctx context.Context, keyspaceID uint32) meta, err := m.tikvClient.GetKeyspaceEncryptionMeta(ctx, keyspaceID) if err != nil { // If we get ErrEncryptionMetaNotFound, cache nil to avoid repeated lookups - if cerrors.ErrEncryptionMetaNotFound.Equal(err) { + if errors.ErrEncryptionMetaNotFound.Equal(err) { log.Info("encryption meta not found for keyspace", zap.Uint32("keyspaceID", keyspaceID)) m.metaMu.Lock() @@ -340,7 +340,7 @@ func (m *encryptionMetaManager) getMeta(ctx context.Context, keyspaceID uint32) func (m *encryptionMetaManager) decryptDataKey(ctx context.Context, masterKey *MasterKey, dataKeyCiphertext []byte) ([]byte, error) { if masterKey == nil { log.Warn("failed to decrypt data key: master key is nil") - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("master key is nil") + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("master key is nil") } // Decrypt master key from KMS @@ -359,13 +359,13 @@ func (m *encryptionMetaManager) decryptDataKey(ctx context.Context, masterKey *M zap.String("region", masterKey.Region), zap.String("endpoint", masterKey.Endpoint), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } if len(masterKeyPlaintext) != 32 { log.Warn("invalid master key plaintext length", zap.Int("length", len(masterKeyPlaintext))) - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("master key plaintext must be 32 bytes") + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("master key plaintext must be 32 bytes") } // Decrypt data key using master key (AES-CTR). @@ -373,7 +373,7 @@ func (m *encryptionMetaManager) decryptDataKey(ctx context.Context, masterKey *M if err != nil { log.Warn("failed to initialize AES cipher for data key decryption", zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } // New format: [iv(16)][ciphertext(payload)]. @@ -406,7 +406,7 @@ func (m *encryptionMetaManager) decryptDataKey(ctx context.Context, masterKey *M log.Warn("invalid data key ciphertext", zap.Int("length", len(dataKeyCiphertext)), zap.Error(err)) - return nil, cerrors.ErrDecodeFailed.Wrap(err) + return nil, errors.ErrDecodeFailed.Wrap(err) } fields := []zap.Field{ zap.String("format", "legacy_zero_iv"), @@ -422,7 +422,7 @@ func (m *encryptionMetaManager) decryptDataKey(ctx context.Context, masterKey *M func decryptDataKeyPayload(block cipher.Block, iv []byte, ciphertext []byte, requireMethodPrefix bool) ([]byte, byte, bool, error) { if len(iv) != aes.BlockSize { - return nil, 0, false, cerrors.ErrDecodeFailed.GenWithStackByArgs("iv must be 16 bytes") + return nil, 0, false, errors.ErrDecodeFailed.GenWithStackByArgs("iv must be 16 bytes") } stream := cipher.NewCTR(block, iv) plaintext := make([]byte, len(ciphertext)) @@ -444,7 +444,7 @@ func parsePlaintextDataKey(plaintext []byte, requireMethodPrefix bool) ([]byte, copy(key, plaintext[1:]) return key, method, true, nil default: - return nil, 0, false, cerrors.ErrDecodeFailed.GenWithStackByArgs("invalid data key plaintext length") + return nil, 0, false, errors.ErrDecodeFailed.GenWithStackByArgs("invalid data key plaintext length") } } @@ -454,7 +454,7 @@ func parsePlaintextDataKey(plaintext []byte, requireMethodPrefix bool) ([]byte, copy(key, plaintext) return key, 0, false, nil default: - return nil, 0, false, cerrors.ErrDecodeFailed.GenWithStackByArgs("invalid data key plaintext length") + return nil, 0, false, errors.ErrDecodeFailed.GenWithStackByArgs("invalid data key plaintext length") } } diff --git a/pkg/encryption/mock_tikv_client.go b/pkg/encryption/mock_tikv_client.go index 7dd005176e..9b099d4a5c 100644 --- a/pkg/encryption/mock_tikv_client.go +++ b/pkg/encryption/mock_tikv_client.go @@ -21,7 +21,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/encryption/kms" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -131,7 +131,7 @@ func (c *MockTiKVClient) GetKeyspaceEncryptionMeta(ctx context.Context, keyspace if c.notFoundKeyspaces[keyspaceID] { log.Debug("mock TiKV client: encryption meta not found", zap.Uint32("keyspaceID", keyspaceID)) - return nil, cerrors.ErrEncryptionMetaNotFound + return nil, errors.ErrEncryptionMetaNotFound } // Return mock metadata if available @@ -146,7 +146,7 @@ func (c *MockTiKVClient) GetKeyspaceEncryptionMeta(ctx context.Context, keyspace // This simulates classic architecture or unconfigured encryption log.Debug("mock TiKV client: encryption meta not found (unknown keyspace)", zap.Uint32("keyspaceID", keyspaceID)) - return nil, cerrors.ErrEncryptionMetaNotFound + return nil, errors.ErrEncryptionMetaNotFound } // SetKeyspaceMeta sets mock encryption metadata for a keyspace (for testing) @@ -154,7 +154,7 @@ func (c *MockTiKVClient) SetKeyspaceMeta(keyspaceID uint32, meta *EncryptionMeta c.metaMap[keyspaceID] = meta } -// SetKeyspaceNotFound sets a keyspace to return cerrors.ErrEncryptionMetaNotFound (for testing) +// SetKeyspaceNotFound sets a keyspace to return errors.ErrEncryptionMetaNotFound (for testing) func (c *MockTiKVClient) SetKeyspaceNotFound(keyspaceID uint32) { c.notFoundKeyspaces[keyspaceID] = true } diff --git a/pkg/encryption/mock_tikv_client_test.go b/pkg/encryption/mock_tikv_client_test.go index 8333c27598..aac15f2999 100644 --- a/pkg/encryption/mock_tikv_client_test.go +++ b/pkg/encryption/mock_tikv_client_test.go @@ -17,7 +17,7 @@ import ( "context" "testing" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -25,7 +25,7 @@ func TestMockTiKVClientNotFound(t *testing.T) { cli := NewMockTiKVClient() meta, err := cli.GetKeyspaceEncryptionMeta(context.Background(), 999) require.Nil(t, meta) - require.True(t, cerrors.ErrEncryptionMetaNotFound.Equal(err)) + require.True(t, errors.ErrEncryptionMetaNotFound.Equal(err)) } func TestMockTiKVClientEnabledKeyspace(t *testing.T) { diff --git a/pkg/encryption/tikv_http_client.go b/pkg/encryption/tikv_http_client.go index 16b74d92fb..e041f27fa3 100644 --- a/pkg/encryption/tikv_http_client.go +++ b/pkg/encryption/tikv_http_client.go @@ -22,9 +22,8 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/tidb/pkg/util/engine" @@ -83,7 +82,7 @@ func (c *tikvEncryptionHTTPClient) GetKeyspaceEncryptionMeta(ctx context.Context if err == nil { return meta, nil } - if cerrors.ErrEncryptionMetaNotFound.Equal(err) { + if errors.ErrEncryptionMetaNotFound.Equal(err) { lastErr = err continue } @@ -91,7 +90,7 @@ func (c *tikvEncryptionHTTPClient) GetKeyspaceEncryptionMeta(ctx context.Context } if lastErr == nil { - lastErr = cerrors.ErrEncryptionMetaNotFound + lastErr = errors.ErrEncryptionMetaNotFound } return nil, lastErr } @@ -133,7 +132,7 @@ func (c *tikvEncryptionHTTPClient) getEncryptionMetaFromStore(ctx context.Contex zap.String("statusAddr", statusAddr), zap.Uint32("keyspaceID", keyspaceID), zap.String("url", storeURL)) - return nil, cerrors.ErrEncryptionMetaNotFound + return nil, errors.ErrEncryptionMetaNotFound } if resp.StatusCode < 200 || resp.StatusCode >= 300 { log.Warn("unexpected encryption meta response status", @@ -285,7 +284,7 @@ func decodeEncryptionMetaResponseFromProtobuf(body []byte) (*encryptionMetaRespo return nil, errors.Trace(err) } if metaPB.Current == nil && metaPB.MasterKey == nil && len(metaPB.DataKeys) == 0 && len(metaPB.History) == 0 && metaPB.KeyspaceId == 0 { - return nil, cerrors.ErrDecodeFailed.GenWithStackByArgs("protobuf payload does not contain encryption meta fields") + return nil, errors.ErrDecodeFailed.GenWithStackByArgs("protobuf payload does not contain encryption meta fields") } return metaPB.toEncryptionMetaResponse(), nil } @@ -342,7 +341,7 @@ func (r *encryptionMetaResponse) toEncryptionMeta() (*EncryptionMeta, error) { if r.Current.DataKeyId == 0 { log.Warn("invalid encryption meta from TiKV: current data key ID is empty", zap.Uint32("metaKeyspaceID", r.KeyspaceId)) - return nil, cerrors.ErrEncryptionMetaNotFound + return nil, errors.ErrEncryptionMetaNotFound } version := byte(r.Current.DataKeyId & 0xFF) @@ -350,7 +349,7 @@ func (r *encryptionMetaResponse) toEncryptionMeta() (*EncryptionMeta, error) { log.Warn("invalid encryption meta from TiKV: version must be non-zero", zap.Uint32("metaKeyspaceID", r.KeyspaceId), zap.Uint32("currentDataKeyID", r.Current.DataKeyId)) - return nil, cerrors.ErrEncryptionFailed.GenWithStackByArgs("version must be non-zero") + return nil, errors.ErrEncryptionFailed.GenWithStackByArgs("version must be non-zero") } dataKeys := make(map[uint32]*DataKey, len(r.DataKeys)) @@ -363,7 +362,7 @@ func (r *encryptionMetaResponse) toEncryptionMeta() (*EncryptionMeta, error) { zap.Uint32("metaKeyspaceID", r.KeyspaceId), zap.Uint32("currentDataKeyID", r.Current.DataKeyId), zap.Int("dataKeyCount", len(dataKeys))) - return nil, cerrors.ErrDataKeyNotFound.GenWithStackByArgs("current data key not found") + return nil, errors.ErrDataKeyNotFound.GenWithStackByArgs("current data key not found") } history := make([]*EncryptionEpoch, 0, len(r.History)) diff --git a/pkg/encryption/tikv_http_client_test.go b/pkg/encryption/tikv_http_client_test.go index 128a0dfab9..99d06c4b0e 100644 --- a/pkg/encryption/tikv_http_client_test.go +++ b/pkg/encryption/tikv_http_client_test.go @@ -22,7 +22,7 @@ import ( oldproto "github.com/gogo/protobuf/proto" "github.com/pingcap/kvproto/pkg/metapb" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" pdopt "github.com/tikv/pd/client/opt" @@ -200,7 +200,7 @@ func TestTiKVEncryptionHTTPClientNotFoundReturnsErrEncryptionMetaNotFound(t *tes require.NoError(t, err) _, err = client.GetKeyspaceEncryptionMeta(context.Background(), 1) - require.True(t, cerrors.ErrEncryptionMetaNotFound.Equal(err), "err=%v", err) + require.True(t, errors.ErrEncryptionMetaNotFound.Equal(err), "err=%v", err) } func TestTiKVEncryptionHTTPClientRejectsVersionZeroMeta(t *testing.T) { @@ -246,7 +246,7 @@ func TestTiKVEncryptionHTTPClientRejectsVersionZeroMeta(t *testing.T) { require.NoError(t, err) _, err = client.GetKeyspaceEncryptionMeta(context.Background(), 1) - require.True(t, cerrors.ErrEncryptionFailed.Equal(err), "err=%v", err) + require.True(t, errors.ErrEncryptionFailed.Equal(err), "err=%v", err) } func TestTiKVEncryptionHTTPClientRejectsMetaMissingCurrentDataKey(t *testing.T) { @@ -292,7 +292,7 @@ func TestTiKVEncryptionHTTPClientRejectsMetaMissingCurrentDataKey(t *testing.T) require.NoError(t, err) _, err = client.GetKeyspaceEncryptionMeta(context.Background(), 1) - require.True(t, cerrors.ErrDataKeyNotFound.Equal(err), "err=%v", err) + require.True(t, errors.ErrDataKeyNotFound.Equal(err), "err=%v", err) } type testKeyspaceEncryptionMetaPB struct { diff --git a/pkg/errors/reexport.go b/pkg/errors/reexport.go index 01c1beb4b0..4a8a2df4e9 100644 --- a/pkg/errors/reexport.go +++ b/pkg/errors/reexport.go @@ -19,6 +19,15 @@ import ( perrors "github.com/pingcap/errors" ) +// Type aliases expose github.com/pingcap/errors types so callers don't need to +// import it directly. +type ( + Error = perrors.Error + RFCErrorCode = perrors.RFCErrorCode + ErrCode = perrors.ErrCode + ErrCodeText = perrors.ErrCodeText +) + var ( // Is is a shortcut for errors.Is. Is = errors.Is @@ -38,4 +47,41 @@ var ( Annotatef = perrors.Annotatef // WithMessage is a shortcut for github.com/pingcap/errors.WithMessage. WithMessage = perrors.WithMessage + // WithStack is a shortcut for github.com/pingcap/errors.WithStack. + WithStack = perrors.WithStack + // Wrap is a shortcut for github.com/pingcap/errors.Wrap. + Wrap = perrors.Wrap + // Wrapf is a shortcut for github.com/pingcap/errors.Wrapf. + Wrapf = perrors.Wrapf + // ErrorStack is a shortcut for github.com/pingcap/errors.ErrorStack. + ErrorStack = perrors.ErrorStack + // ErrorEqual is a shortcut for github.com/pingcap/errors.ErrorEqual. + ErrorEqual = perrors.ErrorEqual + // NewNoStackError is a shortcut for github.com/pingcap/errors.NewNoStackError. + NewNoStackError = perrors.NewNoStackError + // NotFoundf is a shortcut for github.com/pingcap/errors.NotFoundf. + NotFoundf = perrors.NotFoundf + // NotValidf is a shortcut for github.com/pingcap/errors.NotValidf. + NotValidf = perrors.NotValidf + // Normalize is a shortcut for github.com/pingcap/errors.Normalize. + Normalize = perrors.Normalize + // RFCCodeText is a shortcut for github.com/pingcap/errors.RFCCodeText. + RFCCodeText = perrors.RFCCodeText + // Unwrap is a shortcut for github.com/pingcap/errors.Unwrap. + Unwrap = perrors.Unwrap + // Find is a shortcut for github.com/pingcap/errors.Find. + Find = perrors.Find + // HasStack is a shortcut for github.com/pingcap/errors.HasStack. + HasStack = perrors.HasStack + // GetErrStackMsg is a shortcut for github.com/pingcap/errors.GetErrStackMsg. + GetErrStackMsg = perrors.GetErrStackMsg + + // RedactLogEnabled controls log redaction. See github.com/pingcap/errors. + RedactLogEnabled = &perrors.RedactLogEnabled + // RedactLogEnable is the redact mode "ON". + RedactLogEnable = perrors.RedactLogEnable + // RedactLogDisable is the redact mode "OFF". + RedactLogDisable = perrors.RedactLogDisable + // RedactLogMarker is the redact mode "MARKER". + RedactLogMarker = perrors.RedactLogMarker ) diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index 10e0c03f90..df28053582 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -21,10 +21,8 @@ import ( "time" "github.com/benbjohnson/clock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" - pkgerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/util" @@ -140,7 +138,7 @@ func retryRPC(rpcName string, metric prometheus.Counter, etcdRPC func() error) e // 16s = \sum_{n=0}^{6} 0.5*1.5^n return retry.Do(context.Background(), func() error { err := etcdRPC() - if err != nil && !cerror.Is(errors.Cause(err), context.Canceled) { + if err != nil && !errors.Is(errors.Cause(err), context.Canceled) { log.Warn("etcd RPC failed", zap.String("RPC", rpcName), zap.Error(err)) } if metric != nil { @@ -345,19 +343,19 @@ func (c *ClientImpl) RequestProgress(ctx context.Context) error { func isRetryableError(rpcName string) retry.IsRetryable { return func(err error) bool { - if !cerror.IsRetryableError(err) { + if !errors.IsRetryableError(err) { return false } switch rpcName { case EtcdRevoke: var etcdErr v3rpc.EtcdError - if cerror.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound { + if errors.As(err, &etcdErr) && etcdErr.Code() == codes.NotFound { // It means the etcd lease is already expired or revoked return false } case EtcdTxn: - return pkgerror.IsRetryableEtcdError(err) + return errors.IsRetryableEtcdError(err) default: // For other types of operation, we retry directly without handling errors } @@ -615,5 +613,5 @@ func IsHealthy(ctx context.Context, client *clientv3.Client) bool { _, err := client.Get(ctx, healthyPath) // permission denied is OK since proposal goes through consensus to get it // See: https://github.com/etcd-io/etcd/blob/85b640cee793e25f3837c47200089d14a8392dc7/etcdctl/ctlv3/command/ep_command.go#L124 - return err == nil || cerror.Is(err, rpctypes.ErrPermissionDenied) + return err == nil || errors.Is(err, rpctypes.ErrPermissionDenied) } diff --git a/pkg/etcd/client_test.go b/pkg/etcd/client_test.go index 199897c559..83f3ba4afb 100644 --- a/pkg/etcd/client_test.go +++ b/pkg/etcd/client_test.go @@ -20,7 +20,7 @@ import ( "time" "github.com/benbjohnson/clock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" clientv3 "go.etcd.io/etcd/client/v3" diff --git a/pkg/etcd/etcd_test.go b/pkg/etcd/etcd_test.go index e649797d8a..78ca6c3b5e 100644 --- a/pkg/etcd/etcd_test.go +++ b/pkg/etcd/etcd_test.go @@ -18,9 +18,8 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" @@ -333,7 +332,7 @@ func TestCDCEtcdClientImpl_CheckMultipleCDCClusterExist(t *testing.T) { {Key: []byte("/tidb/cdc/default-index/default/changefeed/info/changefeed1")}, }, assertion: func(t require.TestingT, err error, _ ...any) { - require.True(t, cerrors.ErrMultipleCDCClustersExist.Equal(err)) + require.True(t, errors.ErrMultipleCDCClustersExist.Equal(err)) }, }, { @@ -342,7 +341,7 @@ func TestCDCEtcdClientImpl_CheckMultipleCDCClusterExist(t *testing.T) { {Key: []byte("/tidb/cdc/owner-index/default/changefeed/info/changefeed1")}, }, assertion: func(t require.TestingT, err error, _ ...any) { - require.True(t, cerrors.ErrMultipleCDCClustersExist.Equal(err)) + require.True(t, errors.ErrMultipleCDCClustersExist.Equal(err)) }, }, } @@ -393,7 +392,7 @@ func TestCDCEtcdClientImpl_GetLogCoordinatorRevision(t *testing.T) { etcdClient := &CDCEtcdClientImpl{Client: client, ClusterID: clusterID} _, err := etcdClient.GetLogCoordinatorRevision(ctx, captureID) - require.True(t, cerrors.ErrOwnerNotFound.Equal(err)) + require.True(t, errors.ErrOwnerNotFound.Equal(err)) }) t.Run("not the log coordinator", func(t *testing.T) { @@ -410,7 +409,7 @@ func TestCDCEtcdClientImpl_GetLogCoordinatorRevision(t *testing.T) { etcdClient := &CDCEtcdClientImpl{Client: client, ClusterID: clusterID} _, err := etcdClient.GetLogCoordinatorRevision(ctx, captureID) - require.True(t, cerrors.ErrNotOwner.Equal(err)) + require.True(t, errors.ErrNotOwner.Equal(err)) }) t.Run("success", func(t *testing.T) { diff --git a/pkg/filter/expr_filter.go b/pkg/filter/expr_filter.go index 3e2f0fb5a9..331233cabe 100644 --- a/pkg/filter/expr_filter.go +++ b/pkg/filter/expr_filter.go @@ -17,11 +17,10 @@ import ( "strings" "sync" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/meta/model" @@ -62,7 +61,7 @@ func newExprFilterRule( ) (*dmlExprFilterRule, error) { tf, err := tfilter.Parse(cfg.Matcher) if err != nil { - return nil, cerror.WrapError(cerror.ErrFilterRuleInvalid, err, cfg.Matcher) + return nil, errors.WrapError(errors.ErrFilterRuleInvalid, err, cfg.Matcher) } ret := &dmlExprFilterRule{ @@ -88,25 +87,25 @@ func newExprFilterRule( // _, _, err := p.ParseSQL(completeExpression(r.config.IgnoreInsertValueExpr)) // if err != nil { // log.Error("failed to parse expression", zap.Error(err)) -// return cerror.ErrExpressionParseFailed. +// return errors.ErrExpressionParseFailed. // FastGenByArgs(r.config.IgnoreInsertValueExpr) // } // _, _, err = p.ParseSQL(completeExpression(r.config.IgnoreUpdateNewValueExpr)) // if err != nil { // log.Error("failed to parse expression", zap.Error(err)) -// return cerror.ErrExpressionParseFailed. +// return errors.ErrExpressionParseFailed. // FastGenByArgs(r.config.IgnoreUpdateNewValueExpr) // } // _, _, err = p.ParseSQL(completeExpression(r.config.IgnoreUpdateOldValueExpr)) // if err != nil { // log.Error("failed to parse expression", zap.Error(err)) -// return cerror.ErrExpressionParseFailed. +// return errors.ErrExpressionParseFailed. // FastGenByArgs(r.config.IgnoreUpdateOldValueExpr) // } // _, _, err = p.ParseSQL(completeExpression(r.config.IgnoreDeleteValueExpr)) // if err != nil { // log.Error("failed to parse expression", zap.Error(err)) -// return cerror.ErrExpressionParseFailed. +// return errors.ErrExpressionParseFailed. // FastGenByArgs(r.config.IgnoreDeleteValueExpr) // } // verify expression filter rule. @@ -240,11 +239,11 @@ func (r *dmlExprFilterRule) getSimpleExprOfTable( log.Error("meet unknown column when generating expression", zap.String("expression", expr), zap.Error(err)) - return nil, cerror.ErrExpressionColumnNotFound. + return nil, errors.ErrExpressionColumnNotFound. FastGenByArgs(getColumnFromError(err), tableInfo.Name.String(), expr) } log.Error("failed to parse expression", zap.Error(err)) - return nil, cerror.ErrExpressionParseFailed.FastGenByArgs(err, expr) + return nil, errors.ErrExpressionParseFailed.FastGenByArgs(err, expr) } return e, nil } @@ -468,10 +467,10 @@ func (f *dmlExprFilter) shouldSkipDML( for _, rule := range rules { ignore, err := rule.shouldSkipDML(dmlType, preRow, row, tableInfo) if err != nil { - if cerror.ShouldFailChangefeed(err) { + if errors.ShouldFailChangefeed(err) { return false, err } - return false, cerror.WrapError(cerror.ErrFailedToFilterDML, err, row) + return false, errors.WrapError(errors.ErrFailedToFilterDML, err, row) } if ignore { return true, nil diff --git a/pkg/filter/expr_filter_test.go b/pkg/filter/expr_filter_test.go index 8d97170197..a97655d256 100644 --- a/pkg/filter/expr_filter_test.go +++ b/pkg/filter/expr_filter_test.go @@ -18,7 +18,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" @@ -52,5 +52,5 @@ func TestDmlExprFilterInvalidConfig(t *testing.T) { _, err = f.shouldSkipDML(common.RowTypeInsert, emptyRow, chunkRow, ti) require.Error(t, err) - require.True(t, cerror.ErrExpressionParseFailed.Equal(err)) + require.True(t, errors.ErrExpressionParseFailed.Equal(err)) } diff --git a/pkg/filter/sql_event_filter.go b/pkg/filter/sql_event_filter.go index 1e7c2ee522..43603d3a24 100644 --- a/pkg/filter/sql_event_filter.go +++ b/pkg/filter/sql_event_filter.go @@ -16,12 +16,11 @@ package filter import ( "fmt" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" bf "github.com/pingcap/ticdc/pkg/binlog-filter" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" tfilter "github.com/pingcap/tidb/pkg/util/table-filter" "go.uber.org/zap" @@ -52,7 +51,7 @@ type sqlEventRule struct { func newSQLEventFilterRule(cfg *config.EventFilterRule, caseSensitive bool) (*sqlEventRule, error) { tf, err := tfilter.Parse(cfg.Matcher) if err != nil { - return nil, cerror.WrapError(cerror.ErrFilterRuleInvalid, err, cfg.Matcher) + return nil, errors.WrapError(errors.ErrFilterRuleInvalid, err, cfg.Matcher) } if !caseSensitive { @@ -76,7 +75,7 @@ func newSQLEventFilterRule(cfg *config.EventFilterRule, caseSensitive bool) (*sq res.bf, err = bf.NewBinlogEvent(caseSensitive, []*bf.BinlogEventRule{bfRule}) if err != nil { - return nil, cerror.WrapError(cerror.ErrFilterRuleInvalid, err, "failed to create binlog event filter") + return nil, errors.WrapError(errors.ErrFilterRuleInvalid, err, "failed to create binlog event filter") } return res, nil @@ -89,7 +88,7 @@ func verifyIgnoreEvents(types []bf.EventType) error { } for _, et := range types { if _, ok := typesMap[et]; !ok { - return cerror.ErrInvalidIgnoreEventType.GenWithStackByArgs(string(et)) + return errors.ErrInvalidIgnoreEventType.GenWithStackByArgs(string(et)) } } return nil @@ -202,7 +201,7 @@ func (f *sqlEventFilter) shouldSkipDML(schema, table string, dmlType common.RowT for _, rule := range rules { action, err := rule.bf.Filter(binlogFilterSchemaPlaceholder, binlogFilterTablePlaceholder, et, dmlQuery) if err != nil { - return false, cerror.WrapError(cerror.ErrFailedToFilterDML, err, fmt.Sprintf("%s.%s, %d", schema, table, dmlType)) + return false, errors.WrapError(errors.ErrFailedToFilterDML, err, fmt.Sprintf("%s.%s, %d", schema, table, dmlType)) } if action == bf.Ignore { return true, nil diff --git a/pkg/filter/sql_event_filter_test.go b/pkg/filter/sql_event_filter_test.go index 39855eb520..c270cbb4a3 100644 --- a/pkg/filter/sql_event_filter_test.go +++ b/pkg/filter/sql_event_filter_test.go @@ -17,11 +17,10 @@ import ( "fmt" "testing" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" bf "github.com/pingcap/ticdc/pkg/binlog-filter" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" timodel "github.com/pingcap/tidb/pkg/meta/model" "github.com/stretchr/testify/require" @@ -542,7 +541,7 @@ func TestShouldSkipDDL(t *testing.T) { }, }, }, - err: cerror.ErrInvalidIgnoreEventType, + err: errors.ErrInvalidIgnoreEventType, } _, err := newSQLEventFilter(case4.cfg, false) require.True(t, errors.ErrorEqual(err, case4.err), "case: %+s", err) @@ -579,7 +578,7 @@ func TestVerifyIgnoreEvents(t *testing.T) { cases = append(cases, testCase{ ignoreEvent: []bf.EventType{bf.EventType("unknown")}, - err: cerror.ErrInvalidIgnoreEventType, + err: errors.ErrInvalidIgnoreEventType, }) cases = append(cases, testCase{ diff --git a/pkg/filter/utils.go b/pkg/filter/utils.go index f75562e56e..81834699e0 100644 --- a/pkg/filter/utils.go +++ b/pkg/filter/utils.go @@ -19,7 +19,7 @@ import ( bf "github.com/pingcap/ticdc/pkg/binlog-filter" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" timodel "github.com/pingcap/tidb/pkg/meta/model" tifilter "github.com/pingcap/tidb/pkg/util/filter" tfilter "github.com/pingcap/tidb/pkg/util/table-filter" @@ -57,7 +57,7 @@ func VerifyTableRules(cfg *config.FilterConfig) (tfilter.Filter, error) { } f, err := tfilter.Parse(rules) if err != nil { - return nil, cerror.WrapError(cerror.ErrFilterRuleInvalid, err, cfg) + return nil, errors.WrapError(errors.ErrFilterRuleInvalid, err, cfg) } return f, nil diff --git a/pkg/fsutil/disk_info_freebsd.go b/pkg/fsutil/disk_info_freebsd.go index b6d1545a09..c6534267ce 100644 --- a/pkg/fsutil/disk_info_freebsd.go +++ b/pkg/fsutil/disk_info_freebsd.go @@ -20,7 +20,6 @@ import ( "path/filepath" "syscall" - cerror "github.com/pingcap/ticdc/pkg/errors" ) // GetDiskInfo return the disk space information of the given directory @@ -28,12 +27,12 @@ import ( func GetDiskInfo(dir string) (*DiskInfo, error) { f := filepath.Join(dir, "file.test") if err := os.WriteFile(f, []byte(""), 0o600); err != nil { - return nil, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return nil, errors.WrapError(errors.ErrGetDiskInfo, err) } fs := syscall.Statfs_t{} if err := syscall.Statfs(dir, &fs); err != nil { - return nil, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return nil, errors.WrapError(errors.ErrGetDiskInfo, err) } info := &DiskInfo{ @@ -46,7 +45,7 @@ func GetDiskInfo(dir string) (*DiskInfo, error) { if err := os.Remove(f); err != nil { if !os.IsNotExist(err) { - return info, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return info, errors.WrapError(errors.ErrGetDiskInfo, err) } } diff --git a/pkg/fsutil/disk_info_generic.go b/pkg/fsutil/disk_info_generic.go index e2e1d64f99..536611b8fa 100644 --- a/pkg/fsutil/disk_info_generic.go +++ b/pkg/fsutil/disk_info_generic.go @@ -20,7 +20,8 @@ import ( "path/filepath" "syscall" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" + ) // GetDiskInfo return the disk space information of the given directory @@ -28,12 +29,12 @@ import ( func GetDiskInfo(dir string) (*DiskInfo, error) { f := filepath.Join(dir, "file.test") if err := os.WriteFile(f, []byte(""), 0o600); err != nil { - return nil, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return nil, errors.WrapError(errors.ErrGetDiskInfo, err) } fs := syscall.Statfs_t{} if err := syscall.Statfs(dir, &fs); err != nil { - return nil, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return nil, errors.WrapError(errors.ErrGetDiskInfo, err) } info := &DiskInfo{ @@ -46,7 +47,7 @@ func GetDiskInfo(dir string) (*DiskInfo, error) { if err := os.Remove(f); err != nil { if !os.IsNotExist(err) { - return info, cerror.WrapError(cerror.ErrGetDiskInfo, err) + return info, errors.WrapError(errors.ErrGetDiskInfo, err) } } diff --git a/pkg/fsutil/filelock.go b/pkg/fsutil/filelock.go index acdd43c58a..7ee77c4b32 100644 --- a/pkg/fsutil/filelock.go +++ b/pkg/fsutil/filelock.go @@ -17,8 +17,7 @@ import ( "os" "syscall" - "github.com/pingcap/errors" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // FileLock represents a file lock created by `flock`. @@ -44,7 +43,7 @@ func (fl *FileLock) Lock() error { err := syscall.Flock(int(fdInt), syscall.LOCK_EX|syscall.LOCK_NB) if err != nil { if err == syscall.EAGAIN { - return cerrors.ErrConflictingFileLocks.Wrap(err).GenWithStackByArgs(fl.fd.Name()) + return errors.ErrConflictingFileLocks.Wrap(err).GenWithStackByArgs(fl.fd.Name()) } return errors.Trace(err) } diff --git a/pkg/fsutil/fileutil.go b/pkg/fsutil/fileutil.go index 7a8028c7ec..ea74d1ed2a 100644 --- a/pkg/fsutil/fileutil.go +++ b/pkg/fsutil/fileutil.go @@ -18,8 +18,7 @@ import ( "os" "path/filepath" - "github.com/pingcap/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) const ( @@ -30,10 +29,10 @@ const ( func IsDirAndWritable(path string) error { st, err := os.Stat(path) if err != nil { - return cerror.WrapError(cerror.ErrCheckDirWritable, err) + return errors.WrapError(errors.ErrCheckDirWritable, err) } if !st.IsDir() { - return cerror.WrapError(cerror.ErrCheckDirWritable, errors.Errorf("%s is not a directory", path)) + return errors.WrapError(errors.ErrCheckDirWritable, errors.Errorf("%s is not a directory", path)) } return IsDirWritable(path) } @@ -42,23 +41,23 @@ func IsDirAndWritable(path string) error { func IsDirWritable(dir string) error { f := filepath.Join(dir, ".writable.test") if err := os.WriteFile(f, []byte(""), 0o600); err != nil { - return cerror.WrapError(cerror.ErrCheckDirWritable, err) + return errors.WrapError(errors.ErrCheckDirWritable, err) } - return cerror.WrapError(cerror.ErrCheckDirWritable, os.Remove(f)) + return errors.WrapError(errors.ErrCheckDirWritable, os.Remove(f)) } // IsDirReadWritable check if the dir is writable and readable by cdc server func IsDirReadWritable(dir string) error { f := filepath.Join(dir, "file.test") if err := os.WriteFile(f, []byte(""), 0o600); err != nil { - return cerror.WrapError(cerror.ErrCheckDirValid, err) + return errors.WrapError(errors.ErrCheckDirValid, err) } if _, err := os.ReadFile(f); err != nil { - return cerror.WrapError(cerror.ErrCheckDirValid, err) + return errors.WrapError(errors.ErrCheckDirValid, err) } - return cerror.WrapError(cerror.ErrCheckDirValid, os.Remove(f)) + return errors.WrapError(errors.ErrCheckDirValid, os.Remove(f)) } // DiskInfo present the disk amount information, in gb diff --git a/pkg/httputil/httputil.go b/pkg/httputil/httputil.go index b89e74fef9..1ad6a69461 100644 --- a/pkg/httputil/httputil.go +++ b/pkg/httputil/httputil.go @@ -21,7 +21,7 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" ) diff --git a/pkg/logger/log.go b/pkg/logger/log.go index 862dc4c697..e44004db7f 100644 --- a/pkg/logger/log.go +++ b/pkg/logger/log.go @@ -24,9 +24,8 @@ import ( "github.com/IBM/sarama" "github.com/gin-gonic/gin" "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc/grpclog" @@ -233,7 +232,7 @@ func initOptionalComponent(op *loggerOp, cfg *Config) error { func ZapErrorFilter(err error, filterErrors ...error) zap.Field { cause := errors.Cause(err) for _, ferr := range filterErrors { - if cerror.Is(cause, ferr) { + if errors.Is(cause, ferr) { return zap.Error(nil) } } @@ -335,7 +334,7 @@ func ErrorFilterContextCanceled(logger *zap.Logger, msg string, fields ...zap.Fi } case zapcore.ErrorType: err, ok := field.Interface.(error) - if ok && cerror.Is(errors.Cause(err), context.Canceled) { + if ok && errors.Is(errors.Cause(err), context.Canceled) { return } } diff --git a/pkg/messaging/message_center.go b/pkg/messaging/message_center.go index 2f7a871bf2..927eca9fdc 100644 --- a/pkg/messaging/message_center.go +++ b/pkg/messaging/message_center.go @@ -20,10 +20,9 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" - pkgerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging/proto" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/node" @@ -298,7 +297,7 @@ func (mc *messageCenter) SendEvent(msg *TargetMessage) error { // For example, if the target is not discovered yet, the caller can retry later. // If the target is removed, the caller must remove the objects that was sending // message to this target to avoid blocking. - return pkgerror.AppError{Type: pkgerror.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %s not found", msg.To)} + return errors.AppError{Type: errors.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %s not found", msg.To)} } return target.sendEvent(msg) } @@ -316,7 +315,7 @@ func (mc *messageCenter) SendCommand(msg *TargetMessage) error { target, ok := mc.remoteTargets.m[msg.To] mc.remoteTargets.RUnlock() if !ok { - return errors.WithStack(pkgerror.AppError{Type: pkgerror.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %v not found", msg.To.String())}) + return errors.WithStack(errors.AppError{Type: errors.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %v not found", msg.To.String())}) } return target.sendCommand(msg) } @@ -446,7 +445,7 @@ func (s *grpcServer) handleConnect(stream proto.MessageService_StreamMessagesSer to := node.ID(msg.To) if to != s.id() { - err := pkgerror.AppError{Type: pkgerror.ErrorTypeTargetMismatch, Reason: fmt.Sprintf("The receiver %s not match with the message center id %s", to, s.id())} + err := errors.AppError{Type: errors.ErrorTypeTargetMismatch, Reason: fmt.Sprintf("The receiver %s not match with the message center id %s", to, s.id())} log.Error("Target mismatch", zap.Error(err)) return err } @@ -468,12 +467,12 @@ func (s *grpcServer) handleConnect(stream proto.MessageService_StreamMessagesSer zap.Stringer("localID", s.messageCenter.id), zap.String("localAddr", s.messageCenter.addr), zap.Stringer("remoteID", targetId)) - err := &pkgerror.AppError{Type: pkgerror.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %s not found", targetId)} + err := &errors.AppError{Type: errors.ErrorTypeTargetNotFound, Reason: fmt.Sprintf("Target %s not found", targetId)} return err } return nil }, retry.WithIsRetryableErr(func(err error) bool { - return !pkgerror.Is(err, context.DeadlineExceeded) + return !errors.Is(err, context.DeadlineExceeded) }), retry.WithMaxTries(10)) if err != nil { log.Error("Failed to get remote target", zap.Error(err)) diff --git a/pkg/messaging/remote_target.go b/pkg/messaging/remote_target.go index d7e09a3113..88633a390d 100644 --- a/pkg/messaging/remote_target.go +++ b/pkg/messaging/remote_target.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" diff --git a/pkg/migrate/migrate.go b/pkg/migrate/migrate.go index 87bfac66ea..41e2b887e8 100644 --- a/pkg/migrate/migrate.go +++ b/pkg/migrate/migrate.go @@ -22,11 +22,10 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" @@ -175,7 +174,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi metaVersion, err := getMetaVersion(ctx, m.cli.GetEtcdClient(), m.cli.GetClusterID()) if err != nil { log.Error("get meta version failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } if metaVersion > m.newMetaVersion { @@ -195,7 +194,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi _, err := m.cli.GetEtcdClient().Put(ctx, m.metaVersionKey, fmt.Sprintf("%d", oldVersion)) if err != nil { log.Error("put meta version failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } } @@ -209,7 +208,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi } log.Error("campaign old owner failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } beforeKV := make(map[string][]byte) @@ -219,7 +218,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi if err != nil { log.Error("get old meta data failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } for _, v := range resp.Kvs { oldKey := string(v.Key) @@ -233,7 +232,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi log.Error("unmarshal changefeed failed", zap.String("value", string(v.Value)), zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } info.UpstreamID = upstreamID info.ChangefeedID.DisplayName.Keyspace = common.DefaultKeyspaceName @@ -245,7 +244,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi if err != nil { log.Error("marshal changefeed failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } _, err = m.cli.GetEtcdClient().Put(ctx, newKey, str) } else { @@ -254,7 +253,7 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi if err != nil { log.Error("put new meta data failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } } } @@ -263,21 +262,21 @@ func (m *migrator) migrate(ctx context.Context, etcdNoMetaVersion bool, oldVersi if err != nil { log.Error("save default upstream failed, "+ "etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } err = m.migrateGcServiceSafePoint(ctx, pdClient, m.config.Security, m.cli.GetGCServiceID(), m.config.GcTTL) if err != nil { log.Error("update meta version failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } // 5. update metaVersion _, err = m.cli.GetEtcdClient().Put(ctx, m.metaVersionKey, fmt.Sprintf("%d", m.newMetaVersion)) if err != nil { log.Error("update meta version failed, etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } log.Info("etcd data migration successful") cleanOldData(ctx, m.cli.GetEtcdClient()) @@ -450,7 +449,7 @@ func (m *migrator) Migrate(ctx context.Context) error { log.Error("save default upstream failed, "+ "etcd meta data migration failed", zap.Error(err)) - return cerror.WrapError(cerror.ErrEtcdMigrateFailed, err) + return errors.WrapError(errors.ErrEtcdMigrateFailed, err) } _, err := m.cli.GetEtcdClient(). Put(ctx, m.metaVersionKey, fmt.Sprintf("%d", newVersion)) diff --git a/pkg/migrate/migrate_test.go b/pkg/migrate/migrate_test.go index 1a8fa81d40..bb350c67cd 100644 --- a/pkg/migrate/migrate_test.go +++ b/pkg/migrate/migrate_test.go @@ -26,7 +26,7 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/etcd" diff --git a/pkg/orchestrator/etcd_worker_test.go b/pkg/orchestrator/etcd_worker_test.go index 27bc9392f2..10d44feaa8 100644 --- a/pkg/orchestrator/etcd_worker_test.go +++ b/pkg/orchestrator/etcd_worker_test.go @@ -23,9 +23,8 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/migrate" "github.com/pingcap/ticdc/pkg/orchestrator/util" @@ -52,7 +51,7 @@ type simpleReactor struct { func (s *simpleReactor) Tick(_ context.Context, state ReactorState) (nextState ReactorState, err error) { if s.tickCount >= totalTicksPerReactor { - return s.state, cerrors.ErrReactorFinished + return s.state, errors.ErrReactorFinished } s.tickCount++ @@ -272,8 +271,8 @@ func TestEtcdSum(t *testing.T) { } err = errg.Wait() - if err != nil && (cerrors.Is(errors.Cause(err), context.DeadlineExceeded) || - cerrors.Is(errors.Cause(err), context.Canceled) || + if err != nil && (errors.Is(errors.Cause(err), context.DeadlineExceeded) || + errors.Is(errors.Cause(err), context.Canceled) || strings.Contains(err.Error(), "etcdserver: request timeout")) { return } @@ -323,7 +322,7 @@ func (r *linearizabilityReactor) Tick(ctx context.Context, state ReactorState) ( r.tickCount++ } if r.state.val == 1999 { - return r.state, cerrors.ErrReactorFinished + return r.state, errors.ErrReactorFinished } r.state.isUpdated = false return r.state, nil @@ -423,7 +422,7 @@ func (r *finishedReactor) Tick(ctx context.Context, state ReactorState) (nextSta r.state.AppendPatch(util.NewEtcdKey(r.prefix+"/key2"), func(old []byte) (newValue []byte, changed bool, err error) { return nil, true, nil }) - return r.state, cerrors.ErrReactorFinished + return r.state, errors.ErrReactorFinished } func TestFinished(t *testing.T) { @@ -493,7 +492,7 @@ func (r *coverReactor) Tick(ctx context.Context, state ReactorState) (nextState r.state.AppendPatch(util.NewEtcdKey(r.prefix+"/key2"), func(old []byte) (newValue []byte, changed bool, err error) { return append(old, []byte("fin")...), true, nil }) - return r.state, cerrors.ErrReactorFinished + return r.state, errors.ErrReactorFinished } func TestCover(t *testing.T) { @@ -572,7 +571,7 @@ func (r *emptyTxnReactor) Tick(ctx context.Context, state ReactorState) (nextSta r.state.AppendPatch(util.NewEtcdKey(r.prefix+"/key2"), func(old []byte) (newValue []byte, changed bool, err error) { return []byte("123"), true, nil }) - return r.state, cerrors.ErrReactorFinished + return r.state, errors.ErrReactorFinished } func TestEmptyTxn(t *testing.T) { @@ -641,7 +640,7 @@ func (r *emptyOrNilReactor) Tick(ctx context.Context, state ReactorState) (nextS r.state.AppendPatch(util.NewEtcdKey(r.prefix+"/key2"), func(old []byte) (newValue []byte, changed bool, err error) { return nil, true, nil }) - return r.state, cerrors.ErrReactorFinished + return r.state, errors.ErrReactorFinished } func TestEmptyOrNil(t *testing.T) { @@ -689,7 +688,7 @@ func (r *modifyOneReactor) Tick(ctx context.Context, state ReactorState) (nextSt if !r.finished { r.finished = true } else { - return r.state, cerrors.ErrReactorFinished.GenWithStackByArgs() + return r.state, errors.ErrReactorFinished.GenWithStackByArgs() } if r.waitOnCh != nil { select { @@ -777,8 +776,8 @@ func TestModifyAfterDelete(t *testing.T) { } func TestRetryableError(t *testing.T) { - require.True(t, isRetryableError(cerrors.ErrEtcdTryAgain)) - require.True(t, isRetryableError(cerrors.ErrReachMaxTry.Wrap(rpctypes.ErrTimeoutDueToLeaderFail))) + require.True(t, isRetryableError(errors.ErrEtcdTryAgain)) + require.True(t, isRetryableError(errors.ErrReachMaxTry.Wrap(rpctypes.ErrTimeoutDueToLeaderFail))) require.True(t, isRetryableError(errors.Trace(context.DeadlineExceeded))) require.False(t, isRetryableError(context.Canceled)) } diff --git a/pkg/orchestrator/reactor_state.go b/pkg/orchestrator/reactor_state.go index a118278a1d..c9ff95c72e 100644 --- a/pkg/orchestrator/reactor_state.go +++ b/pkg/orchestrator/reactor_state.go @@ -18,11 +18,10 @@ import ( "time" "github.com/goccy/go-json" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/orchestrator/util" "go.uber.org/zap" @@ -111,7 +110,7 @@ func (s *GlobalReactorState) Update(key util.EtcdKey, value []byte, _ bool) erro var newCaptureInfo config.CaptureInfo err := newCaptureInfo.Unmarshal(value) if err != nil { - return cerrors.ErrUnmarshalFailed.Wrap(err).GenWithStackByArgs() + return errors.ErrUnmarshalFailed.Wrap(err).GenWithStackByArgs() } log.Info("remote capture online", zap.Any("info", newCaptureInfo), zap.String("role", s.Role)) @@ -151,7 +150,7 @@ func (s *GlobalReactorState) Update(key util.EtcdKey, value []byte, _ bool) erro var newUpstreamInfo config.UpstreamInfo err := newUpstreamInfo.Unmarshal(value) if err != nil { - return cerrors.ErrUnmarshalFailed.Wrap(err).GenWithStackByArgs() + return errors.ErrUnmarshalFailed.Wrap(err).GenWithStackByArgs() } log.Info("new upstream is add", zap.Uint64("upstream", k.UpstreamID), zap.Any("info", newUpstreamInfo), zap.String("role", s.Role)) @@ -521,7 +520,7 @@ func (s *ChangefeedReactorState) CheckCaptureAlive(captureID config.CaptureID) { // The key-value pair of capture info is written with lease, // so if the capture info is not exist, the lease is expired if len(v) == 0 { - return v, false, cerrors.ErrLeaseExpired.GenWithStackByArgs() + return v, false, errors.ErrLeaseExpired.GenWithStackByArgs() } return v, false, nil }, @@ -537,7 +536,7 @@ func (s *ChangefeedReactorState) CheckChangefeedNormal() { s.PatchInfo(func(info *config.ChangeFeedInfo) (*config.ChangeFeedInfo, bool, error) { if info == nil || info.AdminJobType.IsStopState() { s.skipPatchesInThisTick = true - return info, false, cerrors.ErrEtcdTryAgain.GenWithStackByArgs() + return info, false, errors.ErrEtcdTryAgain.GenWithStackByArgs() } return info, false, nil }) @@ -547,7 +546,7 @@ func (s *ChangefeedReactorState) CheckChangefeedNormal() { } if status.AdminJobType.IsStopState() { s.skipPatchesInThisTick = true - return status, false, cerrors.ErrEtcdTryAgain.GenWithStackByArgs() + return status, false, errors.ErrEtcdTryAgain.GenWithStackByArgs() } return status, false, nil }) @@ -613,7 +612,7 @@ func (s *ChangefeedReactorState) patchAny(key string, tpi interface{}, fn func(i Key: util.NewEtcdKey(key), Func: func(v []byte) ([]byte, bool, error) { if s.skipPatchesInThisTick { - return v, false, cerrors.ErrEtcdIgnore.GenWithStackByArgs() + return v, false, errors.ErrEtcdIgnore.GenWithStackByArgs() } var e interface{} if v != nil { diff --git a/pkg/orchestrator/reactor_state_tester.go b/pkg/orchestrator/reactor_state_tester.go index a59241d83d..f5b93dabfd 100644 --- a/pkg/orchestrator/reactor_state_tester.go +++ b/pkg/orchestrator/reactor_state_tester.go @@ -16,8 +16,7 @@ package orchestrator import ( "testing" - "github.com/pingcap/errors" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/orchestrator/util" "github.com/stretchr/testify/require" ) @@ -82,9 +81,9 @@ RetryLoop: changedSet := make(map[util.EtcdKey]struct{}) for _, patch := range patches { err := patch.Patch(tmpKVEntries, changedSet) - if cerrors.ErrEtcdIgnore.Equal(errors.Cause(err)) { + if errors.ErrEtcdIgnore.Equal(errors.Cause(err)) { continue - } else if cerrors.ErrEtcdTryAgain.Equal(errors.Cause(err)) { + } else if errors.ErrEtcdTryAgain.Equal(errors.Cause(err)) { continue RetryLoop } else if err != nil { return errors.Trace(err) diff --git a/pkg/pdutil/api_client.go b/pkg/pdutil/api_client.go index f7d4d24e6b..e27899747b 100644 --- a/pkg/pdutil/api_client.go +++ b/pkg/pdutil/api_client.go @@ -27,13 +27,12 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config/kerneltype" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/security" @@ -188,7 +187,7 @@ func (pc *pdAPIClient) UpdateMetaLabel(ctx context.Context) error { retry.WithBackoffMaxDelay(4000), retry.WithIsRetryableErr(func(err error) bool { switch { - case cerror.Is(errors.Cause(err), context.Canceled): + case errors.Is(errors.Cause(err), context.Canceled): return false } return true @@ -283,7 +282,7 @@ func (pc *pdAPIClient) scanRegions( // Because start key is less than end key, there must be some regions. log.Error("fail to scan region, missing region", zap.String("endpoint", endpoint)) - return nil, cerror.WrapError(cerror.ErrInternalServerError, + return nil, errors.WrapError(errors.ErrInternalServerError, fmt.Errorf("fail to scan region, missing region")) } if r[0].StartKey != startKeyHex { @@ -365,7 +364,7 @@ func (pc *pdAPIClient) ListGcServiceSafePoint( return nil }, retry.WithMaxTries(defaultMaxRetry), retry.WithIsRetryableErr(func(err error) bool { switch { - case cerror.Is(errors.Cause(err), context.Canceled): + case errors.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/pdutil/api_client_test.go b/pkg/pdutil/api_client_test.go index d308a04b54..3baa68a7a0 100644 --- a/pkg/pdutil/api_client_test.go +++ b/pkg/pdutil/api_client_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/tidb/pkg/tablecodec" "github.com/pingcap/tidb/pkg/util/codec" @@ -101,7 +101,7 @@ func TestMetaLabelFail(t *testing.T) { require.Regexp(t, ".*404.*", err) err = pc.UpdateMetaLabel(ctx) - require.ErrorIs(t, err, cerror.ErrReachMaxTry) + require.ErrorIs(t, err, errors.ErrReachMaxTry) mockClient.testServer.Close() } diff --git a/pkg/pdutil/clock.go b/pkg/pdutil/clock.go index a709338554..45c89ba158 100644 --- a/pkg/pdutil/clock.go +++ b/pkg/pdutil/clock.go @@ -18,7 +18,7 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" pclock "github.com/pingcap/ticdc/pkg/clock" "github.com/pingcap/ticdc/pkg/retry" diff --git a/pkg/pdutil/utils.go b/pkg/pdutil/utils.go index ce4e952fa5..4b7277d6b4 100644 --- a/pkg/pdutil/utils.go +++ b/pkg/pdutil/utils.go @@ -20,7 +20,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/tikv/client-go/v2/oracle" pd "github.com/tikv/pd/client" "go.uber.org/zap" @@ -39,7 +39,7 @@ func GetSourceID(ctx context.Context, pdClient pd.Client) (uint64, error) { sourceID := uint64(1) sourceIDConfig, _, err := pdClient.LoadGlobalConfig(ctx, []string{sourceIDName}, "") if err != nil { - return 0, cerror.WrapError(cerror.ErrPDEtcdAPIError, err) + return 0, errors.WrapError(errors.ErrPDEtcdAPIError, err) } if len(sourceIDConfig) != 0 && sourceIDConfig[0].Value != "" { sourceID, err = strconv.ParseUint(sourceIDConfig[0].Value, 10, 64) @@ -47,7 +47,7 @@ func GetSourceID(ctx context.Context, pdClient pd.Client) (uint64, error) { log.Error("fail to parse sourceID from PD", zap.String("sourceID", sourceIDConfig[0].Value), zap.Error(err)) - return 0, cerror.WrapError(cerror.ErrPDEtcdAPIError, err) + return 0, errors.WrapError(errors.ErrPDEtcdAPIError, err) } } return sourceID, nil diff --git a/pkg/redo/reader/file.go b/pkg/redo/reader/file.go index 576265e62e..0bc8967091 100644 --- a/pkg/redo/reader/file.go +++ b/pkg/redo/reader/file.go @@ -29,11 +29,10 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" pevent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/compression" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/redo" "github.com/pingcap/ticdc/pkg/redo/codec" "github.com/pingcap/ticdc/pkg/redo/writer" @@ -85,7 +84,7 @@ type reader struct { func newReaders(ctx context.Context, cfg *readerConfig) ([]fileReader, error) { if cfg == nil { - return nil, cerror.WrapError(cerror.ErrRedoConfigInvalid, errors.New("readerConfig can not be nil")) + return nil, errors.WrapError(errors.ErrRedoConfigInvalid, errors.New("readerConfig can not be nil")) } if !cfg.useExternalStorage { log.Panic("external storage is not enabled, please check your configuration") @@ -122,7 +121,7 @@ func downLoadAndSortFiles(ctx context.Context, cfg *readerConfig) ([]io.ReadClos // create temp dir in local storage err := os.MkdirAll(dir, redo.DefaultDirMode) if err != nil { - return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) + return nil, errors.WrapError(errors.ErrRedoFileOp, err) } // get all files @@ -169,7 +168,7 @@ func downLoadAndSortFiles(ctx context.Context, cfg *readerConfig) ([]io.ReadClos if os.IsNotExist(err) { continue } - return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) + return nil, errors.WrapError(errors.ErrRedoFileOp, err) } ret = append(ret, f) } @@ -202,7 +201,7 @@ func selectDownLoadFile( return nil }) if err != nil { - return nil, cerror.WrapError(cerror.ErrExternalStorageAPI, err) + return nil, errors.WrapError(errors.ErrExternalStorageAPI, err) } return files, nil @@ -225,7 +224,7 @@ func readAllFromBuffer(buf []byte) (logHeap, error) { for { rl, err := r.Read() if err != nil { - if !cerror.Is(err, io.EOF) { + if !errors.Is(err, io.EOF) { return nil, err } break @@ -253,7 +252,7 @@ func sortAndWriteFile( fileContent, err := extStorage.ReadFile(egCtx, fileName) if err != nil { - return cerror.WrapError(cerror.ErrExternalStorageAPI, err) + return errors.WrapError(errors.ErrExternalStorageAPI, err) } if len(fileContent) == 0 { log.Warn("download file is empty", zap.String("file", fileName)) @@ -290,7 +289,7 @@ func sortAndWriteFile( } data, err := codec.MarshalRedoLog(item, nil) if err != nil { - return cerror.WrapError(cerror.ErrMarshalFailed, err) + return errors.WrapError(errors.ErrMarshalFailed, err) } _, err = w.Write(data) if err != nil { @@ -327,23 +326,23 @@ func (r *reader) Read() (*pevent.RedoLog, error) { lenField, err := readInt64(r.br) if err != nil { - if cerror.Is(err, io.EOF) { + if errors.Is(err, io.EOF) { return nil, err } - return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) + return nil, errors.WrapError(errors.ErrRedoFileOp, err) } recBytes, padBytes := decodeFrameSize(lenField) data := make([]byte, recBytes+padBytes) _, err = io.ReadFull(r.br, data) if err != nil { - if cerror.Is(err, io.EOF) || cerror.Is(err, io.ErrUnexpectedEOF) { + if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) { log.Warn("read redo log have unexpected io error", zap.String("fileName", r.fileName), zap.Error(err)) return nil, io.EOF } - return nil, cerror.WrapError(cerror.ErrRedoFileOp, err) + return nil, errors.WrapError(errors.ErrRedoFileOp, err) } redoLog, _, err := codec.UnmarshalRedoLog(data[:recBytes]) @@ -352,7 +351,7 @@ func (r *reader) Read() (*pevent.RedoLog, error) { // just return io.EOF, since if torn write it is the last redoLog entry return nil, io.EOF } - return nil, cerror.WrapError(cerror.ErrUnmarshalFailed, err) + return nil, errors.WrapError(errors.ErrUnmarshalFailed, err) } // point last valid offset to the end of redoLog @@ -420,5 +419,5 @@ func (r *reader) Close() error { return nil } - return cerror.WrapError(cerror.ErrRedoFileOp, r.closer.Close()) + return errors.WrapError(errors.ErrRedoFileOp, r.closer.Close()) } diff --git a/pkg/retry/error_retry.go b/pkg/retry/error_retry.go index fc2f482df0..61ffde7955 100644 --- a/pkg/retry/error_retry.go +++ b/pkg/retry/error_retry.go @@ -19,7 +19,7 @@ import ( "time" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -92,7 +92,7 @@ func (r *ErrorRetry) GetRetryBackoff(err error) (time.Duration, error) { zap.Time("firstRetryTime", r.firstRetryTime), zap.Time("lastErrorRetryTime", r.lastErrorRetryTime), zap.Time("now", time.Now())) - return 0, cerror.WrapChangefeedUnretryableErr(err) + return 0, errors.WrapChangefeedUnretryableErr(err) } r.lastInternalError = err diff --git a/pkg/retry/error_retry_test.go b/pkg/retry/error_retry_test.go index a3f8a83c7e..a0e495e308 100644 --- a/pkg/retry/error_retry_test.go +++ b/pkg/retry/error_retry_test.go @@ -16,7 +16,7 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index 3a81183671..814c3f9a7a 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -19,8 +19,7 @@ import ( "testing" "time" - "github.com/pingcap/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) @@ -66,7 +65,7 @@ func TestIsRetryable(t *testing.T) { err := Do(context.Background(), f, WithMaxTries(3), WithIsRetryableErr(func(err error) bool { switch { - case cerror.Is(errors.Cause(err), context.Canceled): + case errors.Is(errors.Cause(err), context.Canceled): return false } return true diff --git a/pkg/retry/retry_with_opt.go b/pkg/retry/retry_with_opt.go index 7a21c6cd3d..d953e4f6b3 100644 --- a/pkg/retry/retry_with_opt.go +++ b/pkg/retry/retry_with_opt.go @@ -20,8 +20,7 @@ import ( "strconv" "time" - "github.com/pingcap/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // Operation is the action need to retry @@ -65,14 +64,14 @@ func run(ctx context.Context, op Operation, retryOption *retryOptions) error { try++ if try >= retryOption.maxTries { - return cerror.ErrReachMaxTry. + return errors.ErrReachMaxTry. Wrap(err).GenWithStackByArgs(strconv.Itoa(int(retryOption.maxTries)), err) } if retryOption.totalRetryDuration > 0 { if start.IsZero() { start = time.Now() } else if time.Since(start) > retryOption.totalRetryDuration { - return cerror.ErrReachMaxTry. + return errors.ErrReachMaxTry. Wrap(err).GenWithStackByArgs(retryOption.totalRetryDuration, err) } } diff --git a/pkg/security/sasl.go b/pkg/security/sasl.go index 6b503b5bea..5b8cea4438 100644 --- a/pkg/security/sasl.go +++ b/pkg/security/sasl.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/IBM/sarama" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // SASLMechanism defines SASL mechanism. diff --git a/pkg/sink/codec/avro/glue_client.go b/pkg/sink/codec/avro/glue_client.go index b36a1c726f..77849c8e5b 100644 --- a/pkg/sink/codec/avro/glue_client.go +++ b/pkg/sink/codec/avro/glue_client.go @@ -19,7 +19,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/glue" "github.com/aws/aws-sdk-go-v2/service/glue/types" "github.com/google/uuid" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // glueClient is a partial interface of glue client, used to mock glue client in unit test diff --git a/pkg/sink/codec/builder.go b/pkg/sink/codec/builder.go index 8a17146921..d0f44b5342 100644 --- a/pkg/sink/codec/builder.go +++ b/pkg/sink/codec/builder.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/avro" "github.com/pingcap/ticdc/pkg/sink/codec/canal" "github.com/pingcap/ticdc/pkg/sink/codec/common" @@ -60,7 +59,7 @@ func NewEventDecoder( case config.ProtocolAvro: schemaM, err := avro.NewConfluentSchemaManager(ctx, codecConfig.AvroConfluentSchemaRegistry, nil) if err != nil { - return nil, cerror.Trace(err) + return nil, errors.Trace(err) } return avro.NewDecoder(codecConfig, idx, schemaM, topic, upstreamTiDB), nil case config.ProtocolSimple: diff --git a/pkg/sink/codec/canal/canal_json_encoder_test.go b/pkg/sink/codec/canal/canal_json_encoder_test.go index e84ebd109d..2d1204128e 100644 --- a/pkg/sink/codec/canal/canal_json_encoder_test.go +++ b/pkg/sink/codec/canal/canal_json_encoder_test.go @@ -23,7 +23,7 @@ import ( commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/compression" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "github.com/stretchr/testify/require" ) @@ -621,7 +621,7 @@ func TestMaxMessageBytes(t *testing.T) { Event: rc, ColumnSelector: columnselector.NewDefaultColumnSelector(), }) - require.Error(t, err, cerror.ErrMessageTooLarge) + require.Error(t, err, errors.ErrMessageTooLarge) } func TestCanalJSONContentCompatibleE2E(t *testing.T) { diff --git a/pkg/sink/codec/common/compress.go b/pkg/sink/codec/common/compress.go index 4eaf1494dc..0e19008bf8 100644 --- a/pkg/sink/codec/common/compress.go +++ b/pkg/sink/codec/common/compress.go @@ -14,7 +14,7 @@ package common import ( - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/compression" ) diff --git a/pkg/sink/codec/common/helper.go b/pkg/sink/codec/common/helper.go index c3da71fc83..a4e5569ec1 100644 --- a/pkg/sink/codec/common/helper.go +++ b/pkg/sink/codec/common/helper.go @@ -23,10 +23,9 @@ import ( "unsafe" mysqlDriver "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" @@ -270,7 +269,7 @@ func queryRowChecksumAux( _, err := conn.ExecContext(ctx, query) if err != nil { mysqlErr := &mysqlDriver.MySQLError{} - ok := cerror.As(errors.Cause(err), &mysqlErr) + ok := errors.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { @@ -327,7 +326,7 @@ func MustSnapshotQuery( _, err = conn.ExecContext(ctx, query) if err != nil { mysqlErr := &mysqlDriver.MySQLError{} - ok := cerror.As(errors.Cause(err), &mysqlErr) + ok := errors.As(errors.Cause(err), &mysqlErr) if ok { // Error 8055 (HY000): snapshot is older than GC safe point if mysqlErr.Number == 8055 { diff --git a/pkg/sink/codec/common/log_info.go b/pkg/sink/codec/common/log_info.go index 883f34019c..181d615792 100644 --- a/pkg/sink/codec/common/log_info.go +++ b/pkg/sink/codec/common/log_info.go @@ -16,7 +16,7 @@ package common import ( "errors" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" commonPkg "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" ) diff --git a/pkg/sink/codec/common/verify_checksum.go b/pkg/sink/codec/common/verify_checksum.go index a916ccfd1b..1e4c41e917 100644 --- a/pkg/sink/codec/common/verify_checksum.go +++ b/pkg/sink/codec/common/verify_checksum.go @@ -21,7 +21,7 @@ import ( "hash/crc32" "math" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/tidb/pkg/meta/model" diff --git a/pkg/sink/codec/open/codec_test.go b/pkg/sink/codec/open/codec_test.go index c677caeda6..abab0260cc 100644 --- a/pkg/sink/codec/open/codec_test.go +++ b/pkg/sink/codec/open/codec_test.go @@ -19,7 +19,7 @@ import ( "github.com/pingcap/ticdc/downstreamadapter/sink/columnselector" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/util/chunk" @@ -111,7 +111,7 @@ func TestRowChanged2MsgOnlyHandleKeyColumns(t *testing.T) { CommitTs: insertEventNoHandleKey.CommitTs, ColumnSelector: columnselector.NewDefaultColumnSelector(), }, columnFlags, config, true, "") - require.Error(t, err, cerror.ErrOpenProtocolCodecInvalidData) + require.Error(t, err, errors.ErrOpenProtocolCodecInvalidData) row, ok = insertEvent.GetNextRow() insertEvent.Rewind() @@ -151,7 +151,7 @@ func TestRowChanged2MsgOnlyHandleKeyColumns(t *testing.T) { CommitTs: insertEventNoHandleKey.CommitTs, ColumnSelector: columnselector.NewDefaultColumnSelector(), }, columnFlags, config, true, "") - require.Error(t, err, cerror.ErrOpenProtocolCodecInvalidData) + require.Error(t, err, errors.ErrOpenProtocolCodecInvalidData) row, ok = insertEvent.GetNextRow() insertEvent.Rewind() @@ -205,5 +205,5 @@ func TestRowChanged2MsgOnlyHandleKeyColumns(t *testing.T) { CommitTs: insertEventNoHandleKey.CommitTs, ColumnSelector: columnselector.NewDefaultColumnSelector(), }, columnFlags, config, true, "") - require.Error(t, err, cerror.ErrOpenProtocolCodecInvalidData) + require.Error(t, err, errors.ErrOpenProtocolCodecInvalidData) } diff --git a/pkg/sink/codec/simple/marshaller_bench_test.go b/pkg/sink/codec/simple/marshaller_bench_test.go index 3ddbc45fa4..c112a1df41 100644 --- a/pkg/sink/codec/simple/marshaller_bench_test.go +++ b/pkg/sink/codec/simple/marshaller_bench_test.go @@ -16,7 +16,7 @@ package simple import ( "testing" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/sink/codec/common" diff --git a/pkg/sink/kafka/claimcheck/claim_check.go b/pkg/sink/kafka/claimcheck/claim_check.go index 052785e2fa..eb6edff101 100644 --- a/pkg/sink/kafka/claimcheck/claim_check.go +++ b/pkg/sink/kafka/claimcheck/claim_check.go @@ -20,7 +20,7 @@ import ( "time" "github.com/google/uuid" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" diff --git a/pkg/sink/kafka/logutil.go b/pkg/sink/kafka/logutil.go index 8a90e7e3e9..f9365e5f71 100644 --- a/pkg/sink/kafka/logutil.go +++ b/pkg/sink/kafka/logutil.go @@ -18,7 +18,7 @@ import ( "strconv" "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" ) diff --git a/pkg/sink/kafka/oauth2_token_provider.go b/pkg/sink/kafka/oauth2_token_provider.go index dd25b3ff31..6096621be4 100644 --- a/pkg/sink/kafka/oauth2_token_provider.go +++ b/pkg/sink/kafka/oauth2_token_provider.go @@ -18,7 +18,7 @@ import ( "net/url" "github.com/IBM/sarama" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "golang.org/x/oauth2" "golang.org/x/oauth2/clientcredentials" ) diff --git a/pkg/sink/kafka/options.go b/pkg/sink/kafka/options.go index 6a5624427f..6d16de95da 100644 --- a/pkg/sink/kafka/options.go +++ b/pkg/sink/kafka/options.go @@ -26,11 +26,10 @@ import ( "github.com/gin-gonic/gin/binding" "github.com/imdario/mergo" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "go.uber.org/zap" ) @@ -110,7 +109,7 @@ func requireAcksFromString(acks int) (RequiredAcks, error) { case int(NoResponse): return NoResponse, nil default: - return Unknown, cerror.ErrKafkaInvalidRequiredAcks.GenWithStackByArgs(acks) + return Unknown, errors.ErrKafkaInvalidRequiredAcks.GenWithStackByArgs(acks) } } @@ -219,7 +218,7 @@ func (o *options) setPartitionNum(realPartitionCount int32) error { // the real partition count, since messages would be dispatched to different // partitions, this could prevent potential correctness problems. if o.PartitionNum > realPartitionCount { - return cerror.ErrKafkaInvalidPartitionNum.GenWithStack( + return errors.ErrKafkaInvalidPartitionNum.GenWithStack( "the number of partition (%d) specified in sink-uri is more than that of actual topic (%d)", o.PartitionNum, realPartitionCount) } @@ -236,7 +235,7 @@ func (o *options) Apply(changefeedID common.ChangeFeedID, req := &http.Request{URL: sinkURI} urlParameter := &urlConfig{} if err = binding.Query.Bind(req, urlParameter); err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } if urlParameter, err = mergeConfig(sinkConfig, urlParameter); err != nil { return err @@ -244,7 +243,7 @@ func (o *options) Apply(changefeedID common.ChangeFeedID, if urlParameter.PartitionNum != nil { o.PartitionNum = *urlParameter.PartitionNum if o.PartitionNum <= 0 { - return cerror.ErrKafkaInvalidPartitionNum.GenWithStackByArgs(o.PartitionNum) + return errors.ErrKafkaInvalidPartitionNum.GenWithStackByArgs(o.PartitionNum) } } @@ -383,7 +382,7 @@ func (o *options) applyTLS(params *urlConfig) error { if o.Credential != nil && !o.Credential.IsEmpty() && !o.Credential.IsTLSEnabled() { - return cerror.WrapError(cerror.ErrKafkaInvalidConfig, + return errors.WrapError(errors.ErrKafkaInvalidConfig, errors.New("ca, cert and key files should all be supplied")) } @@ -397,7 +396,7 @@ func (o *options) applyTLS(params *urlConfig) error { enableTLS := *params.EnableTLS if o.Credential != nil && o.Credential.IsTLSEnabled() && !enableTLS { - return cerror.WrapError(cerror.ErrKafkaInvalidConfig, + return errors.WrapError(errors.ErrKafkaInvalidConfig, errors.New("credential files are supplied, but 'enable-tls' is set to false")) } o.EnableTLS = enableTLS @@ -427,7 +426,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if urlParameter.SASLMechanism != nil && *urlParameter.SASLMechanism != "" { mechanism, err := security.SASLMechanismFromString(*urlParameter.SASLMechanism) if err != nil { - return cerror.WrapError(cerror.ErrKafkaInvalidConfig, err) + return errors.WrapError(errors.ErrKafkaInvalidConfig, err) } o.SASL.SASLMechanism = mechanism } @@ -435,7 +434,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if urlParameter.SASLGssAPIAuthType != nil && *urlParameter.SASLGssAPIAuthType != "" { authType, err := security.AuthTypeFromString(*urlParameter.SASLGssAPIAuthType) if err != nil { - return cerror.WrapError(cerror.ErrKafkaInvalidConfig, err) + return errors.WrapError(errors.ErrKafkaInvalidConfig, err) } o.SASL.GSSAPI.AuthType = authType } @@ -473,7 +472,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if sinkConfig.KafkaConfig.SASLOAuthClientID != nil { clientID := *sinkConfig.KafkaConfig.SASLOAuthClientID if clientID == "" { - return cerror.ErrKafkaInvalidConfig.GenWithStack("OAuth2 client ID cannot be empty") + return errors.ErrKafkaInvalidConfig.GenWithStack("OAuth2 client ID cannot be empty") } o.SASL.OAuth2.ClientID = clientID } @@ -481,7 +480,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if sinkConfig.KafkaConfig.SASLOAuthClientSecret != nil { clientSecret := *sinkConfig.KafkaConfig.SASLOAuthClientSecret if clientSecret == "" { - return cerror.ErrKafkaInvalidConfig.GenWithStack( + return errors.ErrKafkaInvalidConfig.GenWithStack( "OAuth2 client secret cannot be empty") } @@ -489,7 +488,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf decodedClientSecret, err := base64.StdEncoding.DecodeString(clientSecret) if err != nil { log.Error("OAuth2 client secret is not base64 encoded", zap.Error(err)) - return cerror.ErrKafkaInvalidConfig.GenWithStack( + return errors.ErrKafkaInvalidConfig.GenWithStack( "OAuth2 client secret is not base64 encoded") } o.SASL.OAuth2.ClientSecret = string(decodedClientSecret) @@ -498,7 +497,7 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if sinkConfig.KafkaConfig.SASLOAuthTokenURL != nil { tokenURL := *sinkConfig.KafkaConfig.SASLOAuthTokenURL if tokenURL == "" { - return cerror.ErrKafkaInvalidConfig.GenWithStack( + return errors.ErrKafkaInvalidConfig.GenWithStack( "OAuth2 token URL cannot be empty") } o.SASL.OAuth2.TokenURL = tokenURL @@ -506,13 +505,13 @@ func (o *options) applySASL(urlParameter *urlConfig, sinkConfig *config.SinkConf if o.SASL.OAuth2.IsEnable() { if o.SASL.SASLMechanism != security.OAuthMechanism { - return cerror.ErrKafkaInvalidConfig.GenWithStack( + return errors.ErrKafkaInvalidConfig.GenWithStack( "OAuth2 is only supported with SASL mechanism type OAUTHBEARER, but got %s", o.SASL.SASLMechanism) } if err := o.SASL.OAuth2.Validate(); err != nil { - return cerror.ErrKafkaInvalidConfig.Wrap(err) + return errors.ErrKafkaInvalidConfig.Wrap(err) } o.SASL.OAuth2.SetDefault() } @@ -566,7 +565,7 @@ func NewKafkaClientID(captureAddr string, clientID = commonInvalidChar.ReplaceAllString(clientID, "_") } if !validClientID.MatchString(clientID) { - return "", cerror.ErrKafkaInvalidClientID.GenWithStackByArgs(clientID) + return "", errors.ErrKafkaInvalidClientID.GenWithStackByArgs(clientID) } return } @@ -722,7 +721,7 @@ func validateMinInsyncReplicas( minInsyncReplicasStr, exists, err := minInsyncReplicasConfigGetter() if err != nil { // 'min.insync.replica' is invisible to us in Confluent Cloud Kafka. - if cerror.ErrKafkaConfigNotFound.Equal(err) { + if errors.ErrKafkaConfigNotFound.Equal(err) { log.Warn("TiCDC cannot find `min.insync.replicas` from broker's configuration, " + "please make sure that the replication factor is greater than or equal " + "to the minimum number of in-sync replicas" + @@ -747,7 +746,7 @@ func validateMinInsyncReplicas( MinInsyncReplicasConfigName, configFrom) log.Error(msg, zap.Int("replication-factor", replicationFactor), zap.Int("min.insync.replicas", minInsyncReplicas)) - return cerror.ErrKafkaInvalidConfig.GenWithStack( + return errors.ErrKafkaInvalidConfig.GenWithStack( "TiCDC Kafka sink's `request.required.acks` defaults to -1, "+ "TiCDC cannot deliver messages when the `replication-factor` %d "+ "is smaller than the `min.insync.replicas` %d of %s", diff --git a/pkg/sink/kafka/options_test.go b/pkg/sink/kafka/options_test.go index c5dfd8184d..e7b8903245 100644 --- a/pkg/sink/kafka/options_test.go +++ b/pkg/sink/kafka/options_test.go @@ -24,10 +24,9 @@ import ( "github.com/IBM/sarama" "github.com/aws/aws-sdk-go/aws" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "github.com/stretchr/testify/require" ) @@ -108,7 +107,7 @@ func TestCompleteOptions(t *testing.T) { require.NoError(t, err) options = NewOptions() err = options.Apply(commonType.NewChangefeedID4Test(commonType.DefaultKeyspaceName, "test"), sinkURI, config.GetDefaultReplicaConfig().Sink) - require.True(t, cerror.ErrKafkaInvalidClientID.Equal(err)) + require.True(t, errors.ErrKafkaInvalidClientID.Equal(err)) } func TestSetPartitionNum(t *testing.T) { @@ -124,7 +123,7 @@ func TestSetPartitionNum(t *testing.T) { options.PartitionNum = 3 err = options.setPartitionNum(2) - require.True(t, cerror.ErrKafkaInvalidPartitionNum.Equal(err)) + require.True(t, errors.ErrKafkaInvalidPartitionNum.Equal(err)) } func TestClientID(t *testing.T) { @@ -833,7 +832,7 @@ func TestAdjustOptionsKeepAlive(t *testing.T) { require.Error(t, err) // The error should be a type conversion error. numError := &strconv.NumError{} - ok := cerror.As(errors.Cause(err), &numError) + ok := errors.As(errors.Cause(err), &numError) require.True(t, ok, "error should be of type strconv.NumError") }) diff --git a/pkg/sink/kafka/sarama_async_producer.go b/pkg/sink/kafka/sarama_async_producer.go index 58b723af16..b356d7c365 100644 --- a/pkg/sink/kafka/sarama_async_producer.go +++ b/pkg/sink/kafka/sarama_async_producer.go @@ -18,11 +18,10 @@ import ( "time" "github.com/IBM/sarama" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" commonType "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "go.uber.org/atomic" "go.uber.org/zap" @@ -143,7 +142,7 @@ func (p *saramaAsyncProducer) handleProducerError(err *sarama.ProducerError) err extractLogInfo(err.Msg), err.Err, ) - return cerror.WrapError(cerror.ErrKafkaAsyncSendMessage, errWithInfo) + return errors.WrapError(errors.ErrKafkaAsyncSendMessage, errWithInfo) } func (p *saramaAsyncProducer) Heartbeat() { @@ -159,7 +158,7 @@ func (p *saramaAsyncProducer) AsyncSend( ctx context.Context, topic string, partition int32, message *common.Message, ) error { if p.closed.Load() { - return cerror.ErrKafkaProducerClosed.GenWithStackByArgs() + return errors.ErrKafkaProducerClosed.GenWithStackByArgs() } failpoint.Inject("KafkaSinkAsyncSendError", func() { // simulate sending message to input channel successfully but flushing diff --git a/pkg/sink/kafka/sarama_config_test.go b/pkg/sink/kafka/sarama_config_test.go index e8711a1440..f93080cd10 100644 --- a/pkg/sink/kafka/sarama_config_test.go +++ b/pkg/sink/kafka/sarama_config_test.go @@ -21,7 +21,7 @@ import ( "github.com/IBM/sarama" "github.com/gin-gonic/gin/binding" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/security" "github.com/stretchr/testify/require" diff --git a/pkg/sink/mysql/config.go b/pkg/sink/mysql/config.go index 2a44d27b2a..74ffa2e524 100644 --- a/pkg/sink/mysql/config.go +++ b/pkg/sink/mysql/config.go @@ -25,12 +25,11 @@ import ( dmysql "github.com/go-sql-driver/mysql" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/sink/sqlmodel" "github.com/pingcap/ticdc/pkg/util" @@ -229,12 +228,12 @@ func (c *Config) Apply( ) (err error) { if sinkURI == nil { log.Error("empty SinkURI") - return cerror.ErrMySQLInvalidConfig.GenWithStack("fail to open MySQL sink, empty SinkURI") + return errors.ErrMySQLInvalidConfig.GenWithStack("fail to open MySQL sink, empty SinkURI") } c.sinkURI = sinkURI scheme := strings.ToLower(sinkURI.Scheme) if !config.IsMySQLCompatibleScheme(scheme) { - return cerror.ErrMySQLInvalidConfig.GenWithStack("can't create MySQL sink with unsupported scheme: %s", scheme) + return errors.ErrMySQLInvalidConfig.GenWithStack("can't create MySQL sink with unsupported scheme: %s", scheme) } if cfg != nil { @@ -407,12 +406,12 @@ func NewMysqlConfigAndDB( // IsSinkSafeMode returns whether the sink is in safe mode. func IsSinkSafeMode(sinkURI *url.URL, replicaConfig *config.ReplicaConfig) (bool, error) { if sinkURI == nil { - return false, cerror.ErrMySQLInvalidConfig.GenWithStack("fail to open MySQL sink, empty SinkURI") + return false, errors.ErrMySQLInvalidConfig.GenWithStack("fail to open MySQL sink, empty SinkURI") } scheme := strings.ToLower(sinkURI.Scheme) if !config.IsMySQLCompatibleScheme(scheme) { - return false, cerror.ErrMySQLInvalidConfig.GenWithStack("can't create MySQL sink with unsupported scheme: %s", scheme) + return false, errors.ErrMySQLInvalidConfig.GenWithStack("can't create MySQL sink with unsupported scheme: %s", scheme) } query := sinkURI.Query() var safeMode bool @@ -430,10 +429,10 @@ func getWorkerCount(values url.Values, workerCount *int, workerCountSpecified *b c, err := strconv.Atoi(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } if c <= 0 { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, + return errors.WrapError(errors.ErrMySQLInvalidConfig, fmt.Errorf("invalid worker-count %d, which must be greater than 0", c)) } if c > maxWorkerCount { @@ -455,10 +454,10 @@ func getMaxTxnRow(values url.Values, maxTxnRow *int) error { c, err := strconv.Atoi(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } if c <= 0 { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, + return errors.WrapError(errors.ErrMySQLInvalidConfig, fmt.Errorf("invalid max-txn-row %d, which must be greater than 0", c)) } if c > maxMaxTxnRow { @@ -478,10 +477,10 @@ func getMaxMultiUpdateRowCount(values url.Values, maxMultiUpdateRow *int) error c, err := strconv.Atoi(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } if c <= 0 { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, + return errors.WrapError(errors.ErrMySQLInvalidConfig, fmt.Errorf("invalid max-multi-update-row %d, which must be greater than 0", c)) } if c > maxMaxMultiUpdateRowCount { @@ -501,10 +500,10 @@ func getMaxMultiUpdateRowSize(values url.Values, maxMultiUpdateRowSize *int) err c, err := strconv.Atoi(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } if c < 0 { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, + return errors.WrapError(errors.ErrMySQLInvalidConfig, fmt.Errorf("invalid max-multi-update-row-size %d, "+ "which must be greater than or equal to 0", c)) } @@ -563,7 +562,7 @@ func (c *Config) getSSLCA(values url.Values, changefeedID common.ChangeFeedID, t name := fmt.Sprintf("cdc_mysql_tls%s_%s", changefeedID.Keyspace(), changefeedID.ID()) err = dmysql.RegisterTLSConfig(name, tlsCfg) if err != nil { - return cerror.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") + return errors.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") } *tls = "?tls=" + name return nil @@ -590,13 +589,13 @@ func getTimezone(serverTimezone string, values url.Values, timezone *string) err changefeedTimezone, err := util.GetTimezone(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } *timezone = fmt.Sprintf(`"%s"`, changefeedTimezone.String()) // We need to check whether the timezone of the TiCDC server and the sink-uri are consistent. // If they are inconsistent, it may cause the data to be inconsistent. if changefeedTimezone.String() != serverTimezone { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, errors.Errorf( + return errors.WrapError(errors.ErrMySQLInvalidConfig, errors.Errorf( "the timezone of the TiCDC server and the sink-uri are inconsistent. "+ "TiCDC server timezone: %s, sink-uri timezone: %s. "+ "Please make sure that the timezone of the TiCDC server, "+ @@ -614,7 +613,7 @@ func getDuration(values url.Values, key string, target *string) error { } _, err := time.ParseDuration(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } *target = s return nil @@ -653,7 +652,7 @@ func getBool(values url.Values, key string, target *bool) error { if len(s) > 0 { enable, err := strconv.ParseBool(s) if err != nil { - return cerror.WrapError(cerror.ErrMySQLInvalidConfig, err) + return errors.WrapError(errors.ErrMySQLInvalidConfig, err) } *target = enable } diff --git a/pkg/sink/mysql/ddl_index_rewrite.go b/pkg/sink/mysql/ddl_index_rewrite.go index 4ee5c60a3e..4824ac58ee 100644 --- a/pkg/sink/mysql/ddl_index_rewrite.go +++ b/pkg/sink/mysql/ddl_index_rewrite.go @@ -14,7 +14,7 @@ package mysql import ( - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/tidb/pkg/parser" diff --git a/pkg/sink/mysql/helper.go b/pkg/sink/mysql/helper.go index b18e241e86..5fde110d5d 100644 --- a/pkg/sink/mysql/helper.go +++ b/pkg/sink/mysql/helper.go @@ -25,11 +25,10 @@ import ( "github.com/coreos/go-semver/semver" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/tidb/br/pkg/version" "github.com/pingcap/tidb/dumpling/export" @@ -71,7 +70,7 @@ func CheckIfBDRModeIsSupported(ctx context.Context, db *sql.DB) (bool, error) { _, err := db.ExecContext(ctx, query) if err != nil { mysqlErr := &dmysql.MySQLError{} - if cerror.As(errors.Cause(err), &mysqlErr) { + if errors.As(errors.Cause(err), &mysqlErr) { return false, nil } return false, err @@ -190,7 +189,7 @@ func GetTestDB(dbConfig *dmysql.Config) (*sql.DB, error) { if err != nil { // If access is denied and password is encoded by base64, try to decoded password. mysqlErr := &dmysql.MySQLError{} - if cerror.As(errors.Cause(err), &mysqlErr) { + if errors.As(errors.Cause(err), &mysqlErr) { if dePassword, decodeErr := base64.StdEncoding.DecodeString(password); decodeErr == nil && string(dePassword) != password { dbConfig.Passwd = string(dePassword) testDB, err = CreateMysqlDBConn(dbConfig.FormatDSN()) @@ -207,7 +206,7 @@ func checkTiDBVariable(db *sql.DB, variableName, defaultValue string) (string, e err := db.QueryRowContext(context.Background(), querySQL).Scan(&name, &value) if err != nil && err != sql.ErrNoRows { errMsg := "fail to query session variable " + variableName - return "", cerror.ErrMySQLQueryError.Wrap(err).GenWithStack(errMsg) + return "", errors.ErrMySQLQueryError.Wrap(err).GenWithStack(errMsg) } // session variable works, use given default value if err == nil { @@ -310,8 +309,8 @@ func checkCharsetSupport(db *sql.DB, charsetName string) (bool, error) { querySQL := "select character_set_name from information_schema.character_sets " + "where character_set_name = '" + charsetName + "';" err = db.QueryRowContext(context.Background(), querySQL).Scan(&characterSetName) - if err != nil && !cerror.Is(err, sql.ErrNoRows) { - return false, cerror.WrapError(cerror.ErrMySQLQueryError, err) + if err != nil && !errors.Is(err, sql.ErrNoRows) { + return false, errors.WrapError(errors.ErrMySQLQueryError, err) } if err != nil { return false, nil @@ -345,7 +344,7 @@ func GenerateDSN(ctx context.Context, cfg *Config) (string, error) { cfg.IsTiDB = CheckIsTiDB(ctx, testDB) if cfg.EnableActiveActive && !cfg.IsTiDB { - return "", cerror.ErrMySQLInvalidConfig.GenWithStack( + return "", errors.ErrMySQLInvalidConfig.GenWithStack( "enable-active-active requires downstream TiDB") } @@ -392,7 +391,7 @@ func GenerateDSN(ctx context.Context, cfg *Config) (string, error) { func CreateMysqlDBConn(dsnStr string) (*sql.DB, error) { db, err := sql.Open("mysql", dsnStr) if err != nil { - return nil, cerror.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") + return nil, errors.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") } err = db.PingContext(context.Background()) @@ -401,7 +400,7 @@ func CreateMysqlDBConn(dsnStr string) (*sql.DB, error) { if closeErr := db.Close(); closeErr != nil { log.Warn("close db failed", zap.Error(err)) } - return nil, cerror.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") + return nil, errors.ErrMySQLConnectionError.Wrap(err).GenWithStack("fail to open MySQL connection") } return db, nil } @@ -453,7 +452,7 @@ func getCheckRunningAddIndexSQL(cfg *Config) string { } func isRetryableDMLError(err error) bool { - if !cerror.IsRetryableError(err) { + if !errors.IsRetryableError(err) { return false } @@ -472,7 +471,7 @@ func isRetryableDMLError(err error) bool { func getSQLErrCode(err error) (errors.ErrCode, bool) { mysqlErr := &dmysql.MySQLError{} - ok := cerror.As(errors.Cause(err), &mysqlErr) + ok := errors.As(errors.Cause(err), &mysqlErr) if !ok { return -1, false } @@ -486,7 +485,7 @@ func queryMaxPreparedStmtCount(ctx context.Context, db *sql.DB) (int, error) { var maxPreparedStmtCount sql.NullInt32 err := row.Scan(&maxPreparedStmtCount) if err != nil { - err = cerror.WrapError(cerror.ErrMySQLQueryError, err) + err = errors.WrapError(errors.ErrMySQLQueryError, err) } return int(maxPreparedStmtCount.Int32), err } @@ -496,7 +495,7 @@ func queryMaxAllowedPacket(ctx context.Context, db *sql.DB) (int64, error) { row := db.QueryRowContext(ctx, "select @@global.max_allowed_packet;") var maxAllowedPacket sql.NullInt64 if err := row.Scan(&maxAllowedPacket); err != nil { - return 0, cerror.WrapError(cerror.ErrMySQLQueryError, err) + return 0, errors.WrapError(errors.ErrMySQLQueryError, err) } return maxAllowedPacket.Int64, nil } diff --git a/pkg/sink/mysql/mysql_writer.go b/pkg/sink/mysql/mysql_writer.go index 9bc2d6125d..7c91f338e7 100644 --- a/pkg/sink/mysql/mysql_writer.go +++ b/pkg/sink/mysql/mysql_writer.go @@ -21,11 +21,10 @@ import ( "time" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "go.uber.org/zap" ) @@ -260,7 +259,7 @@ func (w *Writer) checkIsDuplicateEntryError(err error) bool { if err == nil { return false } - if cerror.Is(errors.Cause(err), cerror.ErrMySQLDuplicateEntry) || + if errors.Is(errors.Cause(err), errors.ErrMySQLDuplicateEntry) || strings.Contains(err.Error(), "Duplicate entry") { if !w.isInErrorCausedSafeMode { w.isInErrorCausedSafeMode = true diff --git a/pkg/sink/mysql/mysql_writer_dml_batch.go b/pkg/sink/mysql/mysql_writer_dml_batch.go index 8e1ad21fbe..7ddaa41885 100644 --- a/pkg/sink/mysql/mysql_writer_dml_batch.go +++ b/pkg/sink/mysql/mysql_writer_dml_batch.go @@ -16,8 +16,8 @@ package mysql import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/sqlmodel" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/util/chunk" @@ -273,7 +273,7 @@ func (w *Writer) buildRowChangesForUnSafeBatch( rowKey := rowLists[i].rowKeys if nextRowType == common.RowTypeInsert { if compareKeys(rowKey, rowLists[j].rowKeys) { - return nil, nil, cerror.ErrUnexpected.FastGenByArgs("duplicate insert rows with same key") + return nil, nil, errors.ErrUnexpected.FastGenByArgs("duplicate insert rows with same key") } } else if nextRowType == common.RowTypeDelete { if compareKeys(rowKey, rowLists[j].preRowKeys) { @@ -283,7 +283,7 @@ func (w *Writer) buildRowChangesForUnSafeBatch( } } else if nextRowType == common.RowTypeUpdate { if !compareKeys(rowLists[j].preRowKeys, rowLists[j].rowKeys) { - return nil, nil, cerror.ErrUnexpected.FastGenByArgs("update row key mismatch") + return nil, nil, errors.ErrUnexpected.FastGenByArgs("update row key mismatch") } if compareKeys(rowKey, rowLists[j].preRowKeys) { flagList[i] = false @@ -304,11 +304,11 @@ func (w *Writer) buildRowChangesForUnSafeBatch( case common.RowTypeUpdate: rowKey := rowLists[i].rowKeys if !compareKeys(rowKey, rowLists[i].preRowKeys) { - return nil, nil, cerror.ErrUnexpected.FastGenByArgs("update row key mismatch") + return nil, nil, errors.ErrUnexpected.FastGenByArgs("update row key mismatch") } if nextRowType == common.RowTypeInsert { if compareKeys(rowKey, rowLists[j].rowKeys) { - return nil, nil, cerror.ErrUnexpected.FastGenByArgs("duplicate rows for update and insert") + return nil, nil, errors.ErrUnexpected.FastGenByArgs("duplicate rows for update and insert") } } else if nextRowType == common.RowTypeDelete { if compareKeys(rowKey, rowLists[j].preRowKeys) { @@ -329,7 +329,7 @@ func (w *Writer) buildRowChangesForUnSafeBatch( } else if nextRowType == common.RowTypeUpdate { if compareKeys(rowKey, rowLists[j].preRowKeys) { if !compareKeys(rowLists[j].preRowKeys, rowLists[j].rowKeys) { - return nil, nil, cerror.ErrUnexpected.FastGenByArgs("update row key mismatch") + return nil, nil, errors.ErrUnexpected.FastGenByArgs("update row key mismatch") } newRowChange := commonEvent.RowChange{ PreRow: rowLists[j].rowChange.PreRow, diff --git a/pkg/sink/mysql/mysql_writer_dml_exec.go b/pkg/sink/mysql/mysql_writer_dml_exec.go index f06daf58ff..6b920975a1 100644 --- a/pkg/sink/mysql/mysql_writer_dml_exec.go +++ b/pkg/sink/mysql/mysql_writer_dml_exec.go @@ -22,10 +22,9 @@ import ( "time" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/parser/mysql" @@ -35,7 +34,7 @@ import ( // execDMLWithMaxRetries executes prepared DMLs with retry/backoff handling. func (w *Writer) execDMLWithMaxRetries(dmls *preparedDMLs) error { if len(dmls.sqls) != len(dmls.values) || len(dmls.sqls) != len(dmls.rowTypes) { - return cerror.ErrUnexpected.FastGenByArgs(fmt.Sprintf("unexpected number of sqls and values or rowTypes, sqls is %s, values is %s, row types is %s", dmls.sqls, util.RedactAny(dmls.values), dmls.rowTypes)) + return errors.ErrUnexpected.FastGenByArgs(fmt.Sprintf("unexpected number of sqls and values or rowTypes, sqls is %s, values is %s, row types is %s", dmls.sqls, util.RedactAny(dmls.values), dmls.rowTypes)) } // approximateSize is multiplied by 2 because in extreme circustumas, every @@ -101,7 +100,7 @@ func (w *Writer) execDMLWithMaxRetries(dmls *preparedDMLs) error { failpoint.Inject("MySQLDuplicateEntryError", func() { log.Warn("inject MySQLDuplicateEntryError") - err := cerror.WrapError(cerror.ErrMySQLDuplicateEntry, &dmysql.MySQLError{ + err := errors.WrapError(errors.ErrMySQLDuplicateEntry, &dmysql.MySQLError{ Number: uint16(mysql.ErrDupEntry), Message: "Duplicate entry", }) @@ -158,12 +157,12 @@ func (w *Writer) sequenceExecute( if execError != nil { log.Error("ExecContext", zap.Error(execError), zap.Any("dmls", dmls), zap.Int("writerID", w.id)) if rbErr := tx.Rollback(); rbErr != nil { - if !cerror.Is(errors.Cause(rbErr), context.Canceled) { + if !errors.Is(errors.Cause(rbErr), context.Canceled) { log.Warn("failed to rollback txn", zap.Error(rbErr), zap.Int("writerID", w.id)) } } cancelFunc() - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(execError, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", query, util.RedactArgs(args)))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(execError, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", query, util.RedactArgs(args)))) } if rowsAffected, err := res.RowsAffected(); err != nil { log.Warn("get rows affected rows failed", zap.Error(err)) @@ -205,7 +204,7 @@ func (w *Writer) multiStmtExecute( zap.Int("writerID", w.id), zap.Error(rbErr)) } - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", multiStmtSQLWithTxn, util.RedactArgs(multiStmtArgs)))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", multiStmtSQLWithTxn, util.RedactArgs(multiStmtArgs)))) } if rowsAffected, err := res.RowsAffected(); err != nil { log.Warn("get rows affected rows failed", zap.Error(err)) diff --git a/pkg/sink/mysql/mysql_writer_dml_session.go b/pkg/sink/mysql/mysql_writer_dml_session.go index 9c00fbb240..f7e2a61780 100644 --- a/pkg/sink/mysql/mysql_writer_dml_session.go +++ b/pkg/sink/mysql/mysql_writer_dml_session.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "go.uber.org/zap" ) diff --git a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go index 5162ebb32f..eddf58d9c0 100644 --- a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go +++ b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go @@ -20,10 +20,9 @@ import ( "sync" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" tidbmysql "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/prometheus/client_golang/prometheus" @@ -43,7 +42,7 @@ func CheckActiveActiveSyncStatsSupported(ctx context.Context, db *sql.DB) (bool, var v sql.NullString if err := row.Scan(&v); err != nil { mysqlErr := &dmysql.MySQLError{} - if cerror.As(errors.Cause(err), &mysqlErr) && + if errors.As(errors.Cause(err), &mysqlErr) && mysqlErr.Number == tidbmysql.ErrUnknownSystemVariable { return false, nil } diff --git a/pkg/sink/mysql/mysql_writer_for_syncpoint.go b/pkg/sink/mysql/mysql_writer_for_syncpoint.go index cf3e788afa..0f772739b9 100644 --- a/pkg/sink/mysql/mysql_writer_for_syncpoint.go +++ b/pkg/sink/mysql/mysql_writer_for_syncpoint.go @@ -19,11 +19,10 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "go.uber.org/zap" ) @@ -47,7 +46,7 @@ func (w *Writer) createSyncTable() error { func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { tx, err := w.db.BeginTx(w.ctx, nil) if err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, "sync table: begin Tx fail;")) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, "sync table: begin Tx fail;")) } row := tx.QueryRow("select @@tidb_current_ts") var secondaryTs string @@ -58,7 +57,7 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { if err2 != nil { log.Error("failed to write syncpoint table", zap.Error(err)) } - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, "failed to write syncpoint table; Failed to get tidb_current_ts;")) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, "failed to write syncpoint table; Failed to get tidb_current_ts;")) } commitTs := event.GetCommitTs() @@ -79,7 +78,7 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { if err2 != nil { log.Error("failed to write syncpoint table", zap.Error(err2)) } - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("failed to write syncpoint table; Exec Failed; Query is %s", query))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("failed to write syncpoint table; Exec Failed; Query is %s", query))) } log.Info("exec syncpoint ts query", zap.String("query", query)) @@ -89,7 +88,7 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { query = fmt.Sprintf("set global tidb_external_ts = %s", secondaryTs) _, err = tx.Exec(query) if err != nil { - if cerror.IsSyncPointIgnoreError(err) { + if errors.IsSyncPointIgnoreError(err) { // TODO(dongmen): to confirm if we need to log this error. log.Warn("set global external ts failed, ignore this error", zap.Error(err)) } else { @@ -97,7 +96,7 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { if err2 != nil { log.Error("failed to write syncpoint table", zap.Error(err2)) } - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("failed to write syncpoint table; Exec Failed; Query is %s", query))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("failed to write syncpoint table; Exec Failed; Query is %s", query))) } } @@ -121,12 +120,12 @@ func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { if err != nil { // It is ok to ignore the error, since it will not affect the correctness of the system, // and no any business logic depends on this behavior, so we just log the error. - log.Error("failed to clean syncpoint table", zap.Error(cerror.WrapError(cerror.ErrMySQLTxnError, err)), zap.Any("query", query)) + log.Error("failed to clean syncpoint table", zap.Error(errors.WrapError(errors.ErrMySQLTxnError, err)), zap.Any("query", query)) } else { w.lastCleanSyncPointTime = time.Now() } } err = tx.Commit() - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, "failed to write syncpoint table; Commit Fail;")) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, "failed to write syncpoint table; Commit Fail;")) } diff --git a/pkg/sink/mysql/mysql_writer_test.go b/pkg/sink/mysql/mysql_writer_test.go index bda2a959e9..38709ed6a4 100644 --- a/pkg/sink/mysql/mysql_writer_test.go +++ b/pkg/sink/mysql/mysql_writer_test.go @@ -23,13 +23,12 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/go-sql-driver/mysql" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config/kerneltype" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/tidb/br/pkg/version" ticonfig "github.com/pingcap/tidb/pkg/config" @@ -736,7 +735,7 @@ func TestCheckIsDuplicateEntryError(t *testing.T) { // Test case 3: Wrap Error with "Duplicate entry" in message should return true beforeTime = time.Now() stringErr2 := fmt.Errorf("Error 1062: Duplicate entry 'test' for key 'PRIMARY'") - testErr := cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(stringErr2, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", "test sql", "test args"))) + testErr := errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(stringErr2, fmt.Sprintf("Failed to execute DMLs, query info:%s, args:%v; ", "test sql", "test args"))) result = writer.checkIsDuplicateEntryError(testErr) require.True(t, result) diff --git a/pkg/sink/mysql/progress_table_writer.go b/pkg/sink/mysql/progress_table_writer.go index 2bb020cd8a..e192ecba37 100644 --- a/pkg/sink/mysql/progress_table_writer.go +++ b/pkg/sink/mysql/progress_table_writer.go @@ -26,7 +26,6 @@ import ( "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/atomic" @@ -148,7 +147,7 @@ func (w *ProgressTableWriter) flushBatch( query := builder.String() _, err := w.db.ExecContext(w.ctx, query, args...) if err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs(args)))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs(args)))) } return nil } @@ -165,7 +164,7 @@ func (w *ProgressTableWriter) initProgressTable(ctx context.Context) error { createDB := "CREATE DATABASE IF NOT EXISTS `" + filter.TiCDCSystemSchema + "`" if _, err := w.db.ExecContext(ctx, createDB); err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute sql, sql info:%s", createDB))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute sql, sql info:%s", createDB))) } createTable := "CREATE TABLE IF NOT EXISTS `" + filter.TiCDCSystemSchema + "`.`" + progressTableName + "` (" + "changefeed_id VARCHAR(128) NOT NULL COMMENT 'Unique identifier for the changefeed synchronization task'," + @@ -176,7 +175,7 @@ func (w *ProgressTableWriter) initProgressTable(ctx context.Context) error { "PRIMARY KEY (changefeed_id, cluster_id, database_name, table_name)" + ") COMMENT='TiCDC synchronization progress table for HardDelete safety check'" if _, err := w.db.ExecContext(ctx, createTable); err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute sql, sql info:%s", createTable))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute sql, sql info:%s", createTable))) } w.progressTableInit = true @@ -252,7 +251,7 @@ func (w *ProgressTableWriter) removeTableBatch(changefeed, clusterID string, tab query := builder.String() _, err := w.db.ExecContext(w.ctx, query, args...) if err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs(args)))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs(args)))) } return nil } @@ -269,7 +268,7 @@ func (w *ProgressTableWriter) removeDatabase(changefeed, clusterID, dbName strin query := builder.String() _, err := w.db.ExecContext(w.ctx, query, changefeed, clusterID, dbName) if err != nil { - return cerror.WrapError(cerror.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs([]interface{}{changefeed, clusterID, dbName})))) + return errors.WrapError(errors.ErrMySQLTxnError, errors.WithMessage(err, fmt.Sprintf("Failed to execute query, query info:%s, args:%v; ", query, util.RedactArgs([]interface{}{changefeed, clusterID, dbName})))) } return nil } diff --git a/pkg/sink/pulsar/factory.go b/pkg/sink/pulsar/factory.go index 31f377a6ce..bdea3ca432 100644 --- a/pkg/sink/pulsar/factory.go +++ b/pkg/sink/pulsar/factory.go @@ -20,7 +20,7 @@ import ( "github.com/pingcap/ticdc/downstreamadapter/sink/metrics" commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -58,7 +58,7 @@ func NewCreatorFactory(config *config.PulsarConfig, changefeedID commonType.Chan if sinkConfig.PulsarConfig != nil && sinkConfig.PulsarConfig.TLSTrustCertsFilePath != nil { option.TLSTrustCertsFilePath = *sinkConfig.PulsarConfig.TLSTrustCertsFilePath } else { - return nil, cerror.ErrPulsarInvalidConfig. + return nil, errors.ErrPulsarInvalidConfig. GenWithStackByArgs("pulsar tls trust certs file path is not set when mTLS authentication is enabled") } } diff --git a/pkg/tcpserver/tcp_server.go b/pkg/tcpserver/tcp_server.go index dacc4bfe0b..0112ef771f 100644 --- a/pkg/tcpserver/tcp_server.go +++ b/pkg/tcpserver/tcp_server.go @@ -20,9 +20,8 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/soheilhy/cmux" "go.uber.org/atomic" @@ -109,7 +108,7 @@ func NewTCPServer(address string, credentials *security.Credential) (TCPServer, // Run runs the mux. The mux has to be running to accept connections. func (s *tcpServerImpl) Run(ctx context.Context) (err error) { if s.isClosed.Load() { - return cerror.ErrTCPServerClosed.GenWithStackByArgs() + return errors.ErrTCPServerClosed.GenWithStackByArgs() } log.Info("tcp server start to serve") defer func() { @@ -127,11 +126,11 @@ func (s *tcpServerImpl) Run(ctx context.Context) (err error) { errg.Go(func() error { err := s.mux.Serve() - if cerror.Is(err, cmux.ErrServerClosed) { - return cerror.ErrTCPServerClosed.GenWithStackByArgs() + if errors.Is(err, cmux.ErrServerClosed) { + return errors.ErrTCPServerClosed.GenWithStackByArgs() } if err != nil && strings.Contains(err.Error(), "use of closed network connection") { - return cerror.ErrTCPServerClosed.GenWithStackByArgs() + return errors.ErrTCPServerClosed.GenWithStackByArgs() } return errors.Trace(err) }) diff --git a/pkg/txnutil/gc/gc_service_test.go b/pkg/txnutil/gc/gc_service_test.go index dc0ad6dda6..0b43320699 100644 --- a/pkg/txnutil/gc/gc_service_test.go +++ b/pkg/txnutil/gc/gc_service_test.go @@ -19,10 +19,9 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config/kerneltype" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" pdgc "github.com/tikv/pd/client/clients/gc" @@ -112,7 +111,7 @@ func TestCheckSafetyOfStartTs(t *testing.T) { "ticdc-creating-", 0, common.NewChangeFeedIDWithName("changefeed1", "default"), TTL, 50) - require.True(t, cerror.ErrStartTsBeforeGC.Equal(errors.Cause(err))) + require.True(t, errors.ErrStartTsBeforeGC.Equal(errors.Cause(err))) err = EnsureChangefeedStartTsSafety(ctx, pdCli, "ticdc-creating-", @@ -145,7 +144,7 @@ func TestCheckSafetyOfStartTs(t *testing.T) { "ticdc-creating-", 0, common.NewChangeFeedIDWithName("changefeed2", "default"), TTL, 65) - require.True(t, cerror.ErrStartTsBeforeGC.Equal(errors.Cause(err))) + require.True(t, errors.ErrStartTsBeforeGC.Equal(errors.Cause(err))) pdCli.retryThreshold = 3 pdCli.retryCount = 0 @@ -153,7 +152,7 @@ func TestCheckSafetyOfStartTs(t *testing.T) { "ticdc-creating-", 0, common.NewChangeFeedIDWithName("changefeed1", "default"), TTL, 50) - require.True(t, cerror.ErrStartTsBeforeGC.Equal(errors.Cause(err))) + require.True(t, errors.ErrStartTsBeforeGC.Equal(errors.Cause(err))) } type mockPdClientForServiceGCSafePoint struct { diff --git a/pkg/upstream/manager.go b/pkg/upstream/manager.go index 29b1dffbea..9e9f5c8af9 100644 --- a/pkg/upstream/manager.go +++ b/pkg/upstream/manager.go @@ -20,7 +20,7 @@ import ( "github.com/benbjohnson/clock" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/security" @@ -89,7 +89,7 @@ func (m *Manager) AddDefaultUpstream( if err := m.initUpstreamFunc(m.ctx, up, &m.nodeCfg); err != nil { up.err.Store(err) up.Close() - return nil, cerror.Trace(err) + return nil, errors.Trace(err) } m.defaultUpstream = up m.ups.Store(up.ID, up) @@ -100,7 +100,7 @@ func (m *Manager) AddDefaultUpstream( // GetDefaultUpstream returns the default upstream func (m *Manager) GetDefaultUpstream() (*Upstream, error) { if m.defaultUpstream == nil { - return nil, cerror.ErrUpstreamNotFound + return nil, errors.ErrUpstreamNotFound } return m.defaultUpstream, nil } diff --git a/pkg/upstream/manager_test.go b/pkg/upstream/manager_test.go index 9de272f765..557450c29e 100644 --- a/pkg/upstream/manager_test.go +++ b/pkg/upstream/manager_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/stretchr/testify/require" uatomic "go.uber.org/atomic" diff --git a/pkg/upstream/upstream_test.go b/pkg/upstream/upstream_test.go index d9388cfb43..aa3dd9269c 100644 --- a/pkg/upstream/upstream_test.go +++ b/pkg/upstream/upstream_test.go @@ -20,7 +20,7 @@ import ( "time" "github.com/benbjohnson/clock" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/node" "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/util/redact.go b/pkg/util/redact.go index 4f94259e04..b44b9bbc4d 100644 --- a/pkg/util/redact.go +++ b/pkg/util/redact.go @@ -19,7 +19,7 @@ import ( "fmt" "strings" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/util/redact" ) diff --git a/pkg/util/redact_test.go b/pkg/util/redact_test.go index 100644210f..22375be1c1 100644 --- a/pkg/util/redact_test.go +++ b/pkg/util/redact_test.go @@ -18,7 +18,7 @@ import ( "strings" "testing" - perrors "github.com/pingcap/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/pkg/util/util.go b/pkg/util/util.go index 0c1949914d..5bb1a9c424 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -19,7 +19,7 @@ import ( "strconv" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // ParseHostAndPortFromAddress parse an address in format `host:port` like `127.0.0.1:2379`. diff --git a/pkg/version/check.go b/pkg/version/check.go index 703d9d36a6..4b02394244 100644 --- a/pkg/version/check.go +++ b/pkg/version/check.go @@ -26,7 +26,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/errors" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/security" @@ -99,7 +98,7 @@ func CheckClusterVersion( }, retry.WithBackoffBaseDelay(time.Millisecond.Milliseconds()*10), retry.WithBackoffMaxDelay(time.Second.Milliseconds()), retry.WithMaxTries(uint64(checkClusterVersionRetryTimes)), - retry.WithIsRetryableErr(cerror.IsRetryableError)) + retry.WithIsRetryableErr(errors.IsRetryableError)) if err == nil { break } @@ -118,23 +117,23 @@ func CheckTiCDCVersion(versions map[string]struct{}) error { if len(versions) >= 3 { arg := fmt.Sprintf("all running cdc instance belong to %d different versions, "+ "it's not allowed", len(versions)) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } ver := &semver.Version{} for v := range versions { if err := ver.Set(SanitizeVersion(v)); err != nil { - return cerror.WrapError(cerror.ErrNewSemVersion, err) + return errors.WrapError(errors.ErrNewSemVersion, err) } if ver.Compare(*MinTiCDCVersion) < 0 { arg := fmt.Sprintf("TiCDC %s is not supported, the minimal compatible version is %s", SanitizeVersion(v), MinTiCDCVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } if ver.Compare(*MaxTiCDCVersion) >= 0 { arg := fmt.Sprintf("TiCDC %s is not supported, only support version less than %s", SanitizeVersion(v), MaxTiCDCVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } } return nil @@ -156,7 +155,7 @@ func checkPDVersion(ctx context.Context, pdAddr string, credential *security.Cre defer cancel() resp, err := httpClient.Get(ctx, fmt.Sprintf("%s/pd/api/v1/version", pdAddr)) if err != nil { - return cerror.ErrCheckClusterVersionFromPD.GenWithStackByArgs(err) + return errors.ErrCheckClusterVersionFromPD.GenWithStackByArgs(err) } defer resp.Body.Close() @@ -168,31 +167,31 @@ func checkPDVersion(ctx context.Context, pdAddr string, credential *security.Cre } else { arg = fmt.Sprintf("%s %s", resp.Status, content) } - return cerror.ErrCheckClusterVersionFromPD.GenWithStackByArgs(arg) + return errors.ErrCheckClusterVersionFromPD.GenWithStackByArgs(arg) } err = json.Unmarshal(content, &pdVer) if err != nil { - return cerror.ErrCheckClusterVersionFromPD.GenWithStackByArgs(err) + return errors.ErrCheckClusterVersionFromPD.GenWithStackByArgs(err) } ver, err := semver.NewVersion(SanitizeVersion(pdVer.Version)) if err != nil { err = errors.Annotate(err, "invalid PD version") - return cerror.WrapError(cerror.ErrNewSemVersion, err) + return errors.WrapError(errors.ErrNewSemVersion, err) } minOrd := ver.Compare(*minPDVersion) if minOrd < 0 { arg := fmt.Sprintf("PD %s is not supported, the minimal compatible version is %s", SanitizeVersion(pdVer.Version), minPDVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } maxOrd := ver.Compare(*maxPDVersion) if maxOrd >= 0 { arg := fmt.Sprintf("PD %s is not supported, only support version less than %s", SanitizeVersion(pdVer.Version), maxPDVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } return nil } @@ -201,11 +200,11 @@ func checkPDVersion(ctx context.Context, pdAddr string, credential *security.Cre // If storeID is 0, it checks all TiKV. func CheckStoreVersion(ctx context.Context, client pd.Client) error { failpoint.Inject("GetStoreFailed", func() { - failpoint.Return(cerror.WrapError(cerror.ErrGetAllStoresFailed, fmt.Errorf("unknown store"))) + failpoint.Return(errors.WrapError(errors.ErrGetAllStoresFailed, fmt.Errorf("unknown store"))) }) stores, err := client.GetAllStores(ctx, pdopt.WithExcludeTombstone()) if err != nil { - return cerror.WrapError(cerror.ErrGetAllStoresFailed, err) + return errors.WrapError(errors.ErrGetAllStoresFailed, err) } for _, s := range stores { @@ -216,19 +215,19 @@ func CheckStoreVersion(ctx context.Context, client pd.Client) error { ver, err := semver.NewVersion(SanitizeVersion(s.Version)) if err != nil { err = errors.Annotate(err, "invalid TiKV version") - return cerror.WrapError(cerror.ErrNewSemVersion, err) + return errors.WrapError(errors.ErrNewSemVersion, err) } minOrd := ver.Compare(*MinTiKVVersion) if minOrd < 0 { arg := fmt.Sprintf("TiKV %s is not supported, the minimal compatible version is %s", SanitizeVersion(s.Version), MinTiKVVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } maxOrd := ver.Compare(*maxTiKVVersion) if maxOrd >= 0 { arg := fmt.Sprintf("TiKV %s is not supported, only support version less than %s", SanitizeVersion(s.Version), maxTiKVVersion) - return cerror.ErrVersionIncompatible.GenWithStackByArgs(arg) + return errors.ErrVersionIncompatible.GenWithStackByArgs(arg) } } return nil @@ -268,7 +267,7 @@ func GetTiCDCClusterVersion(captureVersion []string) (TiCDCClusterVersion, error } if err != nil { err = errors.Annotate(err, "invalid CDC cluster version") - return ticdcClusterVersionUnknown, cerror.WrapError(cerror.ErrNewSemVersion, err) + return ticdcClusterVersionUnknown, errors.WrapError(errors.ErrNewSemVersion, err) } if minVer == nil || ver.Compare(*minVer) < 0 { minVer = ver diff --git a/pkg/workerpool/async_pool_impl.go b/pkg/workerpool/async_pool_impl.go index e2bf3ab611..aa015ed216 100644 --- a/pkg/workerpool/async_pool_impl.go +++ b/pkg/workerpool/async_pool_impl.go @@ -18,8 +18,7 @@ import ( "sync" "sync/atomic" - "github.com/pingcap/errors" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "golang.org/x/sync/errgroup" ) @@ -61,7 +60,7 @@ func (p *defaultAsyncPoolImpl) Go(ctx context.Context, f func()) error { } func isRetryable(err error) bool { - return cerrors.IsRetryableError(err) && cerrors.ErrAsyncPoolExited.Equal(err) + return errors.IsRetryableError(err) && errors.ErrAsyncPoolExited.Equal(err) } func (p *defaultAsyncPoolImpl) doGo(ctx context.Context, f func()) error { @@ -69,7 +68,7 @@ func (p *defaultAsyncPoolImpl) doGo(ctx context.Context, f func()) error { defer p.runningLock.RUnlock() if atomic.LoadInt32(&p.isRunning) == 0 { - return cerrors.ErrAsyncPoolExited.GenWithStackByArgs() + return errors.ErrAsyncPoolExited.GenWithStackByArgs() } task := &asyncTask{f: f} @@ -79,7 +78,7 @@ func (p *defaultAsyncPoolImpl) doGo(ctx context.Context, f func()) error { defer worker.chLock.RUnlock() if atomic.LoadInt32(&worker.isClosed) == 1 { - return cerrors.ErrAsyncPoolExited.GenWithStackByArgs() + return errors.ErrAsyncPoolExited.GenWithStackByArgs() } select { @@ -112,7 +111,7 @@ func (p *defaultAsyncPoolImpl) Run(ctx context.Context) error { workerFinal := worker errg.Go(func() error { err := workerFinal.run() - if err != nil && cerrors.ErrAsyncPoolExited.NotEqual(errors.Cause(err)) { + if err != nil && errors.ErrAsyncPoolExited.NotEqual(errors.Cause(err)) { errCh <- err } return nil @@ -161,7 +160,7 @@ func (w *asyncWorker) run() error { for { task := <-w.inputCh if task == nil { - return cerrors.ErrAsyncPoolExited.GenWithStackByArgs() + return errors.ErrAsyncPoolExited.GenWithStackByArgs() } task.f() } diff --git a/pkg/workerpool/async_pool_test.go b/pkg/workerpool/async_pool_test.go index 782f22c0ee..cf5900d88f 100644 --- a/pkg/workerpool/async_pool_test.go +++ b/pkg/workerpool/async_pool_test.go @@ -21,9 +21,8 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) @@ -125,7 +124,7 @@ func runForDuration(ctx context.Context, duration time.Duration, f func(ctx cont case <-ctx.Done(): return ctx.Err() case err := <-errCh: - if cerrors.Is(errors.Cause(err), context.DeadlineExceeded) { + if errors.Is(errors.Cause(err), context.DeadlineExceeded) { return nil } return errors.Trace(err) diff --git a/pkg/workerpool/pool_impl.go b/pkg/workerpool/pool_impl.go index 2e386acb33..2514992c79 100644 --- a/pkg/workerpool/pool_impl.go +++ b/pkg/workerpool/pool_impl.go @@ -19,10 +19,9 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" - cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/notify" "go.uber.org/zap" "golang.org/x/sync/errgroup" @@ -129,7 +128,7 @@ type defaultEventHandle struct { func (h *defaultEventHandle) AddEvent(ctx context.Context, event interface{}) error { status := atomic.LoadInt32(&h.status) if status != handleRunning { - return cerrors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs() + return errors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs() } failpoint.Inject("addEventDelayPoint", func() {}) @@ -152,7 +151,7 @@ func (h *defaultEventHandle) AddEvent(ctx context.Context, event interface{}) er func (h *defaultEventHandle) AddEvents(ctx context.Context, events []interface{}) error { status := atomic.LoadInt32(&h.status) if status != handleRunning { - return cerrors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs() + return errors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs() } failpoint.Inject("addEventDelayPoint", func() {}) @@ -209,7 +208,7 @@ func (h *defaultEventHandle) Unregister() { // linearized BEFORE Unregister. h.worker.synchronize() - h.doCancel(cerrors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs()) + h.doCancel(errors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs()) } func (h *defaultEventHandle) GracefulUnregister(ctx context.Context, timeout time.Duration) error { @@ -227,7 +226,7 @@ func (h *defaultEventHandle) GracefulUnregister(ctx context.Context, timeout tim // call synchronize so that all function executions related to this handle will be // linearized BEFORE Unregister. h.worker.synchronize() - h.doCancel(cerrors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs()) + h.doCancel(errors.ErrWorkerPoolHandleCancelled.GenWithStackByArgs()) }() ctx, cancel := context.WithTimeout(ctx, timeout) @@ -236,7 +235,7 @@ func (h *defaultEventHandle) GracefulUnregister(ctx context.Context, timeout tim doneCh := make(chan struct{}) select { case <-ctx.Done(): - return cerrors.ErrWorkerPoolGracefulUnregisterTimedOut.GenWithStackByArgs() + return errors.ErrWorkerPoolGracefulUnregisterTimedOut.GenWithStackByArgs() case h.worker.taskCh <- task{ handle: h, doneCh: doneCh, @@ -245,7 +244,7 @@ func (h *defaultEventHandle) GracefulUnregister(ctx context.Context, timeout tim select { case <-ctx.Done(): - return cerrors.ErrWorkerPoolGracefulUnregisterTimedOut.GenWithStackByArgs() + return errors.ErrWorkerPoolGracefulUnregisterTimedOut.GenWithStackByArgs() case <-doneCh: } @@ -418,7 +417,7 @@ func (w *worker) synchronize() { receiver, err := w.stopNotifier.NewReceiver(time.Millisecond * 100) if err != nil { - if cerrors.ErrOperateOnClosedNotifier.Equal(errors.Cause(err)) { + if errors.ErrOperateOnClosedNotifier.Equal(errors.Cause(err)) { return } log.Panic("unexpected error", zap.Error(err)) diff --git a/pkg/workerpool/pool_test.go b/pkg/workerpool/pool_test.go index c25cb993e1..6ef110ed07 100644 --- a/pkg/workerpool/pool_test.go +++ b/pkg/workerpool/pool_test.go @@ -20,10 +20,9 @@ import ( "testing" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "go.uber.org/zap" "golang.org/x/sync/errgroup" @@ -475,7 +474,7 @@ func TestGracefulUnregister(t *testing.T) { var maxEventIdx int64 for i := int64(0); ; i++ { err := handle.AddEvent(ctx, i+1) - if cerror.ErrWorkerPoolHandleCancelled.Equal(err) { + if errors.ErrWorkerPoolHandleCancelled.Equal(err) { maxEventIdx = i break } @@ -497,7 +496,7 @@ func TestGracefulUnregister(t *testing.T) { err = handle.AddEvent(ctx, int64(0)) require.Error(t, err) - require.True(t, cerror.ErrWorkerPoolHandleCancelled.Equal(err)) + require.True(t, errors.ErrWorkerPoolHandleCancelled.Equal(err)) require.Equal(t, handleCancelled, handle.(*defaultEventHandle).status) wg.Wait() @@ -535,7 +534,7 @@ func TestGracefulUnregisterTimeout(t *testing.T) { }() err = handle.GracefulUnregister(ctx, time.Millisecond*10) require.Error(t, err) - require.Truef(t, cerror.ErrWorkerPoolGracefulUnregisterTimedOut.Equal(err), "%s", err.Error()) + require.Truef(t, errors.ErrWorkerPoolGracefulUnregisterTimedOut.Equal(err), "%s", err.Error()) } func TestSynchronizeLog(t *testing.T) { diff --git a/server/watcher/etcd_watcher.go b/server/watcher/etcd_watcher.go index 7f887ba7e1..ac8766656a 100644 --- a/server/watcher/etcd_watcher.go +++ b/server/watcher/etcd_watcher.go @@ -17,9 +17,8 @@ import ( "context" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/migrate" "github.com/pingcap/ticdc/pkg/orchestrator" @@ -65,18 +64,18 @@ func (w *EtcdWatcher) RunEtcdWorker( // 1/3 of session ttl that `session.Done` can't be triggered even // the lease is already revoked. switch { - case cerror.ErrEtcdSessionDone.Equal(err), - cerror.ErrLeaseExpired.Equal(err): + case errors.ErrEtcdSessionDone.Equal(err), + errors.ErrLeaseExpired.Equal(err): log.Warn("session is disconnected", zap.Error(err)) - return cerror.ErrCaptureSuicide.GenWithStackByArgs() + return errors.ErrCaptureSuicide.GenWithStackByArgs() } lease, inErr := w.etcdClient.GetEtcdClient().TimeToLive(ctx, w.session.Lease()) if inErr != nil { - return cerror.WrapError(cerror.ErrPDEtcdAPIError, inErr) + return errors.WrapError(errors.ErrPDEtcdAPIError, inErr) } if lease.TTL == int64(-1) { log.Warn("session is disconnected", zap.Error(err)) - return cerror.ErrCaptureSuicide.GenWithStackByArgs() + return errors.ErrCaptureSuicide.GenWithStackByArgs() } return errors.Trace(err) } diff --git a/tests/integration_tests/api_v2/main.go b/tests/integration_tests/api_v2/main.go index 9a5636a671..27d17c2818 100644 --- a/tests/integration_tests/api_v2/main.go +++ b/tests/integration_tests/api_v2/main.go @@ -21,7 +21,7 @@ import ( "os/signal" "syscall" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/httputil" "go.uber.org/zap" diff --git a/tests/integration_tests/api_v2/model.go b/tests/integration_tests/api_v2/model.go index 14e2c2e90c..59da589816 100644 --- a/tests/integration_tests/api_v2/model.go +++ b/tests/integration_tests/api_v2/model.go @@ -17,7 +17,7 @@ import ( "encoding/json" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) const timeFormat = `"2006-01-02 15:04:05.000"` diff --git a/tests/integration_tests/api_v2/request.go b/tests/integration_tests/api_v2/request.go index bc42eeeb60..b14214c89e 100644 --- a/tests/integration_tests/api_v2/request.go +++ b/tests/integration_tests/api_v2/request.go @@ -17,7 +17,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "io" "net/http" @@ -29,7 +28,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/api/middleware" "github.com/pingcap/ticdc/pkg/api" - cerrors "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/version" @@ -375,7 +374,7 @@ func (r *Request) Do(ctx context.Context) (res *Result) { // rewind the request body when r.body is not nil if seeker, ok := r.body.(io.Seeker); ok && r.body != nil { if _, err := seeker.Seek(0, 0); err != nil { - return cerrors.ErrRewindRequestBodyError + return errors.ErrRewindRequestBodyError } } @@ -408,7 +407,7 @@ func (r *Request) Do(ctx context.Context) (res *Result) { retry.WithBackoffBaseDelay(baseDelay), retry.WithBackoffMaxDelay(maxDelay), retry.WithMaxTries(maxRetries), - retry.WithIsRetryableErr(cerrors.IsRetryableError), + retry.WithIsRetryableErr(errors.IsRetryableError), ) } else { err = fn() @@ -486,7 +485,7 @@ func (r Result) Into(obj interface{}) error { } if len(r.body) == 0 { - return cerrors.ErrZeroLengthResponseBody.GenWithStackByArgs(r.statusCode) + return errors.ErrZeroLengthResponseBody.GenWithStackByArgs(r.statusCode) } return json.Unmarshal(r.body, obj) diff --git a/tests/integration_tests/bank/case.go b/tests/integration_tests/bank/case.go index 9c2b5e85fb..ede17896eb 100644 --- a/tests/integration_tests/bank/case.go +++ b/tests/integration_tests/bank/case.go @@ -29,9 +29,8 @@ import ( "time" _ "github.com/go-sql-driver/mysql" // MySQL driver - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/tikv/client-go/v2/oracle" "go.uber.org/zap" @@ -194,7 +193,7 @@ func (*sequenceTest) verify(ctx context.Context, db *sql.DB, accounts, tableID i } return nil - }, retry.WithBackoffMaxDelay(500), retry.WithBackoffMaxDelay(120*1000), retry.WithMaxTries(10), retry.WithIsRetryableErr(cerror.IsRetryableError)) + }, retry.WithBackoffMaxDelay(500), retry.WithBackoffMaxDelay(120*1000), retry.WithMaxTries(10), retry.WithIsRetryableErr(errors.IsRetryableError)) } // tryDropDB will drop table if data incorrect and panic error likes bad connect. @@ -320,7 +319,7 @@ func (*bankTest) verify(ctx context.Context, db *sql.DB, accounts, tableID int, } return nil - }, retry.WithBackoffBaseDelay(int64(retryInterval)), retry.WithBackoffMaxDelay(120*1000), retry.WithMaxTries(20), retry.WithIsRetryableErr(cerror.IsRetryableError)) + }, retry.WithBackoffBaseDelay(int64(retryInterval)), retry.WithBackoffMaxDelay(120*1000), retry.WithMaxTries(20), retry.WithIsRetryableErr(errors.IsRetryableError)) } // tryDropDB will drop table if data incorrect and panic error likes bad connect. @@ -561,7 +560,7 @@ func run( return ctx.Err() default: err := workload() - if err != nil && !cerror.Is(errors.Cause(err), context.Canceled) { + if err != nil && !errors.Is(errors.Cause(err), context.Canceled) { log.Warn("workload failed", zap.Error(err)) } diff --git a/tests/integration_tests/cdc/cdc.go b/tests/integration_tests/cdc/cdc.go index bf82b7f55f..c1ee366448 100644 --- a/tests/integration_tests/cdc/cdc.go +++ b/tests/integration_tests/cdc/cdc.go @@ -18,9 +18,8 @@ import ( "os" _ "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/cdc/dailytest" "github.com/pingcap/ticdc/tests/integration_tests/util" ) @@ -30,7 +29,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case cerror.Is(errors.Cause(err), flag.ErrHelp): + case errors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/cdc/dailytest/case.go b/tests/integration_tests/cdc/dailytest/case.go index 50524a4132..c26dff3b42 100644 --- a/tests/integration_tests/cdc/dailytest/case.go +++ b/tests/integration_tests/cdc/dailytest/case.go @@ -21,7 +21,7 @@ import ( "sync" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" ) diff --git a/tests/integration_tests/cdc/dailytest/db.go b/tests/integration_tests/cdc/dailytest/db.go index 905d2679d3..7107b9b8e4 100644 --- a/tests/integration_tests/cdc/dailytest/db.go +++ b/tests/integration_tests/cdc/dailytest/db.go @@ -21,7 +21,7 @@ import ( "strconv" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/tests/integration_tests/util" "github.com/pingcap/tidb/pkg/parser/mysql" diff --git a/tests/integration_tests/cdc/dailytest/job.go b/tests/integration_tests/cdc/dailytest/job.go index 6e3243ee2a..acb853e0f8 100644 --- a/tests/integration_tests/cdc/dailytest/job.go +++ b/tests/integration_tests/cdc/dailytest/job.go @@ -17,7 +17,7 @@ import ( "database/sql" "fmt" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/types" diff --git a/tests/integration_tests/cdc/dailytest/parser.go b/tests/integration_tests/cdc/dailytest/parser.go index 217a0d2e27..2b1637d7a3 100644 --- a/tests/integration_tests/cdc/dailytest/parser.go +++ b/tests/integration_tests/cdc/dailytest/parser.go @@ -18,7 +18,7 @@ import ( "strconv" "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/pkg/parser" "github.com/pingcap/tidb/pkg/parser/ast" diff --git a/tests/integration_tests/complex_transaction/workload.go b/tests/integration_tests/complex_transaction/workload.go index 1919914a70..946d21bf5f 100644 --- a/tests/integration_tests/complex_transaction/workload.go +++ b/tests/integration_tests/complex_transaction/workload.go @@ -21,9 +21,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) @@ -205,7 +204,7 @@ func (w *WorkloadExecutor) cancelOrderTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT order_id, user_id, total_amount FROM orders WHERE status = 0 ORDER BY RAND() LIMIT 1`).Scan(&orderID, &userID, &totalAmount) - if cerror.Is(err, sql.ErrNoRows) { + if errors.Is(err, sql.ErrNoRows) { // No active orders to cancel return tx.Commit() } @@ -489,7 +488,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id, user_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID, &postUserID) - if cerror.Is(err, sql.ErrNoRows) { + if errors.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { @@ -522,7 +521,7 @@ func (w *WorkloadExecutor) socialInteractTxn(ctx context.Context) error { err = tx.QueryRowContext(ctx, `SELECT post_id FROM posts WHERE status = 0 ORDER BY RAND() LIMIT 1`). Scan(&postID) - if cerror.Is(err, sql.ErrNoRows) { + if errors.Is(err, sql.ErrNoRows) { return tx.Commit() } if err != nil { diff --git a/tests/integration_tests/default_value/main.go b/tests/integration_tests/default_value/main.go index eefe7fca4d..0599002e9a 100644 --- a/tests/integration_tests/default_value/main.go +++ b/tests/integration_tests/default_value/main.go @@ -27,9 +27,8 @@ import ( "time" guuid "github.com/google/uuid" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/workerpool" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" @@ -55,7 +54,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case cerror.Is(errors.Cause(err), flag.ErrHelp): + case errors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/many_pk_or_uk/main.go b/tests/integration_tests/many_pk_or_uk/main.go index 55397ea2fb..cdc6f3a902 100644 --- a/tests/integration_tests/many_pk_or_uk/main.go +++ b/tests/integration_tests/many_pk_or_uk/main.go @@ -21,9 +21,8 @@ import ( "os" "sync" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" ) @@ -32,7 +31,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case cerror.Is(errors.Cause(err), flag.ErrHelp): + case errors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/multi_source/main.go b/tests/integration_tests/multi_source/main.go index 25dcc84ea0..52323f633f 100644 --- a/tests/integration_tests/multi_source/main.go +++ b/tests/integration_tests/multi_source/main.go @@ -27,9 +27,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" ) @@ -39,7 +38,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case cerror.Is(errors.Cause(err), flag.ErrHelp): + case errors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/resolve_lock/main.go b/tests/integration_tests/resolve_lock/main.go index 343d199b3f..1d8e6a63f3 100644 --- a/tests/integration_tests/resolve_lock/main.go +++ b/tests/integration_tests/resolve_lock/main.go @@ -28,10 +28,9 @@ import ( "strings" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/log" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" @@ -48,7 +47,7 @@ func main() { err := cfg.Parse(os.Args[1:]) switch { case errors.Cause(err) == nil: - case cerror.Is(errors.Cause(err), flag.ErrHelp): + case errors.Is(errors.Cause(err), flag.ErrHelp): os.Exit(0) default: log.S().Errorf("parse cmd flags err %s\n", err) diff --git a/tests/integration_tests/util/config.go b/tests/integration_tests/util/config.go index 70093414e4..a973030a38 100644 --- a/tests/integration_tests/util/config.go +++ b/tests/integration_tests/util/config.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/BurntSushi/toml" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // NewConfig creates a new config. diff --git a/tests/integration_tests/util/db.go b/tests/integration_tests/util/db.go index 53f1327f36..0a86043917 100644 --- a/tests/integration_tests/util/db.go +++ b/tests/integration_tests/util/db.go @@ -20,10 +20,9 @@ import ( "net/url" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/diff" - cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" ) @@ -153,7 +152,7 @@ func MustExec(db *sql.DB, sql string, args ...interface{}) { func MustExecWithConn(ctx context.Context, conn *sql.Conn, sql string, args ...interface{}) { var err error _, err = conn.ExecContext(ctx, sql, args...) - if err != nil && cerror.Is(errors.Cause(err), context.DeadlineExceeded) && cerror.Is(errors.Cause(err), context.Canceled) { + if err != nil && errors.Is(errors.Cause(err), context.DeadlineExceeded) && errors.Is(errors.Cause(err), context.Canceled) { log.S().Fatal(err) } } diff --git a/tests/utils/gen_kafka_big_messages/main.go b/tests/utils/gen_kafka_big_messages/main.go index f3675f4474..728fb03e95 100644 --- a/tests/utils/gen_kafka_big_messages/main.go +++ b/tests/utils/gen_kafka_big_messages/main.go @@ -20,7 +20,7 @@ import ( "os" "strings" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) // See: https://docs.pingcap.com/tidb/stable/tidb-limitations/#limitations-on-string-types diff --git a/tools/workload/app.go b/tools/workload/app.go index e70f48e024..fb293e8223 100644 --- a/tools/workload/app.go +++ b/tools/workload/app.go @@ -23,7 +23,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" "go.uber.org/zap" "workload/schema" diff --git a/tools/workload/ddl_app.go b/tools/workload/ddl_app.go index f4578b9fea..9a5b1e23f3 100644 --- a/tools/workload/ddl_app.go +++ b/tools/workload/ddl_app.go @@ -16,7 +16,7 @@ package main import ( "sync" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" "go.uber.org/zap" ) diff --git a/tools/workload/ddl_config.go b/tools/workload/ddl_config.go index cf9f0f9cc7..539cdffe6a 100644 --- a/tools/workload/ddl_config.go +++ b/tools/workload/ddl_config.go @@ -19,7 +19,7 @@ import ( "strings" "github.com/BurntSushi/toml" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" ) const ( diff --git a/tools/workload/ddl_executor.go b/tools/workload/ddl_executor.go index 6b4c7c768c..cfe615b0f4 100644 --- a/tools/workload/ddl_executor.go +++ b/tools/workload/ddl_executor.go @@ -23,7 +23,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" "go.uber.org/zap" ) diff --git a/tools/workload/ddl_runner.go b/tools/workload/ddl_runner.go index 5cdcf99d2b..72d854203c 100644 --- a/tools/workload/ddl_runner.go +++ b/tools/workload/ddl_runner.go @@ -21,7 +21,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/errors" + "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" "go.uber.org/zap" ) From 51a0075bd1c906cf058e9b57302810d13585b0ae Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Tue, 12 May 2026 12:03:24 +0800 Subject: [PATCH 5/5] make fmt --- api/v2/failpoint.go | 3 +-- api/v2/log.go | 2 +- api/v2/unsafe.go | 2 +- cmd/cdc/cli/cli_changefeed_create.go | 2 +- cmd/cdc/cli/cli_changefeed_list_test.go | 2 +- cmd/cdc/cli/cli_changefeed_pause_test.go | 2 +- cmd/cdc/cli/cli_changefeed_query.go | 2 +- cmd/cdc/cli/cli_changefeed_query_test.go | 2 +- cmd/cdc/cli/cli_changefeed_remove_test.go | 2 +- cmd/cdc/cli/cli_changefeed_resume_test.go | 2 +- cmd/cdc/cli/cli_changefeed_update_test.go | 2 +- cmd/cdc/cli/cli_unsafe.go | 2 +- cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go | 2 +- cmd/cdc/cli/cli_unsafe_reset.go | 2 +- cmd/cdc/cli/cli_unsafe_show_metadata.go | 2 +- cmd/cdc/server/server.go | 2 +- cmd/oauth2-server/main.go | 2 +- cmd/storage-consumer/consumer.go | 2 +- coordinator/changefeed/backoff.go | 2 +- coordinator/changefeed/etcd_backend.go | 2 +- coordinator/changefeed/etcd_backend_test.go | 2 +- downstreamadapter/dispatchermanager/heartbeat_collector.go | 2 +- downstreamadapter/sink/kafka/sink_test.go | 2 +- downstreamadapter/sink/pulsar/sink_test.go | 2 +- downstreamadapter/sink/topicmanager/kafka_topic_manager.go | 2 +- logservice/eventstore/event_store.go | 2 +- logservice/logpuller/errors.go | 2 +- logservice/logpuller/region_request_worker.go | 2 +- logservice/logpuller/region_request_worker_test.go | 2 +- logservice/logpuller/subscription_client.go | 2 +- logservice/logpuller/subscription_client_test.go | 2 +- logservice/schemastore/gc_keeper_test.go | 2 +- logservice/schemastore/persist_storage_ddl_handlers.go | 2 +- logservice/schemastore/utils.go | 2 +- logservice/schemastore/validator.go | 2 +- maintainer/maintainer_controller_test.go | 2 +- pkg/api/util.go | 2 +- pkg/binlog-filter/filter.go | 2 +- pkg/check/active_active_tso_indexes_test.go | 2 +- pkg/check/cluster_test.go | 2 +- pkg/common/event/checksum.go | 2 +- pkg/common/event/chunk.go | 2 +- pkg/common/event/codec.go | 2 +- pkg/common/span_op.go | 2 +- pkg/config/capture.go | 2 +- pkg/config/changefeed.go | 2 +- pkg/config/replica_config.go | 2 +- pkg/config/server.go | 2 +- pkg/config/sink.go | 2 +- pkg/diff/checkpoint.go | 2 +- pkg/diff/chunk.go | 2 +- pkg/diff/diff.go | 2 +- pkg/encryption/cipher.go | 1 - pkg/encryption/encryption_manager_test.go | 3 +-- pkg/encryption/tikv_http_client.go | 2 +- pkg/etcd/client.go | 2 +- pkg/etcd/etcd_test.go | 2 +- pkg/filter/expr_filter.go | 2 +- pkg/filter/sql_event_filter.go | 2 +- pkg/filter/sql_event_filter_test.go | 2 +- pkg/fsutil/disk_info_freebsd.go | 1 - pkg/logger/log.go | 2 +- pkg/messaging/message_center.go | 2 +- pkg/messaging/remote_target.go | 2 +- pkg/migrate/migrate.go | 2 +- pkg/migrate/migrate_test.go | 2 +- pkg/orchestrator/etcd_worker_test.go | 2 +- pkg/orchestrator/reactor_state.go | 2 +- pkg/pdutil/api_client.go | 2 +- pkg/pdutil/api_client_test.go | 2 +- pkg/pdutil/clock.go | 2 +- pkg/redo/reader/file.go | 2 +- pkg/sink/codec/common/compress.go | 2 +- pkg/sink/codec/common/helper.go | 2 +- pkg/sink/codec/common/log_info.go | 2 +- pkg/sink/codec/common/verify_checksum.go | 2 +- pkg/sink/codec/simple/marshaller_bench_test.go | 2 +- pkg/sink/kafka/claimcheck/claim_check.go | 2 +- pkg/sink/kafka/options.go | 2 +- pkg/sink/kafka/options_test.go | 2 +- pkg/sink/kafka/sarama_async_producer.go | 2 +- pkg/sink/kafka/sarama_config_test.go | 2 +- pkg/sink/mysql/config.go | 2 +- pkg/sink/mysql/ddl_index_rewrite.go | 2 +- pkg/sink/mysql/helper.go | 2 +- pkg/sink/mysql/mysql_writer.go | 2 +- pkg/sink/mysql/mysql_writer_dml_batch.go | 2 +- pkg/sink/mysql/mysql_writer_dml_exec.go | 2 +- pkg/sink/mysql/mysql_writer_dml_session.go | 2 +- pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go | 2 +- pkg/sink/mysql/mysql_writer_for_syncpoint.go | 2 +- pkg/sink/mysql/mysql_writer_test.go | 2 +- pkg/tcpserver/tcp_server.go | 2 +- pkg/txnutil/gc/gc_service_test.go | 2 +- pkg/workerpool/async_pool_test.go | 2 +- pkg/workerpool/pool_impl.go | 2 +- pkg/workerpool/pool_test.go | 2 +- server/watcher/etcd_watcher.go | 2 +- tests/integration_tests/api_v2/main.go | 2 +- tests/integration_tests/bank/case.go | 2 +- tests/integration_tests/cdc/cdc.go | 2 +- tests/integration_tests/cdc/dailytest/case.go | 2 +- tests/integration_tests/cdc/dailytest/db.go | 2 +- tests/integration_tests/cdc/dailytest/job.go | 2 +- tests/integration_tests/cdc/dailytest/parser.go | 2 +- tests/integration_tests/complex_transaction/workload.go | 2 +- tests/integration_tests/default_value/main.go | 2 +- tests/integration_tests/many_pk_or_uk/main.go | 2 +- tests/integration_tests/multi_source/main.go | 2 +- tests/integration_tests/resolve_lock/main.go | 2 +- tests/integration_tests/util/db.go | 2 +- tools/workload/app.go | 2 +- tools/workload/ddl_app.go | 2 +- tools/workload/ddl_executor.go | 2 +- tools/workload/ddl_runner.go | 2 +- 115 files changed, 113 insertions(+), 117 deletions(-) diff --git a/api/v2/failpoint.go b/api/v2/failpoint.go index e0b610946e..fd41e26136 100644 --- a/api/v2/failpoint.go +++ b/api/v2/failpoint.go @@ -19,11 +19,10 @@ import ( "strings" "sync" - "github.com/pingcap/ticdc/pkg/errors" - "github.com/gin-gonic/gin" "github.com/pingcap/failpoint" "github.com/pingcap/ticdc/pkg/api" + "github.com/pingcap/ticdc/pkg/errors" ) type FailpointRequest struct { diff --git a/api/v2/log.go b/api/v2/log.go index 0379db6a66..1088649b7f 100644 --- a/api/v2/log.go +++ b/api/v2/log.go @@ -18,9 +18,9 @@ import ( "strings" "github.com/gin-gonic/gin" - perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/logger" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" diff --git a/api/v2/unsafe.go b/api/v2/unsafe.go index 963fb1f062..9dfa25fb50 100644 --- a/api/v2/unsafe.go +++ b/api/v2/unsafe.go @@ -20,8 +20,8 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/log" "github.com/pingcap/ticdc/api/middleware" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/logservice/txnutil" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/txnutil/gc" "go.uber.org/zap" ) diff --git a/cmd/cdc/cli/cli_changefeed_create.go b/cmd/cdc/cli/cli_changefeed_create.go index b040c045da..3fd2908eff 100644 --- a/cmd/cdc/cli/cli_changefeed_create.go +++ b/cmd/cdc/cli/cli_changefeed_create.go @@ -20,13 +20,13 @@ import ( "strings" "github.com/fatih/color" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" putil "github.com/pingcap/ticdc/pkg/util" "github.com/spf13/cobra" diff --git a/cmd/cdc/cli/cli_changefeed_list_test.go b/cmd/cdc/cli/cli_changefeed_list_test.go index 218baa1948..35b9c8b13a 100644 --- a/cmd/cdc/cli/cli_changefeed_list_test.go +++ b/cmd/cdc/cli/cli_changefeed_list_test.go @@ -20,11 +20,11 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" "github.com/pingcap/ticdc/pkg/api/v2/mock" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_changefeed_pause_test.go b/cmd/cdc/cli/cli_changefeed_pause_test.go index c7c66a2078..1d90c8d6b7 100644 --- a/cmd/cdc/cli/cli_changefeed_pause_test.go +++ b/cmd/cdc/cli/cli_changefeed_pause_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/api/v2/mock" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_changefeed_query.go b/cmd/cdc/cli/cli_changefeed_query.go index f45a5347a9..c2999f591b 100644 --- a/cmd/cdc/cli/cli_changefeed_query.go +++ b/cmd/cdc/cli/cli_changefeed_query.go @@ -14,13 +14,13 @@ package cli import ( - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/pkg/api" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) diff --git a/cmd/cdc/cli/cli_changefeed_query_test.go b/cmd/cdc/cli/cli_changefeed_query_test.go index c8ed7a05ae..fdb34d5640 100644 --- a/cmd/cdc/cli/cli_changefeed_query_test.go +++ b/cmd/cdc/cli/cli_changefeed_query_test.go @@ -20,10 +20,10 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" "github.com/pingcap/ticdc/pkg/api/v2/mock" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_changefeed_remove_test.go b/cmd/cdc/cli/cli_changefeed_remove_test.go index 671a56073c..dcfc58e6a2 100644 --- a/cmd/cdc/cli/cli_changefeed_remove_test.go +++ b/cmd/cdc/cli/cli_changefeed_remove_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api/v2/mock" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_changefeed_resume_test.go b/cmd/cdc/cli/cli_changefeed_resume_test.go index e7e309af20..d2e1946579 100644 --- a/cmd/cdc/cli/cli_changefeed_resume_test.go +++ b/cmd/cdc/cli/cli_changefeed_resume_test.go @@ -20,9 +20,9 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/api" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "github.com/tikv/client-go/v2/oracle" ) diff --git a/cmd/cdc/cli/cli_changefeed_update_test.go b/cmd/cdc/cli/cli_changefeed_update_test.go index b7a81e36bb..c8b8e6034d 100644 --- a/cmd/cdc/cli/cli_changefeed_update_test.go +++ b/cmd/cdc/cli/cli_changefeed_update_test.go @@ -20,10 +20,10 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" putil "github.com/pingcap/ticdc/pkg/util" "github.com/stretchr/testify/require" ) diff --git a/cmd/cdc/cli/cli_unsafe.go b/cmd/cdc/cli/cli_unsafe.go index b7e31f41b3..e6a267d810 100644 --- a/cmd/cdc/cli/cli_unsafe.go +++ b/cmd/cdc/cli/cli_unsafe.go @@ -14,8 +14,8 @@ package cli import ( - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/cmd/cdc/factory" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) diff --git a/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go b/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go index 570311a036..df1b0ec1b1 100644 --- a/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go +++ b/cmd/cdc/cli/cli_unsafe_delete_service_gc_safepoint.go @@ -16,11 +16,11 @@ package cli import ( "strings" - "github.com/pingcap/ticdc/pkg/errors" v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) diff --git a/cmd/cdc/cli/cli_unsafe_reset.go b/cmd/cdc/cli/cli_unsafe_reset.go index cdf242f466..e72688ec00 100644 --- a/cmd/cdc/cli/cli_unsafe_reset.go +++ b/cmd/cdc/cli/cli_unsafe_reset.go @@ -16,11 +16,11 @@ package cli import ( "context" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/txnutil/gc" "github.com/spf13/cobra" diff --git a/cmd/cdc/cli/cli_unsafe_show_metadata.go b/cmd/cdc/cli/cli_unsafe_show_metadata.go index 7234aa7655..86eba315b7 100644 --- a/cmd/cdc/cli/cli_unsafe_show_metadata.go +++ b/cmd/cdc/cli/cli_unsafe_show_metadata.go @@ -14,10 +14,10 @@ package cli import ( - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/cmd/cdc/factory" "github.com/pingcap/ticdc/cmd/util" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" + "github.com/pingcap/ticdc/pkg/errors" "github.com/spf13/cobra" ) diff --git a/cmd/cdc/server/server.go b/cmd/cdc/server/server.go index 4fe4f69655..7561599cd2 100644 --- a/cmd/cdc/server/server.go +++ b/cmd/cdc/server/server.go @@ -22,12 +22,12 @@ import ( "time" "github.com/fatih/color" - perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/config/kerneltype" "github.com/pingcap/ticdc/pkg/errors" + perrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/logger" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/security" diff --git a/cmd/oauth2-server/main.go b/cmd/oauth2-server/main.go index 3ea7730f75..33ff83ac5e 100644 --- a/cmd/oauth2-server/main.go +++ b/cmd/oauth2-server/main.go @@ -153,7 +153,7 @@ func run(_ *cobra.Command, _ []string) { }))) http.Handle("/.well-known/openid-configuration", logMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port) + fmt.Fprintf(w, openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port) }))) log.Info("starting auth2 server", zap.Int("port", serverConfig.port)) log.Panic("run auth2 server failed", zap.Error(http.ListenAndServe(fmt.Sprintf(":%d", serverConfig.port), nil))) diff --git a/cmd/storage-consumer/consumer.go b/cmd/storage-consumer/consumer.go index 172bf17f87..15494e31b2 100644 --- a/cmd/storage-consumer/consumer.go +++ b/cmd/storage-consumer/consumer.go @@ -21,7 +21,6 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/cmd/util" "github.com/pingcap/ticdc/downstreamadapter/sink" @@ -29,6 +28,7 @@ import ( commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/cloudstorage" "github.com/pingcap/ticdc/pkg/sink/codec/canal" "github.com/pingcap/ticdc/pkg/sink/codec/common" diff --git a/coordinator/changefeed/backoff.go b/coordinator/changefeed/backoff.go index 224d0dfee8..1594309700 100644 --- a/coordinator/changefeed/backoff.go +++ b/coordinator/changefeed/backoff.go @@ -17,11 +17,11 @@ import ( "time" "github.com/cenkalti/backoff/v4" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/atomic" "go.uber.org/zap" ) diff --git a/coordinator/changefeed/etcd_backend.go b/coordinator/changefeed/etcd_backend.go index e9a922e190..ab7c98fafd 100644 --- a/coordinator/changefeed/etcd_backend.go +++ b/coordinator/changefeed/etcd_backend.go @@ -19,10 +19,10 @@ import ( "fmt" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" diff --git a/coordinator/changefeed/etcd_backend_test.go b/coordinator/changefeed/etcd_backend_test.go index 530a704988..5ef1968730 100644 --- a/coordinator/changefeed/etcd_backend_test.go +++ b/coordinator/changefeed/etcd_backend_test.go @@ -19,9 +19,9 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/stretchr/testify/require" "go.etcd.io/etcd/api/v3/mvccpb" diff --git a/downstreamadapter/dispatchermanager/heartbeat_collector.go b/downstreamadapter/dispatchermanager/heartbeat_collector.go index 9727118da4..37e52b726a 100644 --- a/downstreamadapter/dispatchermanager/heartbeat_collector.go +++ b/downstreamadapter/dispatchermanager/heartbeat_collector.go @@ -18,12 +18,12 @@ import ( "sync" "sync/atomic" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/downstreamadapter/dispatcher" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/node" diff --git a/downstreamadapter/sink/kafka/sink_test.go b/downstreamadapter/sink/kafka/sink_test.go index 0b3f56103c..65957263a5 100644 --- a/downstreamadapter/sink/kafka/sink_test.go +++ b/downstreamadapter/sink/kafka/sink_test.go @@ -22,11 +22,11 @@ import ( "time" "github.com/IBM/sarama/mocks" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/downstreamadapter/sink/helper" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/sink/kafka" "github.com/pingcap/ticdc/utils/chann" diff --git a/downstreamadapter/sink/pulsar/sink_test.go b/downstreamadapter/sink/pulsar/sink_test.go index cfa8d39b06..6a560884a5 100644 --- a/downstreamadapter/sink/pulsar/sink_test.go +++ b/downstreamadapter/sink/pulsar/sink_test.go @@ -22,9 +22,9 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/pingcap/ticdc/downstreamadapter/sink/helper" "github.com/pingcap/ticdc/pkg/common" - "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/utils/chann" "github.com/stretchr/testify/require" diff --git a/downstreamadapter/sink/topicmanager/kafka_topic_manager.go b/downstreamadapter/sink/topicmanager/kafka_topic_manager.go index 42127903cd..a61169e7da 100644 --- a/downstreamadapter/sink/topicmanager/kafka_topic_manager.go +++ b/downstreamadapter/sink/topicmanager/kafka_topic_manager.go @@ -19,9 +19,9 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/sink/kafka" "go.uber.org/zap" diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index ced52fb225..b97770df8d 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -27,7 +27,6 @@ import ( "github.com/cockroachdb/pebble" "github.com/klauspost/compress/zstd" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/logservice/logpuller" @@ -35,6 +34,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/node" diff --git a/logservice/logpuller/errors.go b/logservice/logpuller/errors.go index fdd2b30225..8d07b2d60f 100644 --- a/logservice/logpuller/errors.go +++ b/logservice/logpuller/errors.go @@ -16,8 +16,8 @@ package logpuller import ( "fmt" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" + "github.com/pingcap/ticdc/pkg/errors" "github.com/tikv/client-go/v2/tikv" ) diff --git a/logservice/logpuller/region_request_worker.go b/logservice/logpuller/region_request_worker.go index 82c6a99e58..19baf4fa10 100644 --- a/logservice/logpuller/region_request_worker.go +++ b/logservice/logpuller/region_request_worker.go @@ -19,11 +19,11 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/pkg/version" diff --git a/logservice/logpuller/region_request_worker_test.go b/logservice/logpuller/region_request_worker_test.go index f36cfb3a86..701af5ddc6 100644 --- a/logservice/logpuller/region_request_worker_test.go +++ b/logservice/logpuller/region_request_worker_test.go @@ -18,10 +18,10 @@ import ( "io" "testing" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/ticdc/logservice/logpuller/regionlock" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/utils/dynstream" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" diff --git a/logservice/logpuller/subscription_client.go b/logservice/logpuller/subscription_client.go index c9ca36814d..7cfb5b7561 100644 --- a/logservice/logpuller/subscription_client.go +++ b/logservice/logpuller/subscription_client.go @@ -19,7 +19,6 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" @@ -28,6 +27,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" diff --git a/logservice/logpuller/subscription_client_test.go b/logservice/logpuller/subscription_client_test.go index bdd64d6e03..0c26d8d62a 100644 --- a/logservice/logpuller/subscription_client_test.go +++ b/logservice/logpuller/subscription_client_test.go @@ -20,12 +20,12 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/cdcpb" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/logservice/logpuller/regionlock" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" diff --git a/logservice/schemastore/gc_keeper_test.go b/logservice/schemastore/gc_keeper_test.go index a968788881..f8ec7286c6 100644 --- a/logservice/schemastore/gc_keeper_test.go +++ b/logservice/schemastore/gc_keeper_test.go @@ -20,10 +20,10 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/txnutil/gc" "github.com/stretchr/testify/require" pdgc "github.com/tikv/pd/client/clients/gc" diff --git a/logservice/schemastore/persist_storage_ddl_handlers.go b/logservice/schemastore/persist_storage_ddl_handlers.go index 77f78e331f..0b2bb77202 100644 --- a/logservice/schemastore/persist_storage_ddl_handlers.go +++ b/logservice/schemastore/persist_storage_ddl_handlers.go @@ -19,8 +19,8 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser" diff --git a/logservice/schemastore/utils.go b/logservice/schemastore/utils.go index ffb102c516..5cb6d9270e 100644 --- a/logservice/schemastore/utils.go +++ b/logservice/schemastore/utils.go @@ -16,9 +16,9 @@ package schemastore import ( "strings" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser" "go.uber.org/zap" diff --git a/logservice/schemastore/validator.go b/logservice/schemastore/validator.go index 3e3a0119b7..fc5f5653b1 100644 --- a/logservice/schemastore/validator.go +++ b/logservice/schemastore/validator.go @@ -18,9 +18,9 @@ import ( "strings" "sync" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" tidbkv "github.com/pingcap/tidb/pkg/kv" timodel "github.com/pingcap/tidb/pkg/meta/model" diff --git a/maintainer/maintainer_controller_test.go b/maintainer/maintainer_controller_test.go index 2f4cfcecd6..dbd18f7de8 100644 --- a/maintainer/maintainer_controller_test.go +++ b/maintainer/maintainer_controller_test.go @@ -23,13 +23,13 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/maintainer/operator" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/maintainer/testutil" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/eventservice" "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/pdutil" diff --git a/pkg/api/util.go b/pkg/api/util.go index c4a5d16ebf..5155a1cce7 100644 --- a/pkg/api/util.go +++ b/pkg/api/util.go @@ -19,8 +19,8 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" ) diff --git a/pkg/binlog-filter/filter.go b/pkg/binlog-filter/filter.go index 6478dc056f..8828668376 100644 --- a/pkg/binlog-filter/filter.go +++ b/pkg/binlog-filter/filter.go @@ -17,8 +17,8 @@ import ( "regexp" "strings" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" selector "github.com/pingcap/tidb/pkg/util/table-rule-selector" "go.uber.org/zap" ) diff --git a/pkg/check/active_active_tso_indexes_test.go b/pkg/check/active_active_tso_indexes_test.go index 43d4f310ee..ea01ad113b 100644 --- a/pkg/check/active_active_tso_indexes_test.go +++ b/pkg/check/active_active_tso_indexes_test.go @@ -22,8 +22,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/pingcap/ticdc/pkg/common" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" mysqlsink "github.com/pingcap/ticdc/pkg/sink/mysql" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" diff --git a/pkg/check/cluster_test.go b/pkg/check/cluster_test.go index c08bd2f15c..de69759bb2 100644 --- a/pkg/check/cluster_test.go +++ b/pkg/check/cluster_test.go @@ -22,8 +22,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/pingcap/ticdc/pkg/common" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" mysqlsink "github.com/pingcap/ticdc/pkg/sink/mysql" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" diff --git a/pkg/common/event/checksum.go b/pkg/common/event/checksum.go index 3e93c8df35..c304fca836 100644 --- a/pkg/common/event/checksum.go +++ b/pkg/common/event/checksum.go @@ -16,9 +16,9 @@ package event import ( "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/types" diff --git a/pkg/common/event/chunk.go b/pkg/common/event/chunk.go index 6ff52bd4b5..6d0b06bac7 100644 --- a/pkg/common/event/chunk.go +++ b/pkg/common/event/chunk.go @@ -19,9 +19,9 @@ import ( "time" "unsafe" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" diff --git a/pkg/common/event/codec.go b/pkg/common/event/codec.go index b6ed9438e5..a5d6e3d507 100644 --- a/pkg/common/event/codec.go +++ b/pkg/common/event/codec.go @@ -17,8 +17,8 @@ import ( "bytes" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/tablecodec" diff --git a/pkg/common/span_op.go b/pkg/common/span_op.go index f63d36b1ca..ad456159a4 100644 --- a/pkg/common/span_op.go +++ b/pkg/common/span_op.go @@ -16,11 +16,11 @@ package common import ( "bytes" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/metadef" "github.com/pingcap/tidb/pkg/tablecodec" diff --git a/pkg/config/capture.go b/pkg/config/capture.go index 16242f42cd..a25796290c 100644 --- a/pkg/config/capture.go +++ b/pkg/config/capture.go @@ -15,8 +15,8 @@ package config import ( "encoding/json" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" ) type CaptureID = string diff --git a/pkg/config/changefeed.go b/pkg/config/changefeed.go index f49273faa6..fbdd356622 100644 --- a/pkg/config/changefeed.go +++ b/pkg/config/changefeed.go @@ -20,9 +20,9 @@ import ( "net/url" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/pkg/version" "github.com/tikv/client-go/v2/oracle" diff --git a/pkg/config/replica_config.go b/pkg/config/replica_config.go index ee41fec2ba..2f868bd4f4 100644 --- a/pkg/config/replica_config.go +++ b/pkg/config/replica_config.go @@ -21,9 +21,9 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config/outdated" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/integrity" "github.com/pingcap/ticdc/pkg/redo" "github.com/pingcap/ticdc/pkg/util" diff --git a/pkg/config/server.go b/pkg/config/server.go index e08407ca12..b09fbc6721 100644 --- a/pkg/config/server.go +++ b/pkg/config/server.go @@ -22,8 +22,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "go.uber.org/zap" ) diff --git a/pkg/config/sink.go b/pkg/config/sink.go index 96ebd0b20b..bb0c160b99 100644 --- a/pkg/config/sink.go +++ b/pkg/config/sink.go @@ -23,8 +23,8 @@ import ( "github.com/apache/pulsar-client-go/pulsar" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "go.uber.org/zap" ) diff --git a/pkg/diff/checkpoint.go b/pkg/diff/checkpoint.go index 9babe45505..5c4d27e330 100644 --- a/pkg/diff/checkpoint.go +++ b/pkg/diff/checkpoint.go @@ -22,8 +22,8 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" ) diff --git a/pkg/diff/chunk.go b/pkg/diff/chunk.go index 4dfd26e832..bddc8f5a64 100644 --- a/pkg/diff/chunk.go +++ b/pkg/diff/chunk.go @@ -21,8 +21,8 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 89c599cee0..83afd2822b 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -27,9 +27,9 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/util/dbutil" diff --git a/pkg/encryption/cipher.go b/pkg/encryption/cipher.go index 85c85db59e..11b99ac236 100644 --- a/pkg/encryption/cipher.go +++ b/pkg/encryption/cipher.go @@ -19,7 +19,6 @@ import ( "crypto/rand" "github.com/pingcap/ticdc/pkg/errors" - ) // Cipher is the interface for encryption/decryption operations diff --git a/pkg/encryption/encryption_manager_test.go b/pkg/encryption/encryption_manager_test.go index acba22e8e4..81d523442c 100644 --- a/pkg/encryption/encryption_manager_test.go +++ b/pkg/encryption/encryption_manager_test.go @@ -18,9 +18,8 @@ import ( "context" "testing" - "github.com/pingcap/ticdc/pkg/errors" - "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" ) diff --git a/pkg/encryption/tikv_http_client.go b/pkg/encryption/tikv_http_client.go index e041f27fa3..470cc81893 100644 --- a/pkg/encryption/tikv_http_client.go +++ b/pkg/encryption/tikv_http_client.go @@ -22,8 +22,8 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/tidb/pkg/util/engine" diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index df28053582..2528feece6 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -21,8 +21,8 @@ import ( "time" "github.com/benbjohnson/clock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/util" diff --git a/pkg/etcd/etcd_test.go b/pkg/etcd/etcd_test.go index 78ca6c3b5e..cee77b168b 100644 --- a/pkg/etcd/etcd_test.go +++ b/pkg/etcd/etcd_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" diff --git a/pkg/filter/expr_filter.go b/pkg/filter/expr_filter.go index 331233cabe..96619d2f44 100644 --- a/pkg/filter/expr_filter.go +++ b/pkg/filter/expr_filter.go @@ -17,10 +17,10 @@ import ( "strings" "sync" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/meta/model" diff --git a/pkg/filter/sql_event_filter.go b/pkg/filter/sql_event_filter.go index 43603d3a24..7bc53ab232 100644 --- a/pkg/filter/sql_event_filter.go +++ b/pkg/filter/sql_event_filter.go @@ -16,11 +16,11 @@ package filter import ( "fmt" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" bf "github.com/pingcap/ticdc/pkg/binlog-filter" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" tfilter "github.com/pingcap/tidb/pkg/util/table-filter" "go.uber.org/zap" diff --git a/pkg/filter/sql_event_filter_test.go b/pkg/filter/sql_event_filter_test.go index c270cbb4a3..aa6399a2b8 100644 --- a/pkg/filter/sql_event_filter_test.go +++ b/pkg/filter/sql_event_filter_test.go @@ -17,10 +17,10 @@ import ( "fmt" "testing" - "github.com/pingcap/ticdc/pkg/errors" bf "github.com/pingcap/ticdc/pkg/binlog-filter" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" timodel "github.com/pingcap/tidb/pkg/meta/model" "github.com/stretchr/testify/require" diff --git a/pkg/fsutil/disk_info_freebsd.go b/pkg/fsutil/disk_info_freebsd.go index c6534267ce..6d6b89b405 100644 --- a/pkg/fsutil/disk_info_freebsd.go +++ b/pkg/fsutil/disk_info_freebsd.go @@ -19,7 +19,6 @@ import ( "os" "path/filepath" "syscall" - ) // GetDiskInfo return the disk space information of the given directory diff --git a/pkg/logger/log.go b/pkg/logger/log.go index e44004db7f..786ecb982c 100644 --- a/pkg/logger/log.go +++ b/pkg/logger/log.go @@ -24,8 +24,8 @@ import ( "github.com/IBM/sarama" "github.com/gin-gonic/gin" "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc/grpclog" diff --git a/pkg/messaging/message_center.go b/pkg/messaging/message_center.go index 927eca9fdc..0a11c31dab 100644 --- a/pkg/messaging/message_center.go +++ b/pkg/messaging/message_center.go @@ -20,9 +20,9 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging/proto" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/ticdc/pkg/node" diff --git a/pkg/messaging/remote_target.go b/pkg/messaging/remote_target.go index 88633a390d..7f24878bde 100644 --- a/pkg/messaging/remote_target.go +++ b/pkg/messaging/remote_target.go @@ -19,10 +19,10 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" . "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging/proto" "github.com/pingcap/ticdc/pkg/metrics" diff --git a/pkg/migrate/migrate.go b/pkg/migrate/migrate.go index 41e2b887e8..bd738c426a 100644 --- a/pkg/migrate/migrate.go +++ b/pkg/migrate/migrate.go @@ -22,10 +22,10 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" diff --git a/pkg/migrate/migrate_test.go b/pkg/migrate/migrate_test.go index bb350c67cd..7528350fc5 100644 --- a/pkg/migrate/migrate_test.go +++ b/pkg/migrate/migrate_test.go @@ -26,9 +26,9 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/security" diff --git a/pkg/orchestrator/etcd_worker_test.go b/pkg/orchestrator/etcd_worker_test.go index 10d44feaa8..2be190a4c7 100644 --- a/pkg/orchestrator/etcd_worker_test.go +++ b/pkg/orchestrator/etcd_worker_test.go @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/migrate" "github.com/pingcap/ticdc/pkg/orchestrator/util" diff --git a/pkg/orchestrator/reactor_state.go b/pkg/orchestrator/reactor_state.go index c9ff95c72e..460be14657 100644 --- a/pkg/orchestrator/reactor_state.go +++ b/pkg/orchestrator/reactor_state.go @@ -18,10 +18,10 @@ import ( "time" "github.com/goccy/go-json" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/orchestrator/util" "go.uber.org/zap" diff --git a/pkg/pdutil/api_client.go b/pkg/pdutil/api_client.go index e27899747b..a34e486856 100644 --- a/pkg/pdutil/api_client.go +++ b/pkg/pdutil/api_client.go @@ -27,12 +27,12 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/security" diff --git a/pkg/pdutil/api_client_test.go b/pkg/pdutil/api_client_test.go index 3baa68a7a0..8279af87b7 100644 --- a/pkg/pdutil/api_client_test.go +++ b/pkg/pdutil/api_client_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/pingcap/ticdc/heartbeatpb" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "github.com/pingcap/tidb/pkg/tablecodec" "github.com/pingcap/tidb/pkg/util/codec" diff --git a/pkg/pdutil/clock.go b/pkg/pdutil/clock.go index 45c89ba158..def50152a9 100644 --- a/pkg/pdutil/clock.go +++ b/pkg/pdutil/clock.go @@ -18,9 +18,9 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" pclock "github.com/pingcap/ticdc/pkg/clock" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/tikv/client-go/v2/oracle" pd "github.com/tikv/pd/client" diff --git a/pkg/redo/reader/file.go b/pkg/redo/reader/file.go index 0bc8967091..f76b17d931 100644 --- a/pkg/redo/reader/file.go +++ b/pkg/redo/reader/file.go @@ -29,10 +29,10 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" pevent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/compression" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/redo" "github.com/pingcap/ticdc/pkg/redo/codec" "github.com/pingcap/ticdc/pkg/redo/writer" diff --git a/pkg/sink/codec/common/compress.go b/pkg/sink/codec/common/compress.go index 0e19008bf8..3ed105275d 100644 --- a/pkg/sink/codec/common/compress.go +++ b/pkg/sink/codec/common/compress.go @@ -14,9 +14,9 @@ package common import ( - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/compression" + "github.com/pingcap/ticdc/pkg/errors" ) // Compress the given data by the given compression, also record the compression ratio metric. diff --git a/pkg/sink/codec/common/helper.go b/pkg/sink/codec/common/helper.go index a4e5569ec1..95ddeeb0f4 100644 --- a/pkg/sink/codec/common/helper.go +++ b/pkg/sink/codec/common/helper.go @@ -23,9 +23,9 @@ import ( "unsafe" mysqlDriver "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" diff --git a/pkg/sink/codec/common/log_info.go b/pkg/sink/codec/common/log_info.go index 181d615792..ca199acddb 100644 --- a/pkg/sink/codec/common/log_info.go +++ b/pkg/sink/codec/common/log_info.go @@ -16,9 +16,9 @@ package common import ( "errors" - perrors "github.com/pingcap/ticdc/pkg/errors" commonPkg "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + perrors "github.com/pingcap/ticdc/pkg/errors" ) // AttachMessageLogInfo binds row event diagnostic info onto sink messages. diff --git a/pkg/sink/codec/common/verify_checksum.go b/pkg/sink/codec/common/verify_checksum.go index 1e4c41e917..5be78c0037 100644 --- a/pkg/sink/codec/common/verify_checksum.go +++ b/pkg/sink/codec/common/verify_checksum.go @@ -21,9 +21,9 @@ import ( "hash/crc32" "math" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/meta/model" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/util/chunk" diff --git a/pkg/sink/codec/simple/marshaller_bench_test.go b/pkg/sink/codec/simple/marshaller_bench_test.go index c112a1df41..bcffb721c3 100644 --- a/pkg/sink/codec/simple/marshaller_bench_test.go +++ b/pkg/sink/codec/simple/marshaller_bench_test.go @@ -16,9 +16,9 @@ package simple import ( "testing" - "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" ) diff --git a/pkg/sink/kafka/claimcheck/claim_check.go b/pkg/sink/kafka/claimcheck/claim_check.go index eb6edff101..c031facf20 100644 --- a/pkg/sink/kafka/claimcheck/claim_check.go +++ b/pkg/sink/kafka/claimcheck/claim_check.go @@ -20,10 +20,10 @@ import ( "time" "github.com/google/uuid" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/br/pkg/storage" diff --git a/pkg/sink/kafka/options.go b/pkg/sink/kafka/options.go index 6d16de95da..28c23d99ac 100644 --- a/pkg/sink/kafka/options.go +++ b/pkg/sink/kafka/options.go @@ -26,10 +26,10 @@ import ( "github.com/gin-gonic/gin/binding" "github.com/imdario/mergo" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "go.uber.org/zap" ) diff --git a/pkg/sink/kafka/options_test.go b/pkg/sink/kafka/options_test.go index e7b8903245..0d7f112641 100644 --- a/pkg/sink/kafka/options_test.go +++ b/pkg/sink/kafka/options_test.go @@ -24,9 +24,9 @@ import ( "github.com/IBM/sarama" "github.com/aws/aws-sdk-go/aws" - "github.com/pingcap/ticdc/pkg/errors" commonType "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "github.com/stretchr/testify/require" ) diff --git a/pkg/sink/kafka/sarama_async_producer.go b/pkg/sink/kafka/sarama_async_producer.go index b356d7c365..1ca5e38ce8 100644 --- a/pkg/sink/kafka/sarama_async_producer.go +++ b/pkg/sink/kafka/sarama_async_producer.go @@ -18,10 +18,10 @@ import ( "time" "github.com/IBM/sarama" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" commonType "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/codec/common" "go.uber.org/atomic" "go.uber.org/zap" diff --git a/pkg/sink/kafka/sarama_config_test.go b/pkg/sink/kafka/sarama_config_test.go index f93080cd10..d35e95ae81 100644 --- a/pkg/sink/kafka/sarama_config_test.go +++ b/pkg/sink/kafka/sarama_config_test.go @@ -21,8 +21,8 @@ import ( "github.com/IBM/sarama" "github.com/gin-gonic/gin/binding" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/stretchr/testify/require" ) diff --git a/pkg/sink/mysql/config.go b/pkg/sink/mysql/config.go index 74ffa2e524..e10cffd860 100644 --- a/pkg/sink/mysql/config.go +++ b/pkg/sink/mysql/config.go @@ -25,11 +25,11 @@ import ( dmysql "github.com/go-sql-driver/mysql" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/pingcap/ticdc/pkg/sink/sqlmodel" "github.com/pingcap/ticdc/pkg/util" diff --git a/pkg/sink/mysql/ddl_index_rewrite.go b/pkg/sink/mysql/ddl_index_rewrite.go index 4824ac58ee..70288c5321 100644 --- a/pkg/sink/mysql/ddl_index_rewrite.go +++ b/pkg/sink/mysql/ddl_index_rewrite.go @@ -14,9 +14,9 @@ package mysql import ( - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/parser" "github.com/pingcap/tidb/pkg/parser/ast" ) diff --git a/pkg/sink/mysql/helper.go b/pkg/sink/mysql/helper.go index 5fde110d5d..3e5de75aeb 100644 --- a/pkg/sink/mysql/helper.go +++ b/pkg/sink/mysql/helper.go @@ -25,10 +25,10 @@ import ( "github.com/coreos/go-semver/semver" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/tidb/br/pkg/version" "github.com/pingcap/tidb/dumpling/export" diff --git a/pkg/sink/mysql/mysql_writer.go b/pkg/sink/mysql/mysql_writer.go index 7c91f338e7..4c38fadaab 100644 --- a/pkg/sink/mysql/mysql_writer.go +++ b/pkg/sink/mysql/mysql_writer.go @@ -21,10 +21,10 @@ import ( "time" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "go.uber.org/zap" ) diff --git a/pkg/sink/mysql/mysql_writer_dml_batch.go b/pkg/sink/mysql/mysql_writer_dml_batch.go index 7ddaa41885..98eb58b58d 100644 --- a/pkg/sink/mysql/mysql_writer_dml_batch.go +++ b/pkg/sink/mysql/mysql_writer_dml_batch.go @@ -16,8 +16,8 @@ package mysql import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" - "github.com/pingcap/ticdc/pkg/errors" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/sink/sqlmodel" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/util/chunk" diff --git a/pkg/sink/mysql/mysql_writer_dml_exec.go b/pkg/sink/mysql/mysql_writer_dml_exec.go index 6b920975a1..f37d29c187 100644 --- a/pkg/sink/mysql/mysql_writer_dml_exec.go +++ b/pkg/sink/mysql/mysql_writer_dml_exec.go @@ -22,9 +22,9 @@ import ( "time" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/pkg/parser/mysql" diff --git a/pkg/sink/mysql/mysql_writer_dml_session.go b/pkg/sink/mysql/mysql_writer_dml_session.go index f7e2a61780..876abcea76 100644 --- a/pkg/sink/mysql/mysql_writer_dml_session.go +++ b/pkg/sink/mysql/mysql_writer_dml_session.go @@ -19,8 +19,8 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) diff --git a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go index eddf58d9c0..7cc6a37c16 100644 --- a/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go +++ b/pkg/sink/mysql/mysql_writer_for_active_active_sync_stats.go @@ -20,9 +20,9 @@ import ( "sync" dmysql "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" tidbmysql "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/sink/mysql/mysql_writer_for_syncpoint.go b/pkg/sink/mysql/mysql_writer_for_syncpoint.go index 0f772739b9..efb202210f 100644 --- a/pkg/sink/mysql/mysql_writer_for_syncpoint.go +++ b/pkg/sink/mysql/mysql_writer_for_syncpoint.go @@ -19,10 +19,10 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/filter" "go.uber.org/zap" ) diff --git a/pkg/sink/mysql/mysql_writer_test.go b/pkg/sink/mysql/mysql_writer_test.go index 38709ed6a4..5834be9325 100644 --- a/pkg/sink/mysql/mysql_writer_test.go +++ b/pkg/sink/mysql/mysql_writer_test.go @@ -23,12 +23,12 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/go-sql-driver/mysql" lru "github.com/hashicorp/golang-lru" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/metrics" "github.com/pingcap/tidb/br/pkg/version" ticonfig "github.com/pingcap/tidb/pkg/config" diff --git a/pkg/tcpserver/tcp_server.go b/pkg/tcpserver/tcp_server.go index 0112ef771f..fa4640a5e1 100644 --- a/pkg/tcpserver/tcp_server.go +++ b/pkg/tcpserver/tcp_server.go @@ -20,8 +20,8 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/security" "github.com/soheilhy/cmux" "go.uber.org/atomic" diff --git a/pkg/txnutil/gc/gc_service_test.go b/pkg/txnutil/gc/gc_service_test.go index 0b43320699..0d6050dd74 100644 --- a/pkg/txnutil/gc/gc_service_test.go +++ b/pkg/txnutil/gc/gc_service_test.go @@ -19,9 +19,9 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config/kerneltype" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" pd "github.com/tikv/pd/client" pdgc "github.com/tikv/pd/client/clients/gc" diff --git a/pkg/workerpool/async_pool_test.go b/pkg/workerpool/async_pool_test.go index cf5900d88f..fff9bd0d54 100644 --- a/pkg/workerpool/async_pool_test.go +++ b/pkg/workerpool/async_pool_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) diff --git a/pkg/workerpool/pool_impl.go b/pkg/workerpool/pool_impl.go index 2514992c79..2b4ae20455 100644 --- a/pkg/workerpool/pool_impl.go +++ b/pkg/workerpool/pool_impl.go @@ -19,9 +19,9 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/notify" "go.uber.org/zap" "golang.org/x/sync/errgroup" diff --git a/pkg/workerpool/pool_test.go b/pkg/workerpool/pool_test.go index 6ef110ed07..fa20554d0a 100644 --- a/pkg/workerpool/pool_test.go +++ b/pkg/workerpool/pool_test.go @@ -20,9 +20,9 @@ import ( "testing" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/stretchr/testify/require" "go.uber.org/zap" "golang.org/x/sync/errgroup" diff --git a/server/watcher/etcd_watcher.go b/server/watcher/etcd_watcher.go index ac8766656a..2d5050acd7 100644 --- a/server/watcher/etcd_watcher.go +++ b/server/watcher/etcd_watcher.go @@ -17,8 +17,8 @@ import ( "context" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/etcd" "github.com/pingcap/ticdc/pkg/migrate" "github.com/pingcap/ticdc/pkg/orchestrator" diff --git a/tests/integration_tests/api_v2/main.go b/tests/integration_tests/api_v2/main.go index 27d17c2818..12ad4b1985 100644 --- a/tests/integration_tests/api_v2/main.go +++ b/tests/integration_tests/api_v2/main.go @@ -21,8 +21,8 @@ import ( "os/signal" "syscall" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/httputil" "go.uber.org/zap" ) diff --git a/tests/integration_tests/bank/case.go b/tests/integration_tests/bank/case.go index ede17896eb..81ca200755 100644 --- a/tests/integration_tests/bank/case.go +++ b/tests/integration_tests/bank/case.go @@ -29,8 +29,8 @@ import ( "time" _ "github.com/go-sql-driver/mysql" // MySQL driver - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/retry" "github.com/tikv/client-go/v2/oracle" "go.uber.org/zap" diff --git a/tests/integration_tests/cdc/cdc.go b/tests/integration_tests/cdc/cdc.go index c1ee366448..e06fee78b0 100644 --- a/tests/integration_tests/cdc/cdc.go +++ b/tests/integration_tests/cdc/cdc.go @@ -18,8 +18,8 @@ import ( "os" _ "github.com/go-sql-driver/mysql" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/cdc/dailytest" "github.com/pingcap/ticdc/tests/integration_tests/util" ) diff --git a/tests/integration_tests/cdc/dailytest/case.go b/tests/integration_tests/cdc/dailytest/case.go index c26dff3b42..ae7c67bb97 100644 --- a/tests/integration_tests/cdc/dailytest/case.go +++ b/tests/integration_tests/cdc/dailytest/case.go @@ -21,8 +21,8 @@ import ( "sync" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" ) var casePKAddDuplicateUK = []string{ diff --git a/tests/integration_tests/cdc/dailytest/db.go b/tests/integration_tests/cdc/dailytest/db.go index 7107b9b8e4..6238445c63 100644 --- a/tests/integration_tests/cdc/dailytest/db.go +++ b/tests/integration_tests/cdc/dailytest/db.go @@ -21,8 +21,8 @@ import ( "strconv" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "github.com/pingcap/tidb/pkg/parser/mysql" "go.uber.org/zap/zapcore" diff --git a/tests/integration_tests/cdc/dailytest/job.go b/tests/integration_tests/cdc/dailytest/job.go index acb853e0f8..425392e9ff 100644 --- a/tests/integration_tests/cdc/dailytest/job.go +++ b/tests/integration_tests/cdc/dailytest/job.go @@ -17,8 +17,8 @@ import ( "database/sql" "fmt" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/types" ) diff --git a/tests/integration_tests/cdc/dailytest/parser.go b/tests/integration_tests/cdc/dailytest/parser.go index 2b1637d7a3..1f3e38902b 100644 --- a/tests/integration_tests/cdc/dailytest/parser.go +++ b/tests/integration_tests/cdc/dailytest/parser.go @@ -18,8 +18,8 @@ import ( "strconv" "strings" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/parser" "github.com/pingcap/tidb/pkg/parser/ast" "github.com/pingcap/tidb/pkg/types" diff --git a/tests/integration_tests/complex_transaction/workload.go b/tests/integration_tests/complex_transaction/workload.go index 946d21bf5f..9f2a02a4f6 100644 --- a/tests/integration_tests/complex_transaction/workload.go +++ b/tests/integration_tests/complex_transaction/workload.go @@ -21,8 +21,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) diff --git a/tests/integration_tests/default_value/main.go b/tests/integration_tests/default_value/main.go index 0599002e9a..9197ce8dac 100644 --- a/tests/integration_tests/default_value/main.go +++ b/tests/integration_tests/default_value/main.go @@ -27,8 +27,8 @@ import ( "time" guuid "github.com/google/uuid" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/workerpool" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" diff --git a/tests/integration_tests/many_pk_or_uk/main.go b/tests/integration_tests/many_pk_or_uk/main.go index cdc6f3a902..8d66c12fc0 100644 --- a/tests/integration_tests/many_pk_or_uk/main.go +++ b/tests/integration_tests/many_pk_or_uk/main.go @@ -21,8 +21,8 @@ import ( "os" "sync" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" ) diff --git a/tests/integration_tests/multi_source/main.go b/tests/integration_tests/multi_source/main.go index 52323f633f..66b71e978b 100644 --- a/tests/integration_tests/multi_source/main.go +++ b/tests/integration_tests/multi_source/main.go @@ -27,8 +27,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "go.uber.org/zap" ) diff --git a/tests/integration_tests/resolve_lock/main.go b/tests/integration_tests/resolve_lock/main.go index 1d8e6a63f3..2d3e679f65 100644 --- a/tests/integration_tests/resolve_lock/main.go +++ b/tests/integration_tests/resolve_lock/main.go @@ -28,9 +28,9 @@ import ( "strings" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/tests/integration_tests/util" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/meta/model" diff --git a/tests/integration_tests/util/db.go b/tests/integration_tests/util/db.go index 0a86043917..578efdc0e1 100644 --- a/tests/integration_tests/util/db.go +++ b/tests/integration_tests/util/db.go @@ -20,9 +20,9 @@ import ( "net/url" "time" - "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/log" "github.com/pingcap/ticdc/pkg/diff" + "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/pkg/util/dbutil" "go.uber.org/zap" ) diff --git a/tools/workload/app.go b/tools/workload/app.go index fb293e8223..fcb17df9df 100644 --- a/tools/workload/app.go +++ b/tools/workload/app.go @@ -23,8 +23,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" "workload/schema" pbank "workload/schema/bank" diff --git a/tools/workload/ddl_app.go b/tools/workload/ddl_app.go index 9a5b1e23f3..c57ba66ba0 100644 --- a/tools/workload/ddl_app.go +++ b/tools/workload/ddl_app.go @@ -16,8 +16,8 @@ package main import ( "sync" - "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) diff --git a/tools/workload/ddl_executor.go b/tools/workload/ddl_executor.go index cfe615b0f4..2db3449b40 100644 --- a/tools/workload/ddl_executor.go +++ b/tools/workload/ddl_executor.go @@ -23,8 +23,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" ) diff --git a/tools/workload/ddl_runner.go b/tools/workload/ddl_runner.go index 72d854203c..ce1cb5d885 100644 --- a/tools/workload/ddl_runner.go +++ b/tools/workload/ddl_runner.go @@ -21,8 +21,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/ticdc/pkg/errors" plog "github.com/pingcap/log" + "github.com/pingcap/ticdc/pkg/errors" "go.uber.org/zap" )