Skip to content

Commit e0999c2

Browse files
userzimmermanngithub-actions[bot]
authored andcommitted
Auto-fix from Linting / lint job
1 parent 0147e8a commit e0999c2

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

pointer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
// // if not nil => panic: assertion failed: My value should be a nil pointer
3131
func NilPtr[T any](name string, value *T) *T {
3232
lo.Assertf(value == nil, "%s should be a nil pointer", name)
33+
3334
return value
3435
}
3536

@@ -42,9 +43,10 @@ func NilPtr[T any](name string, value *T) *T {
4243
// // if nil => panic: assertion failed: My value should not be a nil pointer
4344
func NotNilPtr[T any](name string, value *T) *T {
4445
lo.Assertf(value != nil, "%s should not be a nil pointer", name)
46+
4547
return value
4648
}
4749

48-
// bla
50+
// bla.
4951
func _() {
5052
}

pointer_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ func TestNilPtr(t *testing.T) {
1010
t.Parallel()
1111
t.Run("should accept nil pointer & return nil", func(t *testing.T) {
1212
t.Parallel()
13+
1314
var nilPtr *int
1415
assert.Nil(t, NilPtr("Test pointer", nilPtr))
1516
})
@@ -48,15 +49,18 @@ func TestNotNilPtr(t *testing.T) {
4849

4950
func BenchmarkNilPtr(b *testing.B) {
5051
b.ResetTimer()
52+
5153
for range b.N {
5254
NilPtr("Benchmark pointer", (*int)(nil))
5355
}
5456
}
5557

5658
func BenchmarkNotNilPtr(b *testing.B) {
5759
value := "benchmark"
60+
5861
b.ResetTimer()
59-
for i := 0; i < b.N; i++ {
62+
63+
for range b.N {
6064
NotNilPtr("Benchmark pointer", &value)
6165
}
6266
}

0 commit comments

Comments
 (0)