From 1a729f029224cc10b388dd6aabc73363bcddb584 Mon Sep 17 00:00:00 2001 From: cwarnerdev <138500512+cwarnerdev@users.noreply.github.com> Date: Wed, 2 Apr 2025 08:56:37 -1000 Subject: [PATCH 1/3] update websocket import package is now maintained at github.com/coder/websocket --- web/go.mod | 2 +- web/go.sum | 6 ++++-- web/websockethub/client.go | 4 ++-- web/websockethub/hub.go | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/web/go.mod b/web/go.mod index add25126..fdf2b1f3 100644 --- a/web/go.mod +++ b/web/go.mod @@ -3,6 +3,7 @@ module github.com/iotaledger/hive.go/web go 1.22 require ( + github.com/coder/websocket v1.8.12 github.com/iotaledger/hive.go/constraints v0.0.0-20240517131232-748f1ce3a2d2 github.com/iotaledger/hive.go/ds v0.0.0-20240517131232-748f1ce3a2d2 github.com/iotaledger/hive.go/ierrors v0.0.0-20240517131232-748f1ce3a2d2 @@ -11,7 +12,6 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20240517131232-748f1ce3a2d2 github.com/stretchr/testify v1.9.0 golang.org/x/crypto v0.23.0 - nhooyr.io/websocket v1.8.11 ) require ( diff --git a/web/go.sum b/web/go.sum index 95eab6a5..bb92868b 100644 --- a/web/go.sum +++ b/web/go.sum @@ -1,5 +1,9 @@ github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E= github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8= +github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo= +github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= +github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE= +github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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= @@ -56,5 +60,3 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0= -nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= diff --git a/web/websockethub/client.go b/web/websockethub/client.go index a7e6a07c..4a244c47 100644 --- a/web/websockethub/client.go +++ b/web/websockethub/client.go @@ -7,8 +7,8 @@ import ( "sync/atomic" "time" - "nhooyr.io/websocket" - "nhooyr.io/websocket/wsjson" + "github.com/coder/websocket" + "github.com/coder/websocket/wsjson" "github.com/iotaledger/hive.go/log" "github.com/iotaledger/hive.go/runtime/timeutil" diff --git a/web/websockethub/hub.go b/web/websockethub/hub.go index ace7153e..2aa7bfe8 100644 --- a/web/websockethub/hub.go +++ b/web/websockethub/hub.go @@ -5,7 +5,7 @@ import ( "net/http" "sync/atomic" - "nhooyr.io/websocket" + "github.com/coder/websocket" "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/log" From 5db5ce680195c8523fdea02e85234ac7b524dba4 Mon Sep 17 00:00:00 2001 From: cwarnerdev <138500512+cwarnerdev@users.noreply.github.com> Date: Thu, 3 Apr 2025 03:41:40 -1000 Subject: [PATCH 2/3] update websocket to latest --- web/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/go.mod b/web/go.mod index fdf2b1f3..78a0a8c1 100644 --- a/web/go.mod +++ b/web/go.mod @@ -3,7 +3,7 @@ module github.com/iotaledger/hive.go/web go 1.22 require ( - github.com/coder/websocket v1.8.12 + github.com/coder/websocket v1.8.13 github.com/iotaledger/hive.go/constraints v0.0.0-20240517131232-748f1ce3a2d2 github.com/iotaledger/hive.go/ds v0.0.0-20240517131232-748f1ce3a2d2 github.com/iotaledger/hive.go/ierrors v0.0.0-20240517131232-748f1ce3a2d2 From a8998ced4846ef9db76555c3660564d31a98e76e Mon Sep 17 00:00:00 2001 From: cwarnerdev <138500512+cwarnerdev@users.noreply.github.com> Date: Thu, 3 Apr 2025 04:07:44 -1000 Subject: [PATCH 3/3] fix linters migrating the linter config to latest so they will run --- .golangci.yml | 341 +++++++++++++++++++++++++------------------------- 1 file changed, 170 insertions(+), 171 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index e28605e9..7109afed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,177 +1,176 @@ +version: "2" run: - tests: true - -linters-settings: - gofmt: - simplify: true - goimports: - local-prefixes: github.com/iotaledger + tests: true +linters: + default: none + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - decorder + - depguard + - dogsled + - dupl + - dupword + - durationcheck + - err113 + - errcheck + - errchkjson + - errname + - errorlint + - forcetypeassert + - ginkgolinter + - gocheckcompilerdirectives + - goconst + - godot + - goheader + - gomodguard + - goprintffuncname + - gosec + - gosmopolitan + - govet + - grouper + - importas + - inamedparam + - ineffassign + - intrange + - loggercheck + - makezero + - mirror + - misspell + - musttag + - nakedret + - nilerr + - nilnil + - nlreturn + - noctx + - nolintlint + - nosprintfhostport + - paralleltest + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - revive + - rowserrcheck + - sloglint + - spancheck + - sqlclosecheck + - staticcheck + - tagliatelle + - testableexamples + - testifylint + - testpackage + - thelper + - tparallel + - unconvert + - unparam + - unused + - usestdlibvars + - wastedassign + - whitespace + - zerologlint + settings: + depguard: + rules: + main: + files: + - '!**/ierrors.go' + - '!**/ierrors_no_stacktrace.go' + deny: + - pkg: errors + desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package + - pkg: golang.org/x/xerrors + desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package + - pkg: github.com/pkg/errors + desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package gocyclo: - min-complexity: 15 + min-complexity: 15 govet: - disable: - - shadow + disable: + - shadow misspell: - locale: US - staticcheck: - checks: ["all"] + locale: US nlreturn: - block-size: 2 - stylecheck: - initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] - depguard: - rules: - main: - # exclude the ierrors.go file itself - files: - - "!**/ierrors.go" - - "!**/ierrors_no_stacktrace.go" - deny: - - pkg: "errors" - desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package - - pkg: "golang.org/x/xerrors" - desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package - - pkg: "github.com/pkg/errors" - desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package - -linters: - # Disable all linters. - disable-all: true - # Enable specific linter - enable: - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - unused - - asasalint - - asciicheck - - bidichk - - bodyclose - #- containedctx - #- contextcheck # this linter is buggy and renders all nolint rules useless - - copyloopvar - #- cyclop - - decorder - - depguard - - dogsled - - dupl - - dupword - - durationcheck - - errchkjson - - errname - - errorlint - - execinquery - #- exhaustive - #- exhaustruct - - exportloopref - #- forbidigo - - forcetypeassert - #- funlen - #- gci - - ginkgolinter - - gocheckcompilerdirectives - #- gochecknoglobals - #- gochecknoinits - #- gochecksumtype - #- gocognit - - goconst - #- gocritic - #- gocyclo - - godot - #- godox - - goerr113 - - gofmt - #- gofumpt - - goheader - - goimports - #- gomnd - #- gomoddirectives - - gomodguard - - goprintffuncname - - gosec - - gosmopolitan - - grouper - - importas - - inamedparam - #- interfacebloat - - intrange - #- ireturn - #- lll - - loggercheck - #- maintidx - - makezero - - mirror - - misspell - - musttag - - nakedret - #- nestif - - nilerr - - nilnil - - nlreturn - - noctx - - nolintlint - #- nonamedreturns - - nosprintfhostport - - paralleltest - #- perfsprint - - prealloc - - predeclared - - promlinter - - protogetter - - reassign - - revive - - rowserrcheck - - sloglint - - spancheck - - sqlclosecheck - - stylecheck - #- tagalign - - tagliatelle - - tenv - - testableexamples - - testifylint - - testpackage - - thelper - - tparallel - - unconvert - - unparam - - usestdlibvars - #- varnamelen - - wastedassign - - whitespace - #- wrapcheck - #- wsl - - zerologlint - + block-size: 2 + staticcheck: + checks: + - all + initialisms: + - ACL + - API + - ASCII + - CPU + - CSS + - DNS + - EOF + - GUID + - HTML + - HTTP + - HTTPS + - ID + - IP + - JSON + - QPS + - RAM + - RPC + - SLA + - SMTP + - SQL + - SSH + - TCP + - TLS + - TTL + - UDP + - UI + - GID + - UID + - UUID + - URI + - URL + - UTF8 + - VM + - XML + - XMPP + - XSRF + - XSS + - SIP + - RTP + - AMQP + - DB + - TS + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - .*_test.go$ + - third_party$ + - builtin$ + - examples$ issues: - exclude-files: - - ".*_test.go$" - # Maximum issues count per one linter. - # Set to 0 to disable. - # Default: 50 - max-issues-per-linter: 0 - # Maximum count of issues with the same text. - # Set to 0 to disable. - # Default: 3 - max-same-issues: 0 - #exclude: - # - 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked' # errcheck - # - "err113: do not define dynamic errors, use wrapped static errors instead:" # goerr113 - # - "type name will be used as [0-9A-Za-z_.]+ by other packages, and that stutters; consider calling this" # golint - # - "Potential file inclusion via variable" # gosec - # - "G404: Use of weak random number generator" # gosec - # - "Subprocess launch(ed with variable|ing should be audited)" # gosec - # - "Use of unsafe calls should be audited" # gosec - # - "G108: Profiling endpoint is automatically exposed on /debug/pprof" # gosec - # - "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)" # gosec - # - "G101: Potential hardcoded credentials" # gosec - # - "(G104|G307)" # gosec Duplicated errcheck checks. - # - "`[0-9A-Za-z_.]+` - `[0-9A-Za-z_.]+` always receives `[0-9A-Za-z_.]+`" # unparam - # - "should have comment .*or be unexported" # revive - # - "exported: comment on exported" # revive - # - "package-comments: package comment should be of the form" # revive - # - "blank-imports" # revive - # - "var-naming: don't use leading k in Go names;" #revive - # - 'shadow: declaration of "err"' # govet + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofmt + - goimports + settings: + gofmt: + simplify: true + goimports: + local-prefixes: + - github.com/iotaledger + exclusions: + generated: lax + paths: + - .*_test.go$ + - third_party$ + - builtin$ + - examples$