Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable gofumpt linter; clean up formatting #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ linters:
- "revive"
- "goconst"
- "unparam"
- "gofmt"
- "gofumpt"

linters-settings:
staticcheck:
Expand Down
2 changes: 1 addition & 1 deletion each_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestEach(t *testing.T) {
var a *int
var f = func(v string) string { return v }
f := func(v string) string { return v }
var c0 chan int
c1 := make(chan int)

Expand Down
4 changes: 2 additions & 2 deletions in_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestIn(t *testing.T) {
var v = 1
v := 1
var v2 *int
tests := []struct {
tag string
Expand All @@ -38,7 +38,7 @@ func TestIn(t *testing.T) {
}

func TestIn_Generics(t *testing.T) {
var v = "a"
v := "a"
var v2 *string
tests := []struct {
tag string
Expand Down
1 change: 0 additions & 1 deletion minmax.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func Min(min interface{}) ThresholdRule {
operator: greaterEqualThan,
err: ErrMinGreaterEqualThanRequired,
}

}

// Max returns a validation rule that checks if a value is less or equal than the specified value.
Expand Down
1 change: 0 additions & 1 deletion multipleof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestMultipleOf(t *testing.T) {
assert.Equal(t, "must be multiple of 10", r3.Validate(uint(11)).Error())
assert.Equal(t, nil, r3.Validate(uint(20)))
assert.Equal(t, "cannot convert float32 to uint64", r3.Validate(float32(20)).Error())

}

func Test_MultipleOf_Error(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions not_in_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func TestNotIn(t *testing.T) {
v := 1
var v2 *int
var tests = []struct {
tests := []struct {
tag string
values []interface{}
value interface{}
Expand All @@ -39,7 +39,7 @@ func TestNotIn(t *testing.T) {
func TestNotIn_Ints(t *testing.T) {
v := 1
var v2 *int
var tests = []struct {
tests := []struct {
tag string
values []int
value any
Expand Down
6 changes: 2 additions & 4 deletions struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import (
"strings"
)

var (
// ErrStructPointer is the error that a struct being validated is not specified as a pointer.
ErrStructPointer = errors.New("only a pointer to a struct can be validated")
)
// ErrStructPointer is the error that a struct being validated is not specified as a pointer.
var ErrStructPointer = errors.New("only a pointer to a struct can be validated")

type (
// ErrFieldPointer is the error that a field is not specified as a pointer.
Expand Down
2 changes: 1 addition & 1 deletion struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func TestValidateStructWithContext(t *testing.T) {
assertError(t, test.err, err, test.tag)
}

//embedded struct
// embedded struct
err := ValidateWithContext(context.Background(), &m3)
if assert.NotNil(t, err) {
assert.Equal(t, "A: error abc.", err.Error())
Expand Down
4 changes: 2 additions & 2 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestToFloat(t *testing.T) {

func TestIsEmpty(t *testing.T) {
var s1 string
var s2 = "a"
s2 := "a"
var s3 *string
s4 := struct{}{}
time1 := time.Now()
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestIsEmpty(t *testing.T) {
}

func TestIndirect(t *testing.T) {
var a = 100
a := 100
var b *int
var c *sql.NullInt64

Expand Down