Skip to content

Commit

Permalink
chore: fix warnings introduced by new golangci-lint version
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAx committed Oct 11, 2023
1 parent f62dfef commit ae3fb04
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
6 changes: 1 addition & 5 deletions assertion_validation.go
Expand Up @@ -18,11 +18,7 @@ func validateAssertion(failure *AssertionFailure) error {
}
}

if err := validateType(failure); err != nil {
return err
}

return nil
return validateType(failure)
}

func validateType(failure *AssertionFailure) error {
Expand Down
2 changes: 1 addition & 1 deletion e2e/context_test.go
Expand Up @@ -109,7 +109,7 @@ func newErrorSuppressor(
}
}

func (h *errorSuppressor) Success(ctx *httpexpect.AssertionContext) {
func (h *errorSuppressor) Success(*httpexpect.AssertionContext) {
}

func (h *errorSuppressor) Failure(
Expand Down
2 changes: 1 addition & 1 deletion e2e/mocks_test.go
Expand Up @@ -5,6 +5,6 @@ type mockReporter struct {
}

// Errorf implements Reporter.Errorf.
func (r *mockReporter) Errorf(message string, args ...interface{}) {
func (r *mockReporter) Errorf(_ string, _ ...interface{}) {
r.failed = true
}
20 changes: 10 additions & 10 deletions formatter.go
Expand Up @@ -354,7 +354,7 @@ func (f *DefaultFormatter) fillGeneral(
}

func (f *DefaultFormatter) fillErrors(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
data.Errors = []string{}

Expand All @@ -367,7 +367,7 @@ func (f *DefaultFormatter) fillErrors(
}

func (f *DefaultFormatter) fillActual(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
switch failure.Type { //nolint
case AssertUsage, AssertOperation:
Expand All @@ -384,7 +384,7 @@ func (f *DefaultFormatter) fillActual(
}

func (f *DefaultFormatter) fillExpected(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
switch failure.Type {
case AssertUsage, AssertOperation,
Expand Down Expand Up @@ -478,7 +478,7 @@ func (f *DefaultFormatter) fillExpected(
}

func (f *DefaultFormatter) fillIsNegation(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
switch failure.Type {
case AssertUsage, AssertOperation,
Expand Down Expand Up @@ -518,7 +518,7 @@ func (f *DefaultFormatter) fillIsNegation(
}

func (f *DefaultFormatter) fillIsComparison(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
switch failure.Type { //nolint
case AssertLt, AssertLe, AssertGt, AssertGe:
Expand All @@ -527,21 +527,21 @@ func (f *DefaultFormatter) fillIsComparison(
}

func (f *DefaultFormatter) fillReference(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
data.HaveReference = true
data.Reference = f.formatValue(failure.Reference.Value)
}

func (f *DefaultFormatter) fillDelta(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
data.HaveDelta = true
data.Delta = f.formatValue(failure.Delta.Value)
}

func (f *DefaultFormatter) fillRequest(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, ctx *AssertionContext, _ *AssertionFailure,
) {
if !f.DisableRequests && ctx.Request != nil && ctx.Request.httpReq != nil {
dump, err := httputil.DumpRequest(ctx.Request.httpReq, false)
Expand All @@ -555,7 +555,7 @@ func (f *DefaultFormatter) fillRequest(
}

func (f *DefaultFormatter) fillResponse(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, ctx *AssertionContext, _ *AssertionFailure,
) {
if !f.DisableResponses && ctx.Response != nil && ctx.Response.httpResp != nil {
dump, err := httputil.DumpResponse(ctx.Response.httpResp, false)
Expand All @@ -572,7 +572,7 @@ func (f *DefaultFormatter) fillResponse(
}

func (f *DefaultFormatter) fillStacktrace(
data *FormatData, ctx *AssertionContext, failure *AssertionFailure,
data *FormatData, _ *AssertionContext, failure *AssertionFailure,
) {
data.Stacktrace = []string{}

Expand Down
12 changes: 6 additions & 6 deletions mocks_test.go
Expand Up @@ -78,7 +78,7 @@ func (mf *mockFormatter) FormatSuccess(ctx *AssertionContext) string {
}

func (mf *mockFormatter) FormatFailure(
ctx *AssertionContext, failure *AssertionFailure,
ctx *AssertionContext, _ *AssertionFailure,
) string {
mf.formattedFailure++
return ctx.TestName
Expand Down Expand Up @@ -126,11 +126,11 @@ func (mp *mockWebsocketPrinter) Request(*http.Request) {
func (mp *mockWebsocketPrinter) Response(*http.Response, time.Duration) {
}

func (mp *mockWebsocketPrinter) WebsocketWrite(typ int, content []byte, closeCode int) {
func (mp *mockWebsocketPrinter) WebsocketWrite(int, []byte, int) {
mp.isWrittenTo = true
}

func (mp *mockWebsocketPrinter) WebsocketRead(typ int, content []byte, closeCode int) {
func (mp *mockWebsocketPrinter) WebsocketRead(int, []byte, int) {
mp.isReadFrom = true
}

Expand All @@ -154,19 +154,19 @@ func (mc *mockWebsocketConn) Close() error {
return mc.closeError
}

func (mc *mockWebsocketConn) SetReadDeadline(t time.Time) error {
func (mc *mockWebsocketConn) SetReadDeadline(time.Time) error {
return mc.readDlError
}

func (mc *mockWebsocketConn) SetWriteDeadline(t time.Time) error {
func (mc *mockWebsocketConn) SetWriteDeadline(time.Time) error {
return mc.writeDlError
}

func (mc *mockWebsocketConn) ReadMessage() (messageType int, p []byte, err error) {
return mc.msgType, []byte{}, mc.readMsgErr
}

func (mc *mockWebsocketConn) WriteMessage(messageType int, data []byte) error {
func (mc *mockWebsocketConn) WriteMessage(int, []byte) error {
return mc.writeMsgErr
}

Expand Down
2 changes: 1 addition & 1 deletion nocopy_test.go
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
)

func TestNoCopy(t *testing.T) {
func TestNoCopy(*testing.T) {
var n noCopy

n.Lock()
Expand Down
2 changes: 1 addition & 1 deletion object.go
Expand Up @@ -1201,7 +1201,7 @@ func (o *Object) sortedKV() []kv {
}

func containsKey(
opChain *chain, obj map[string]interface{}, key string,
_ *chain, obj map[string]interface{}, key string,
) bool {
for k := range obj {
if k == key {
Expand Down
4 changes: 2 additions & 2 deletions reporter_test.go
Expand Up @@ -11,15 +11,15 @@ type mockT struct {
fatalfInvoked bool
}

func (m *mockT) Fatalf(format string, args ...interface{}) {
func (m *mockT) Fatalf(string, ...interface{}) {
m.fatalfInvoked = true
}

type mockAssertT struct {
errorfInvoked bool
}

func (m *mockAssertT) Errorf(format string, args ...interface{}) {
func (m *mockAssertT) Errorf(string, ...interface{}) {
m.errorfInvoked = true
}

Expand Down
2 changes: 1 addition & 1 deletion websocket_test.go
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
)

func noWsPreSteps(ws *Websocket) {}
func noWsPreSteps(*Websocket) {}

func TestWebsocket_FailedChain(t *testing.T) {
reporter := newMockReporter(t)
Expand Down

0 comments on commit ae3fb04

Please sign in to comment.