Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ linters-settings:
recommendations:
- errors
forbidigo:
analyze-types: true
forbid:
- ^fmt.Print(f|ln)?$
- ^log.(Panic|Fatal|Print)(f|ln)?$
- ^os.Exit$
- ^panic$
- ^print(ln)?$
- p: ^testing.T.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$
pkg: ^testing$
msg: "use testify/assert instead"
varnamelen:
max-distance: 12
min-name-length: 2
Expand Down Expand Up @@ -127,9 +131,12 @@ issues:
exclude-dirs-use-default: false
exclude-rules:
# Allow complex tests and examples, better to be self contained
- path: (examples|main\.go|_test\.go)
- path: (examples|main\.go)
linters:
- gocognit
- forbidigo
- path: _test\.go
linters:
- gocognit

# Allow forbidden identifiers in CLI commands
Expand Down
12 changes: 6 additions & 6 deletions base_lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestLexer(t *testing.T) {
l := &baseLexer{value: value}
field, err := l.readField()
assert.NoError(t, err)
assert.Equalf(t, field, "aaa", "%s: aaa not parsed, got: '%v'", k, field)
assert.Equalf(t, "aaa", field, "%s: aaa not parsed, got: '%v'", k, field)
}
})

Expand All @@ -36,7 +36,7 @@ func TestLexer(t *testing.T) {
t.Run("first line", func(t *testing.T) {
field, err := lex.readField()
assert.NoError(t, err)
assert.Equal(t, field, "aaa")
assert.Equal(t, "aaa", field)

value, err := lex.readUint64Field()
assert.NoError(t, err)
Expand All @@ -48,23 +48,23 @@ func TestLexer(t *testing.T) {
t.Run("second line", func(t *testing.T) {
field, err := lex.readField()
assert.NoError(t, err)
assert.Equal(t, field, "f1")
assert.Equal(t, "f1", field)

field, err = lex.readField()
assert.NoError(t, err)
assert.Equal(t, field, "f2")
assert.Equal(t, "f2", field)

field, err = lex.readField()
assert.NoError(t, err)
assert.Equal(t, field, "")
assert.Empty(t, field)

assert.NoError(t, lex.nextLine())
})

t.Run("last line", func(t *testing.T) {
field, err := lex.readField()
assert.NoError(t, err)
assert.Equal(t, field, "last")
assert.Equal(t, "last", field)
})
})
}
7 changes: 5 additions & 2 deletions extmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func TestTransportCCExtMap(t *testing.T) {
URI: uri,
}

assert.NotEqual(t, e.Marshal(),
"3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")
assert.NotEqual(
t, "3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
e.Marshal(),
"TestTransportCC failed",
)
}
4 changes: 1 addition & 3 deletions unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,7 @@ func TestUnmarshalRepeatTimes(t *testing.T) {
assert.Equal(t, RepeatTimesSDPExpected, string(actual))

err = sd.UnmarshalString(TimingSDP + "r=\r\n")
if !assert.ErrorIs(t, err, errSDPInvalidValue) {
assert.NoError(t, err)
}
assert.ErrorIs(t, err, errSDPInvalidValue)
}

func TestUnmarshalTimeZones(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestCodecMultipleValues(t *testing.T) {
)

_, err := sd.GetPayloadTypeForCodec(Codec{Name: "VP8/90000"})
assert.ErrorIs(t, test.expectedError, err)
assert.ErrorIs(t, err, test.expectedError)
})
}
}
Loading