linter: Enable gofumpt and run against codebase (#1848)

* linter: Enable gofumpt and run against codebase

* Address shazbert's nits

* gofumpt: Fix issues after rebase
This commit is contained in:
Adrian Gallagher
2025-03-18 10:23:16 +11:00
committed by GitHub
parent 748ed71455
commit f5faca2eb2
189 changed files with 1541 additions and 1104 deletions

View File

@@ -24,11 +24,11 @@ type Connection interface {
// defined in websocket_connection.go.
GenerateMessageID(highPrecision bool) int64
// SendMessageReturnResponse will send a WS message to the connection and wait for response
SendMessageReturnResponse(ctx context.Context, epl request.EndpointLimit, signature any, request any) ([]byte, error)
SendMessageReturnResponse(ctx context.Context, epl request.EndpointLimit, signature, request any) ([]byte, error)
// SendMessageReturnResponses will send a WS message to the connection and wait for N responses
SendMessageReturnResponses(ctx context.Context, epl request.EndpointLimit, signature any, request any, expected int) ([][]byte, error)
SendMessageReturnResponses(ctx context.Context, epl request.EndpointLimit, signature, request any, expected int) ([][]byte, error)
// SendMessageReturnResponsesWithInspector will send a WS message to the connection and wait for N responses with message inspection
SendMessageReturnResponsesWithInspector(ctx context.Context, epl request.EndpointLimit, signature any, request any, expected int, messageInspector Inspector) ([][]byte, error)
SendMessageReturnResponsesWithInspector(ctx context.Context, epl request.EndpointLimit, signature, request any, expected int, messageInspector Inspector) ([][]byte, error)
// SendRawMessage sends a message over the connection without JSON encoding it
SendRawMessage(ctx context.Context, epl request.EndpointLimit, messageType int, message []byte) error
// SendJSONMessage sends a JSON encoded message over the connection

View File

@@ -32,9 +32,7 @@ const (
proxyURL = "http://212.186.171.4:80" // Replace with a usable proxy server
)
var (
errDastardlyReason = errors.New("some dastardly reason")
)
var errDastardlyReason = errors.New("some dastardly reason")
type testStruct struct {
Error error
@@ -166,7 +164,7 @@ func TestSetup(t *testing.T) {
func TestConnectionMessageErrors(t *testing.T) {
t.Parallel()
var wsWrong = &Websocket{}
wsWrong := &Websocket{}
wsWrong.connector = func() error { return nil }
err := wsWrong.Connect()
assert.ErrorIs(t, err, ErrWebsocketNotEnabled, "Connect should error correctly")
@@ -657,7 +655,7 @@ func TestDial(t *testing.T) {
mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mockws.WsMockUpgrader(t, w, r, mockws.EchoHandler) }))
defer mock.Close()
var testCases = []testStruct{
testCases := []testStruct{
{
WC: WebsocketConnection{
ExchangeName: "test1",
@@ -709,7 +707,7 @@ func TestSendMessage(t *testing.T) {
mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mockws.WsMockUpgrader(t, w, r, mockws.EchoHandler) }))
defer mock.Close()
var testCases = []testStruct{
testCases := []testStruct{
{
WC: WebsocketConnection{
ExchangeName: "test1",