Skip to content

Commit c51af0e

Browse files
authored
Merge pull request #5 from dunglas/fix/linter
fix: golangci-lint errors
2 parents 8288c0b + dd7ade6 commit c51af0e

19 files changed

+74
-10
lines changed

.golangci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ run:
44
linters:
55
enable-all: true
66
disable:
7+
- gomnd
8+
- exhaustivestruct
79
- testpackage
810
- godox
11+
- wrapcheck
912

1013
issues:
1114
exclude-rules:
1215
- path: _test\.go
1316
linters:
1417
- funlen
18+
- forbidigo
19+
- errorlint

bareitem_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
)
99

1010
func TestParseBareItem(t *testing.T) {
11+
t.Parallel()
12+
1113
data := []struct {
1214
in string
1315
out interface{}
@@ -40,6 +42,8 @@ func TestParseBareItem(t *testing.T) {
4042
}
4143

4244
func TestMarshalBareItem(t *testing.T) {
45+
t.Parallel()
46+
4347
defer func() {
4448
if r := recover(); r == nil {
4549
t.Errorf("The code did not panic")
@@ -51,6 +55,8 @@ func TestMarshalBareItem(t *testing.T) {
5155
}
5256

5357
func TestAssertBareItem(t *testing.T) {
58+
t.Parallel()
59+
5460
defer func() {
5561
if r := recover(); r == nil {
5662
t.Errorf("The code did not panic")

binary_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
)
88

99
func TestBinary(t *testing.T) {
10+
t.Parallel()
11+
1012
var bd strings.Builder
1113
_ = marshalBinary(&bd, []byte{4, 2})
1214

@@ -16,6 +18,8 @@ func TestBinary(t *testing.T) {
1618
}
1719

1820
func TestParseBinary(t *testing.T) {
21+
t.Parallel()
22+
1923
data := []struct {
2024
in string
2125
out []byte

boolean_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
)
77

88
func TestBooleanMarshalSFV(t *testing.T) {
9+
t.Parallel()
10+
911
var b strings.Builder
1012

1113
_ = marshalBoolean(&b, true)
@@ -23,6 +25,8 @@ func TestBooleanMarshalSFV(t *testing.T) {
2325
}
2426

2527
func TestParseBoolean(t *testing.T) {
28+
t.Parallel()
29+
2630
data := []struct {
2731
in string
2832
out bool

decimal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ func marshalDecimal(b io.StringWriter, d float64) error {
2121
const TH = 0.001
2222

2323
rounded := math.RoundToEven(d/TH) * TH
24-
int, frac := math.Modf(math.RoundToEven(d/TH) * TH)
24+
i, frac := math.Modf(math.RoundToEven(d/TH) * TH)
2525

26-
if int < -999999999999 || int > 999999999999 {
26+
if i < -999999999999 || i > 999999999999 {
2727
return ErrInvalidDecimal
2828
}
2929

decimal_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
)
77

88
func TestDecimalMarshalSFV(t *testing.T) {
9+
t.Parallel()
10+
911
data := []struct {
1012
in float64
1113
expected string

decode_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package httpsfv
33
import "testing"
44

55
func TestDecodeError(t *testing.T) {
6+
t.Parallel()
7+
68
_, err := UnmarshalItem([]string{"invalid-é"})
79

810
if err.Error() != "unmarshal error: character 8" {

dictionary_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
)
88

99
func TestDictionnary(t *testing.T) {
10+
t.Parallel()
11+
1012
dict := NewDictionary()
1113

1214
add := []struct {
@@ -67,8 +69,7 @@ func TestDictionnary(t *testing.T) {
6769
t.Errorf(`Get("notexist") = %v, %v; nil, false expected`, v, ok)
6870
}
6971

70-
k := dict.Names()
71-
if len(k) != 5 {
72+
if k := dict.Names(); len(k) != 5 {
7273
t.Errorf(`Names() = %v; {"f_o1o3-", "*f0.o*"} expected`, k)
7374
}
7475

@@ -85,6 +86,8 @@ func TestDictionnary(t *testing.T) {
8586
}
8687

8788
func TestUnmarshalDictionary(t *testing.T) {
89+
t.Parallel()
90+
8891
d1 := NewDictionary()
8992
d1.Add("a", NewItem(false))
9093
d1.Add("b", NewItem(true))

encode_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package httpsfv
33
import "testing"
44

55
func TestMarshal(t *testing.T) {
6+
t.Parallel()
7+
68
i := NewItem(22.1)
79
i.Params.Add("foo", true)
810
i.Params.Add("bar", Token("baz"))
@@ -14,13 +16,14 @@ func TestMarshal(t *testing.T) {
1416
tok.Params.Add("a", "b")
1517
d.Add("tok", tok)
1618

17-
res, _ := Marshal(d)
18-
if res != `i=22.1;foo;bar=baz, tok=foo;a="b"` {
19+
if res, _ := Marshal(d); res != `i=22.1;foo;bar=baz, tok=foo;a="b"` {
1920
t.Errorf("marshal: bad result")
2021
}
2122
}
2223

2324
func TestMarshalError(t *testing.T) {
25+
t.Parallel()
26+
2427
if _, err := Marshal(NewItem(Token("à"))); err == nil {
2528
t.Errorf("marshal: error expected")
2629
}

httpwg_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ func valToDictionary(e interface{}) *Dictionary {
135135
}
136136

137137
func TestOfficialTestSuiteParsing(t *testing.T) {
138+
t.Parallel()
139+
138140
const dir = "structured-field-tests/"
139141
f, _ := os.Open(dir)
140142
files, _ := f.Readdir(-1)
@@ -245,6 +247,8 @@ func BenchmarkSerializingOfficialExamples(b *testing.B) {
245247
}
246248

247249
func TestOfficialTestSuiteSerialization(t *testing.T) {
250+
t.Parallel()
251+
248252
const dir = "structured-field-tests/serialisation-tests/"
249253

250254
f, _ := os.Open(dir)

0 commit comments

Comments
 (0)