Skip to content

Commit

Permalink
minor: go fmt + goimports
Browse files Browse the repository at this point in the history
  • Loading branch information
amberpixels committed Sep 14, 2024
1 parent fce45c0 commit b380c10
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 22 deletions.
4 changes: 2 additions & 2 deletions be_string/matchers_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func Only(option StringOption) types.BeMatcher {
options := ExtractStringOptions(option)

// We need stringified version of all options for the failure message
optionsStr := make([]string, len(options), len(options))
optionsStr := make([]string, len(options))
for i := range options {
optionsStr[i] = options[i].String()
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func ValidEmail() types.BeMatcher {
return psiString(func(actual any) (bool, error) {
_, err := mail.ParseAddress(cast.AsString(actual))
return err == nil, nil
}, fmt.Sprintf("be a valid email"))
}, "be a valid email")
}

//
Expand Down
3 changes: 2 additions & 1 deletion be_time/matchers_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package be_time

import (
"fmt"
"time"

"github.com/expectto/be/internal/cast"
. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega"
"github.com/onsi/gomega/gcustom"
"time"
)

// LaterThan succeeds if actual time is later than the specified time `compareTo`.
Expand Down
3 changes: 2 additions & 1 deletion be_time/matchers_time_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package be_time_test

import (
"time"

"github.com/expectto/be/be_time"
"github.com/expectto/be/types"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"time"
)

// TimeFormat used for tests is selected to be 1) allmighty 2) more readable
Expand Down
3 changes: 2 additions & 1 deletion be_url/matchers_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
package be_url

import (
"net/url"

"github.com/expectto/be/internal/cast"
. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/internal/psi_matchers"
"github.com/expectto/be/types"
"github.com/onsi/gomega"
"net/url"
)

// TransformUrlFromString returns string->*url.Url transform
Expand Down
1 change: 1 addition & 0 deletions examples/examples_be_ctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package examples

import (
"context"

"github.com/expectto/be/be_ctx"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
3 changes: 2 additions & 1 deletion examples/examples_be_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package examples

import (
"bytes"
"net/http"

"github.com/expectto/be"
"github.com/expectto/be/be_http"
"github.com/expectto/be/be_json"
Expand All @@ -11,7 +13,6 @@ import (
"github.com/expectto/be/be_url"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"net/http"
)

var _ = Describe("matchers_http", func() {
Expand Down
3 changes: 2 additions & 1 deletion examples/examples_be_url_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package examples_test

import (
"net/url"

"github.com/expectto/be/be_json"
"github.com/expectto/be/be_reflected"
"github.com/expectto/be/be_url"
"github.com/expectto/be/internal/testing/mocks"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"
"net/url"
)

var _ = Describe("Examples on matching URL", func() {
Expand Down
1 change: 1 addition & 0 deletions internal/cast/as_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cast_test

import (
"encoding/json"

"github.com/expectto/be/internal/cast"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
3 changes: 2 additions & 1 deletion internal/psi/from-gomega.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package psi

import (
"fmt"
"github.com/expectto/be/types"
"regexp"
"strings"

"github.com/expectto/be/types"
)

func FromGomega(omega types.GomegaMatcher, messagePrefixArg ...string) types.BeMatcher {
Expand Down
3 changes: 2 additions & 1 deletion internal/psi/psi.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
package psi

import (
"strings"

"github.com/expectto/be/types"
"github.com/onsi/gomega/gcustom"
"strings"
)

// Psi is a main converter function that converts given input into a PsiMatcher
Expand Down
1 change: 1 addition & 0 deletions internal/psi_matchers/all_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package psi_matchers

import (
"fmt"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
Expand Down
1 change: 1 addition & 0 deletions internal/psi_matchers/any_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package psi_matchers

import (
"fmt"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"

Expand Down
3 changes: 2 additions & 1 deletion internal/psi_matchers/assignable_to_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package psi_matchers

import (
"fmt"
"reflect"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"reflect"
)

type AssignableToMatcher struct {
Expand Down
1 change: 1 addition & 0 deletions internal/psi_matchers/ctx_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package psi_matchers
import (
"context"
"fmt"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
Expand Down
3 changes: 2 additions & 1 deletion internal/psi_matchers/eq_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package psi_matchers
import (
"bytes"
"fmt"
"reflect"

"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"reflect"
)

type EqMatcher struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/psi_matchers/have_length_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package psi_matchers

import (
"fmt"
"strings"

"github.com/expectto/be/internal/cast"
. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/internal/reflect"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"strings"
)

// HaveLengthMatcher is an Omega-format matcher that matches length of the given list
Expand Down
3 changes: 2 additions & 1 deletion internal/psi_matchers/implements_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package psi_matchers

import (
"fmt"
"reflect"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"reflect"
)

type ImplementsMatcher struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/psi_matchers/jwt_token_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package psi_matchers

import (
"fmt"
"strings"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/golang-jwt/jwt/v5"
"github.com/onsi/gomega/format"
"strings"
)

type JwtTokenMatcher struct {
Expand Down
5 changes: 3 additions & 2 deletions internal/psi_matchers/kind_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package psi_matchers

import (
"fmt"
"reflect"
"strings"

"github.com/expectto/be/internal/cast"
. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"reflect"
"strings"
)

//
Expand Down
5 changes: 3 additions & 2 deletions internal/psi_matchers/request_property_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package psi_matchers

import (
"fmt"
"net/http"
"strings"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"net/http"
"strings"
)

// ReqPropertyMatcher is a matcher for http.Request properties
Expand Down
5 changes: 3 additions & 2 deletions internal/psi_matchers/string_template_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package psi_matchers

import (
"fmt"
"regexp"
"strings"

"github.com/expectto/be/internal/cast"
. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"regexp"
"strings"
)

type Value struct {
Expand Down
5 changes: 3 additions & 2 deletions internal/psi_matchers/url_field_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package psi_matchers

import (
"fmt"
"net/url"
"strings"

. "github.com/expectto/be/internal/psi"
"github.com/expectto/be/types"
"github.com/onsi/gomega/format"
"net/url"
"strings"
)

// UrlFieldMatcher is a helper for matching url fields
Expand Down

0 comments on commit b380c10

Please sign in to comment.