From 9bdbc1b61c1a97c738f4d179faeca7f9decfdba6 Mon Sep 17 00:00:00 2001 From: 8thgencore Date: Mon, 14 Apr 2025 09:47:42 +0300 Subject: [PATCH 1/5] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20packages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 05d2ba3..e3219da 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,14 @@ module github.com/8thgencore/valchemy go 1.24.0 require ( - github.com/alecthomas/kong v1.8.1 - github.com/golang-cz/devslog v0.0.11 + github.com/alecthomas/kong v1.10.0 + github.com/golang-cz/devslog v0.0.12 github.com/ilyakaznacheev/cleanenv v1.5.0 github.com/stretchr/testify v1.10.0 ) require ( - github.com/BurntSushi/toml v1.4.0 // indirect + github.com/BurntSushi/toml v1.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/joho/godotenv v1.5.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/go.sum b/go.sum index a1ca417..4dd6237 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,16 @@ github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= 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/kong v1.8.1 h1:6aamvWBE/REnR/BCq10EcozmcpUPc5aGI1lPAWdB0EE= -github.com/alecthomas/kong v1.8.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= +github.com/alecthomas/kong v1.10.0 h1:8K4rGDpT7Iu+jEXCIJUeKqvpwZHbsFRoebLbnzlmrpw= +github.com/alecthomas/kong v1.10.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang-cz/devslog v0.0.11 h1:v4Yb9o0ZpuZ/D8ZrtVw1f9q5XrjnkxwHF1XmWwO8IHg= -github.com/golang-cz/devslog v0.0.11/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= +github.com/golang-cz/devslog v0.0.12 h1:wTwC066Qc7ag7J4coy5mBQXA6lYyaSA3ctpArcWofNg= +github.com/golang-cz/devslog v0.0.12/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= 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/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4= From 61e939a7ce86a1485e0cdd378ff819cc1ee76268 Mon Sep 17 00:00:00 2001 From: 8thgencore Date: Mon, 5 May 2025 15:41:02 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20Go=20version?= =?UTF-8?q?=20to=201.24.2=20and=20bump=20devslog=20to=20v0.0.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index e3219da..73d0637 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/8thgencore/valchemy -go 1.24.0 +go 1.24.2 require ( github.com/alecthomas/kong v1.10.0 - github.com/golang-cz/devslog v0.0.12 + github.com/golang-cz/devslog v0.0.13 github.com/ilyakaznacheev/cleanenv v1.5.0 github.com/stretchr/testify v1.10.0 ) diff --git a/go.sum b/go.sum index 4dd6237..bbc7161 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang-cz/devslog v0.0.12 h1:wTwC066Qc7ag7J4coy5mBQXA6lYyaSA3ctpArcWofNg= -github.com/golang-cz/devslog v0.0.12/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= +github.com/golang-cz/devslog v0.0.13 h1:JkJ6PPNSOCBpYyU03v3xw7WgpChQ3AYFqgRbYBhUk/Y= +github.com/golang-cz/devslog v0.0.13/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= 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/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4= From 5aa758d997c51b19ee2f7c63e86a28969249a226 Mon Sep 17 00:00:00 2001 From: 8thgencore Date: Wed, 9 Jul 2025 22:32:13 +0300 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=94=A7=20Update=20golangci-lint=20con?= =?UTF-8?q?figuration,=20bump=20dependencies,=20and=20improve=20CI=20workf?= =?UTF-8?q?low?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 4 +- .golangci.yaml | 141 +++++++++++++++++--------------- go.mod | 4 +- go.sum | 4 + internal/replication/replica.go | 2 +- taskfiles/deps.yml | 2 +- 6 files changed, 83 insertions(+), 74 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ec9197d..1de49aa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: file: ./coverage.txt token: ${{ secrets.CODECOV_TOKEN }} @@ -51,7 +51,7 @@ jobs: go-version: ${{ matrix.go-version }} - name: golangci-lint - uses: golangci/golangci-lint-action@v4 + uses: golangci/golangci-lint-action@v8 with: version: latest args: --timeout=5m --out-format=colored-line-number diff --git a/.golangci.yaml b/.golangci.yaml index 0473d93..f1cdd5c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,26 +1,24 @@ -# More info on config here: https://golangci-lint.run/usage/configuration/#config-file +version: "2" + run: concurrency: 8 - timeout: 10m issues-exit-code: 1 tests: true output: formats: - - format: colored-line-number - path: stdout - - format: html - path: tmp/linter-report-backend.html + text: + path: stdout + html: + path: tmp/linter-report-backend.html linters: - disable-all: true + default: none enable: - errcheck - gocognit - goconst - - goimports - gosec - - gosimple - govet - ineffassign - lll @@ -29,64 +27,71 @@ linters: - perfsprint - revive - staticcheck - - stylecheck - - typecheck - unused + settings: + dupl: + threshold: 100 + gocognit: + min-complexity: 30 + goconst: + min-len: 2 + min-occurrences: 2 + govet: + disable: + - fieldalignment + - printf + - shadow + enable-all: true + lll: + line-length: 120 + nlreturn: + block-size: 5 + perfsprint: + int-conversion: true + err-error: true + errorf: true + sprintf1: true + strconcat: true + exclusions: + generated: lax + rules: + - path: (.+)\.go$ + text: G104 + - path: (.+)\.go$ + text: exported func .* returns unexported type .*, which can be annoying to use + - path: (.+)\.go$ + text: should have a package comment + - path: (.+)\.go$ + text: don't use an underscore in package name + paths: + - \.pb\.go$ + - \.pb\.gw\.go$ + - _test\.go$ + - bin + - vendor + - var + - tmp + - mocks + - \.cache + - third_party$ + - builtin$ + - examples$ -linters-settings: - govet: - enable-all: true - disable: - # There is rarely performance differences due to padding, - # the most noticable impact is memory usage. However, - # the main trace data is Protobuf-generated and we ignore - # those files from linting, so this linter is not useful. - - fieldalignment - # Disable shadow - - printf - - shadow - dupl: - threshold: 100 - gocognit: - min-complexity: 30 - goconst: - min-len: 2 - min-occurrences: 2 - lll: - line-length: 120 - perfsprint: - # Optimizes even if it requires an int or uint type cast. - int-conversion: true - # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors. - err-error: true - # Optimizes `fmt.Errorf`. - errorf: true - # Optimizes `fmt.Sprintf` with only one argument. - sprintf1: true - # Optimizes into strings concatenation. - strconcat: true - nlreturn: - # Size of the block (including return statement that is still "OK") - # so no return split required. - # Default: 1 - block-size: 5 - -issues: - exclude-use-default: false - exclude: - # _ instead of err checks - - G104 - - exported func .* returns unexported type .*, which can be annoying to use - - should have a package comment - - don't use an underscore in package name - exclude-dirs: - - bin - - vendor - - var - - tmp - - mocks - - \.cache - exclude-files: - - \.pb\.go$ - - \.pb\.gw\.go$ - - _test\.go$ +formatters: + enable: + - goimports + exclusions: + generated: lax + paths: + - \.pb\.go$ + - \.pb\.gw\.go$ + - _test\.go$ + - bin + - vendor + - var + - tmp + - mocks + - \.cache + - third_party$ + - builtin$ + - examples$ diff --git a/go.mod b/go.mod index 73d0637..4aeb50c 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/8thgencore/valchemy go 1.24.2 require ( - github.com/alecthomas/kong v1.10.0 - github.com/golang-cz/devslog v0.0.13 + github.com/alecthomas/kong v1.12.0 + github.com/golang-cz/devslog v0.0.15 github.com/ilyakaznacheev/cleanenv v1.5.0 github.com/stretchr/testify v1.10.0 ) diff --git a/go.sum b/go.sum index bbc7161..72af24d 100644 --- a/go.sum +++ b/go.sum @@ -5,12 +5,16 @@ github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8v github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/kong v1.10.0 h1:8K4rGDpT7Iu+jEXCIJUeKqvpwZHbsFRoebLbnzlmrpw= github.com/alecthomas/kong v1.10.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= +github.com/alecthomas/kong v1.12.0 h1:oKd/0fHSdajj5PfGDd3ScvEvpVJf9mT2mb5r9xYadYM= +github.com/alecthomas/kong v1.12.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang-cz/devslog v0.0.13 h1:JkJ6PPNSOCBpYyU03v3xw7WgpChQ3AYFqgRbYBhUk/Y= github.com/golang-cz/devslog v0.0.13/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= +github.com/golang-cz/devslog v0.0.15 h1:ejoBLTCwJHWGbAmDf2fyTJJQO3AkzcPjw8SC9LaOQMI= +github.com/golang-cz/devslog v0.0.15/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= 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/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4= diff --git a/internal/replication/replica.go b/internal/replication/replica.go index f8b8bc5..24e53d6 100644 --- a/internal/replication/replica.go +++ b/internal/replication/replica.go @@ -40,7 +40,7 @@ func (m *Manager) maintainMasterConnection() error { m.conn = nil } - replicationAddress := fmt.Sprintf("%s:%s", m.cfg.MasterHost, m.cfg.ReplicationPort) + replicationAddress := net.JoinHostPort(m.cfg.MasterHost, m.cfg.ReplicationPort) var err error retryCount := m.cfg.SyncRetryCount diff --git a/taskfiles/deps.yml b/taskfiles/deps.yml index c54b5d7..a79678f 100644 --- a/taskfiles/deps.yml +++ b/taskfiles/deps.yml @@ -6,6 +6,6 @@ tasks: cmds: - go install github.com/air-verse/air@latest - go install github.com/pressly/goose/v3/cmd/goose@latest - - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - go install mvdan.cc/gofumpt@latest - go install github.com/yoheimuta/protolint/cmd/protolint@latest + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.2.1 From 09091fbbb76b6f0ad514bc38ce9911a762bf1829 Mon Sep 17 00:00:00 2001 From: 8thgencore Date: Wed, 9 Jul 2025 22:52:15 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20Go=20version=20?= =?UTF-8?q?to=201.24.5=20and=20enhance=20golangci-lint=20args=20for=20bett?= =?UTF-8?q?er=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1de49aa..6e17bd1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,5 +54,5 @@ jobs: uses: golangci/golangci-lint-action@v8 with: version: latest - args: --timeout=5m --out-format=colored-line-number + args: run --timeout=5m --output.text.colors=true --output.text.print-linter-name=true --output.text.print-issued-lines=true only-new-issues: true diff --git a/go.mod b/go.mod index 4aeb50c..94647fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/8thgencore/valchemy -go 1.24.2 +go 1.24.5 require ( github.com/alecthomas/kong v1.12.0 From a0a2103b18f8e705e84267587f340a832dd34291 Mon Sep 17 00:00:00 2001 From: 8thgencore Date: Wed, 9 Jul 2025 23:02:24 +0300 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=94=A7=20Update=20golangci-lint=20arg?= =?UTF-8?q?s=20in=20CI=20workflow=20and=20set=20timeout=20in=20golangci=20?= =?UTF-8?q?configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 2 +- .golangci.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6e17bd1..161fd94 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,5 +54,5 @@ jobs: uses: golangci/golangci-lint-action@v8 with: version: latest - args: run --timeout=5m --output.text.colors=true --output.text.print-linter-name=true --output.text.print-issued-lines=true + args: --output.text.colors=true --output.text.print-linter-name=true --output.text.print-issued-lines=true only-new-issues: true diff --git a/.golangci.yaml b/.golangci.yaml index f1cdd5c..3abc648 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,6 +1,7 @@ version: "2" run: + timeout: 5m concurrency: 8 issues-exit-code: 1 tests: true