diff --git a/ci/fmt.sh b/ci/fmt.sh index 588510ba..4f750317 100755 --- a/ci/fmt.sh +++ b/ci/fmt.sh @@ -2,7 +2,7 @@ set -eu cd -- "$(dirname "$0")/.." -X_TOOLS_VERSION=v0.31.0 +X_TOOLS_VERSION=v0.40.0 go mod tidy (cd ./internal/thirdparty && go mod tidy) diff --git a/go.mod b/go.mod index d32fbd77..9ba755a8 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/coder/websocket -go 1.23 +go 1.25 diff --git a/internal/examples/go.mod b/internal/examples/go.mod index e368b76b..65e05c2a 100644 --- a/internal/examples/go.mod +++ b/internal/examples/go.mod @@ -1,6 +1,6 @@ module github.com/coder/websocket/examples -go 1.23 +go 1.25 replace github.com/coder/websocket => ../.. diff --git a/internal/thirdparty/go.mod b/internal/thirdparty/go.mod index 7a86aca9..b714a490 100644 --- a/internal/thirdparty/go.mod +++ b/internal/thirdparty/go.mod @@ -1,6 +1,6 @@ module github.com/coder/websocket/internal/thirdparty -go 1.23 +go 1.25 replace github.com/coder/websocket => ../.. diff --git a/stringer.go b/stringer.go index 5a66ba29..ed7b12b8 100644 --- a/stringer.go +++ b/stringer.go @@ -50,11 +50,11 @@ const _MessageType_name = "MessageTextMessageBinary" var _MessageType_index = [...]uint8{0, 11, 24} func (i MessageType) String() string { - i -= 1 - if i < 0 || i >= MessageType(len(_MessageType_index)-1) { - return "MessageType(" + strconv.FormatInt(int64(i+1), 10) + ")" + idx := int(i) - 1 + if i < 1 || idx >= len(_MessageType_index)-1 { + return "MessageType(" + strconv.FormatInt(int64(i), 10) + ")" } - return _MessageType_name[_MessageType_index[i]:_MessageType_index[i+1]] + return _MessageType_name[_MessageType_index[idx]:_MessageType_index[idx+1]] } func _() { // An "invalid array index" compiler error signifies that the constant values have changed. @@ -83,9 +83,9 @@ const _StatusCode_name = "StatusNormalClosureStatusGoingAwayStatusProtocolErrorS var _StatusCode_index = [...]uint16{0, 19, 34, 53, 74, 88, 106, 127, 156, 177, 196, 220, 239, 259, 278, 294, 312} func (i StatusCode) String() string { - i -= 1000 - if i < 0 || i >= StatusCode(len(_StatusCode_index)-1) { - return "StatusCode(" + strconv.FormatInt(int64(i+1000), 10) + ")" + idx := int(i) - 1000 + if i < 1000 || idx >= len(_StatusCode_index)-1 { + return "StatusCode(" + strconv.FormatInt(int64(i), 10) + ")" } - return _StatusCode_name[_StatusCode_index[i]:_StatusCode_index[i+1]] + return _StatusCode_name[_StatusCode_index[idx]:_StatusCode_index[idx+1]] }