From 0f71cd50d46c61d13f8e6b7aabfaeca5f85800ce Mon Sep 17 00:00:00 2001 From: 9seconds Date: Mon, 21 Jun 2021 17:31:05 +0300 Subject: [PATCH] Run gofumpt --- auth/ip_whitelist_auth_test.go | 4 ++-- conns/unhijack_test.go | 2 +- errors/error_test.go | 1 - events/event_stream_test.go | 2 +- headers/headers_test.go | 4 ++-- layers/layer_filter_subnets_test.go | 5 ++--- opts_test.go | 16 ++++++++-------- upgrades/init_test.go | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/auth/ip_whitelist_auth_test.go b/auth/ip_whitelist_auth_test.go index 5f4a22bc..be2e7059 100644 --- a/auth/ip_whitelist_auth_test.go +++ b/auth/ip_whitelist_auth_test.go @@ -30,8 +30,8 @@ func (suite *IPWhitelistAuthTestSuite) SetupTest() { _, netv6, _ := net.ParseCIDR("2001:db8:85a3:8d3:1319:8a2e:370:7348/64") suite.auth, _ = auth.NewIPWhitelist(map[string][]net.IPNet{ - "user1": []net.IPNet{*net127, *net192}, - "user2": []net.IPNet{*netv6}, + "user1": {*net127, *net192}, + "user2": {*netv6}, }) } diff --git a/conns/unhijack_test.go b/conns/unhijack_test.go index ff76c570..51a34ff6 100644 --- a/conns/unhijack_test.go +++ b/conns/unhijack_test.go @@ -84,7 +84,7 @@ func (suite *UnhijackTestSuite) TestKeepOpened() { } func (suite *UnhijackTestSuite) TestClose() { - suite.raw.On("Close").Return(nil) + suite.raw.On("Close").Return(nil) conns.FixHijackHandler(func(net.Conn) bool { return true diff --git a/errors/error_test.go b/errors/error_test.go index 204d5780..a04344ef 100644 --- a/errors/error_test.go +++ b/errors/error_test.go @@ -47,7 +47,6 @@ const errorJSONSchema = ` var errorJSONValidator = func() *gojsonschema.Schema { loader := gojsonschema.NewStringLoader(errorJSONSchema) rv, err := gojsonschema.NewSchema(loader) - if err != nil { panic(err) } diff --git a/events/event_stream_test.go b/events/event_stream_test.go index 31497473..63377579 100644 --- a/events/event_stream_test.go +++ b/events/event_stream_test.go @@ -67,7 +67,7 @@ func (suite *EventStreamTestSuite) SetupTest() { suite.factory = &ProcessorMockFactory{ All: []*ProcessorMock{}, } - suite.stream = events.NewStream(ctx, suite.factory.Make) + suite.stream = events.NewStream(ctx, suite.factory.Make) sleep() } diff --git a/headers/headers_test.go b/headers/headers_test.go index 66b2c73e..60a363cc 100644 --- a/headers/headers_test.go +++ b/headers/headers_test.go @@ -29,8 +29,8 @@ func (suite *HeadersTestSuite) SetupTest() { suite.NoError(wrapper.Read(strings.NewReader(req))) - suite.hdrs.Reset(wrapper) - suite.NoError(suite.hdrs.Pull()) + suite.hdrs.Reset(wrapper) + suite.NoError(suite.hdrs.Pull()) } func (suite *HeadersTestSuite) TearDownTest() { diff --git a/layers/layer_filter_subnets_test.go b/layers/layer_filter_subnets_test.go index d1b85715..e79aa90d 100644 --- a/layers/layer_filter_subnets_test.go +++ b/layers/layer_filter_subnets_test.go @@ -14,18 +14,17 @@ type FilterSubnetLayerTestSuite struct { func (suite *FilterSubnetLayerTestSuite) SetupTest() { suite.BaseLayerTestSuite.SetupTest() - } func (suite *FilterSubnetLayerTestSuite) TestIPv4() { suite.l, _ = layers.NewFilterSubnetsLayer([]net.IPNet{ - net.IPNet{IP: net.ParseIP("127.0.0.1"), Mask: net.CIDRMask(24, 32)}, + {IP: net.ParseIP("127.0.0.1"), Mask: net.CIDRMask(24, 32)}, }) suite.Error(suite.l.OnRequest(suite.ctx)) suite.l, _ = layers.NewFilterSubnetsLayer([]net.IPNet{ - net.IPNet{IP: net.ParseIP("10.0.0.10"), Mask: net.CIDRMask(24, 32)}, + {IP: net.ParseIP("10.0.0.10"), Mask: net.CIDRMask(24, 32)}, }) suite.NoError(suite.l.OnRequest(suite.ctx)) diff --git a/opts_test.go b/opts_test.go index 6704913e..b4d6da43 100644 --- a/opts_test.go +++ b/opts_test.go @@ -131,28 +131,28 @@ func (suite *OptsTestSuite) TestGetTLSSkipVerify() { func (suite *OptsTestSuite) TestGetLayers() { suite.Len(suite.o.GetLayers(), 2) - lr := layers.TimeoutLayer{Timeout: time.Second} + lr := layers.TimeoutLayer{Timeout: time.Second} suite.o.Layers = []layers.Layer{lr} suite.Len(suite.o.GetLayers(), 3) - suite.Equal(lr, suite.o.GetLayers()[1]) + suite.Equal(lr, suite.o.GetLayers()[1]) } func (suite *OptsTestSuite) TestGetAuthenticator() { - suite.IsType(auth.NoopAuth{}, suite.o.GetAuthenticator()) + suite.IsType(auth.NoopAuth{}, suite.o.GetAuthenticator()) - suite.o.Authenticator = auth.NewBasicAuth(nil) + suite.o.Authenticator = auth.NewBasicAuth(nil) - suite.Equal(suite.o.Authenticator, suite.o.GetAuthenticator()) + suite.Equal(suite.o.Authenticator, suite.o.GetAuthenticator()) } func (suite *OptsTestSuite) TestGetExecutor() { - suite.Nil(suite.o.GetExecutor()) + suite.Nil(suite.o.GetExecutor()) - suite.o.Executor = func(_ *layers.Context) error { return nil } + suite.o.Executor = func(_ *layers.Context) error { return nil } - suite.NotNil(suite.o.GetExecutor()) + suite.NotNil(suite.o.GetExecutor()) } func TestOpts(t *testing.T) { diff --git a/upgrades/init_test.go b/upgrades/init_test.go index 5d9f5994..ffd32b7d 100644 --- a/upgrades/init_test.go +++ b/upgrades/init_test.go @@ -54,7 +54,7 @@ func (m *MockConn) SetWriteDeadline(tm time.Time) error { } type UpgradesTestSuite struct { - suite.Suite + suite.Suite up upgrades.Interface clientConn *MockConn