Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
mehran-prs committed Dec 27, 2019
1 parent b35b626 commit b8c4f4e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/aggregate/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

func TestLookup(t *testing.T) {
if err:=lookup();err!=nil{
if err := lookup(); err != nil {
panic(err)
}
//require.Nil(t, lookup())
Expand Down
1 change: 0 additions & 1 deletion examples/aggregate/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ import (
func init() {
_ = mgm.SetDefaultConfig(nil, "mgm_lab", options.Client().ApplyURI("mongodb://root:12345@localhost:27017"))
}

6 changes: 3 additions & 3 deletions field/pipeline_stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const (

var (
// EmptyDoc is empty document.
EmptyDoc = bson.M{}
EmptyDoc = bson.M{}

// AllUsersDoc is document that contains "allUsers":true value.
AllUsersDoc = bson.M{AllUsers: true}
Expand All @@ -87,8 +87,8 @@ const (
ForeignField = "foreignField"
// As = "as" // Declared

Let = "let"
Pipeline = "pipeline"
Let = "let"
Pipeline = "pipeline"
)

// $merge
Expand Down
1 change: 0 additions & 1 deletion internal/util/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ func ToSnakeCase(str string) string {
snake = matchAllCap.ReplaceAllString(snake, "${1}_${2}")
return strings.ToLower(snake)
}

2 changes: 0 additions & 2 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"reflect"
)


// PanicErr panic passed error if it's not nil.
func PanicErr(err error) {
if err != nil && !reflect.ValueOf(err).IsNil() {
panic(err)
}
}

2 changes: 1 addition & 1 deletion util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestGetModelCollection(t *testing.T) {
doc := &Doc{}
coll := mgm.Coll(doc)
name := mgm.CollName(doc)
require.Equal(t, coll.Name(), name, "Expected doc's collection , got %v", )
require.Equal(t, coll.Name(), name, "Expected doc's collection , got %v")
}

func TestGetDefaultCollName(t *testing.T) {
Expand Down

0 comments on commit b8c4f4e

Please sign in to comment.