Skip to content

Commit b4160e1

Browse files
committed
fix: Address linter rules after golangci-lint upgrade
1 parent 006d634 commit b4160e1

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

.golangci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ linters-settings:
6464
min-len: 10
6565
# minimal occurrences count to trigger, 3 by default
6666
min-occurrences: 3
67-
depguard:
68-
list-type: blacklist
69-
include-go-root: false
70-
packages:
71-
- github.com/satori/go.uuid
7267

7368
# packages-with-error-messages:
7469
# specify an error message to output when a blacklisted package is used
@@ -154,6 +149,8 @@ linters:
154149
- godot
155150
- nlreturn
156151

152+
- depguard
153+
157154
# These are apparently deprecated but still yell at you if you don't disable them
158155
- golint
159156
- scopelint

core.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (a *Asserter) pathassertf(path, act, exp string) {
3838
a.tt.Errorf("actual JSON (%s) and expected JSON (%s) were of different types at '%s'", actType, expType, path)
3939
return
4040
}
41-
switch actType { // nolint:exhaustive // already know it's valid JSON and not null
41+
switch actType { //nolint:exhaustive // already know it's valid JSON and not null
4242
case jsonBoolean:
4343
actBool, _ := extractBoolean(act)
4444
expBool, _ := extractBoolean(exp)
@@ -63,7 +63,7 @@ func (a *Asserter) pathassertf(path, act, exp string) {
6363
}
6464

6565
func serialize(a interface{}) string {
66-
// nolint:errchkjson // Can be confident this won't return an error: the
66+
//nolint:errchkjson // Can be confident this won't return an error: the
6767
// input will be a nested part of valid JSON, thus valid JSON
6868
bytes, _ := json.Marshal(a)
6969
return string(bytes)

examples_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ func (p *printer) Errorf(format string, args ...interface{}) {
1313
}
1414

1515
// using the varible name 't' to mimic a *testing.T variable
16-
// nolint:gochecknoglobals // this is global to make the examples look like valid test code
16+
//
17+
//nolint:gochecknoglobals // this is global to make the examples look like valid test code
1718
var t *printer
1819

1920
func ExampleNew() {

exports.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ you only need one *jsonassert.Asseter per (sub)test.
6464
In most cases, this will look something like
6565
6666
ja := jsonassert.New(t)
67-
6867
*/
6968
func New(p Printer) *Asserter {
7069
// Initially this package was written without the assumption that the

helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ func (*noopHelperTT) Helper() {
1818
// e.g. to verify where one potential candidate is matching or not.
1919
type deepEqualityPrinter struct{ count int }
2020

21-
func (p *deepEqualityPrinter) Errorf(msg string, args ...interface{}) { p.count++ }
22-
func (p *deepEqualityPrinter) Helper() { /* Intentional NOOP */ }
21+
func (p *deepEqualityPrinter) Errorf(_ string, _ ...interface{}) { p.count++ }
22+
func (p *deepEqualityPrinter) Helper() { /* Intentional NOOP */ }
2323

2424
func (a *Asserter) deepEqual(act, exp interface{}) bool {
2525
p := &deepEqualityPrinter{count: 0}

integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ type testCase struct {
460460

461461
func (tc *testCase) check(t *testing.T) {
462462
t.Helper()
463-
tp := &testPrinter{}
463+
tp := &testPrinter{messages: nil}
464464
jsonassert.New(tp).Assertf(tc.act, tc.exp)
465465

466466
if got := len(tp.messages); got != len(tc.msgs) {

number.go

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

88
// This is *probably* good enough. Can change this to be even smaller if necessary
9-
const minDiff = 0.000001
10-
const bitSize = 64
9+
const (
10+
minDiff = 0.000001
11+
bitSize = 64
12+
)
1113

1214
func (a *Asserter) checkNumber(path string, act, exp float64) {
1315
a.tt.Helper()

0 commit comments

Comments
 (0)