diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index f57c11a..0000000 --- a/.codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -ignore: - - "cmd" - - "internal" diff --git a/Makefile b/Makefile index a24bb2d..87174b5 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ lint: --skip-files data_test.go \ --exclude-use-default=false \ --exclude=package-comments \ + --exclude=unused-parameter \ --enable=errcheck \ --enable=goimports \ --enable=ineffassign \ diff --git a/cmd/elegen/templates/model.gotpl b/cmd/elegen/templates/model.gotpl index 06fbfb3..fe574c7 100644 --- a/cmd/elegen/templates/model.gotpl +++ b/cmd/elegen/templates/model.gotpl @@ -54,8 +54,8 @@ func (o {{ .Spec.Model.EntityNamePlural }}List) Identity() elemental.Identity { // Copy returns a pointer to a copy the {{ .Spec.Model.EntityNamePlural }}List. func (o {{ .Spec.Model.EntityNamePlural }}List) Copy() elemental.Identifiables { - copy := append({{ .Spec.Model.EntityNamePlural }}List{}, o...) - return © + out := append({{ .Spec.Model.EntityNamePlural }}List{}, o...) + return &out } // Append appends the objects to the a new copy of the {{ .Spec.Model.EntityNamePlural }}List. diff --git a/data_test.go b/data_test.go index 8cd186c..bf76a29 100644 --- a/data_test.go +++ b/data_test.go @@ -9,6 +9,7 @@ import ( ) //lint:file-ignore U1000 auto generated code. + // ListIdentity represents the Identity of the object. var ListIdentity = Identity{ Name: "list", @@ -29,8 +30,8 @@ func (o ListsList) Identity() Identity { // Copy returns a pointer to a copy the ListsList. func (o ListsList) Copy() Identifiables { - copy := append(ListsList{}, o...) - return © + out := append(ListsList{}, o...) + return &out } // Append appends the objects to the a new copy of the ListsList. @@ -1069,6 +1070,7 @@ type mongoAttributesSparseList struct { Slice *[]string `bson:"slice,omitempty"` Unexposed *string `bson:"unexposed,omitempty"` } + // TaskStatusValue represents the possible values for attribute "status". type TaskStatusValue string @@ -1103,8 +1105,8 @@ func (o TasksList) Identity() Identity { // Copy returns a pointer to a copy the TasksList. func (o TasksList) Copy() Identifiables { - copy := append(TasksList{}, o...) - return © + out := append(TasksList{}, o...) + return &out } // Append appends the objects to the a new copy of the TasksList. @@ -1888,8 +1890,6 @@ type mongoAttributesSparseTask struct { ParentType *string `bson:"parenttype,omitempty"` Status *TaskStatusValue `bson:"status,omitempty"` } - -// UnmarshalableListIdentity represents the Identity of the object. var UnmarshalableListIdentity = Identity{Name: "list", Category: "lists"} // UnmarshalableListsList represents a list of UnmarshalableLists @@ -1904,8 +1904,8 @@ func (o UnmarshalableListsList) Identity() Identity { // Copy returns a pointer to a copy the UnmarshalableListsList. func (o UnmarshalableListsList) Copy() Identifiables { - copy := append(UnmarshalableListsList{}, o...) - return © + out := append(UnmarshalableListsList{}, o...) + return &out } // Append appends the objects to the a new copy of the UnmarshalableListsList. @@ -2004,6 +2004,7 @@ func (o *UnmarshalableError) UnmarshalMsgpack([]byte) error { func (o *UnmarshalableError) MarshalMsgpack() ([]byte, error) { return nil, fmt.Errorf("error marshalling") } + // UserIdentity represents the Identity of the object. var UserIdentity = Identity{ Name: "user", @@ -2024,8 +2025,8 @@ func (o UsersList) Identity() Identity { // Copy returns a pointer to a copy the UsersList. func (o UsersList) Copy() Identifiables { - copy := append(UsersList{}, o...) - return © + out := append(UsersList{}, o...) + return &out } // Append appends the objects to the a new copy of the UsersList. @@ -2863,6 +2864,7 @@ type mongoAttributesSparseUser struct { ParentType *string `bson:"parenttype,omitempty"` UserName *string `bson:"username,omitempty"` } + // Root represents the model of a root type Root struct { ModelVersion int `json:"-" msgpack:"-" bson:"_modelversion"` @@ -3028,6 +3030,7 @@ var RootLowerCaseAttributesMap = map[string]AttributeSpecification{} type mongoAttributesRoot struct { } + var ( identityNamesMap = map[string]Identity{ "list": ListIdentity, diff --git a/encoding_test.go b/encoding_test.go index 9dd1991..bc89215 100644 --- a/encoding_test.go +++ b/encoding_test.go @@ -152,8 +152,8 @@ func TestMakeStreamEncoderDecoder(t *testing.T) { Convey("Given I have a bunch of json lines and a stream decoder", t, func() { data := bytes.NewBuffer(nil) - encoder, eclose := MakeStreamEncoder(EncodingTypeJSON, data) - defer eclose() + encoder, closeFunc1 := MakeStreamEncoder(EncodingTypeJSON, data) + defer closeFunc1() if err := encoder(&List{Name: "1"}); err != nil { panic(err) @@ -162,8 +162,8 @@ func TestMakeStreamEncoderDecoder(t *testing.T) { panic(err) } - decoder, close := MakeStreamDecoder(EncodingTypeJSON, data) - defer close() + decoder, closeFunc2 := MakeStreamDecoder(EncodingTypeJSON, data) + defer closeFunc2() Convey("Decoding once should work", func() { @@ -202,8 +202,8 @@ func TestMakeStreamEncoderDecoder(t *testing.T) { Convey("Given I have a bunch of msgpack lines and a stream decoder", t, func() { data := bytes.NewBuffer(nil) - encoder, eclose := MakeStreamEncoder(EncodingTypeMSGPACK, data) - defer eclose() + encoder, closeFunc1 := MakeStreamEncoder(EncodingTypeMSGPACK, data) + defer closeFunc1() if err := encoder(&List{Name: "1"}); err != nil { panic(err) @@ -212,8 +212,8 @@ func TestMakeStreamEncoderDecoder(t *testing.T) { panic(err) } - decoder, close := MakeStreamDecoder(EncodingTypeMSGPACK, data) - defer close() + decoder, closeFunc2 := MakeStreamDecoder(EncodingTypeMSGPACK, data) + defer closeFunc2() Convey("Decoding once should work", func() { diff --git a/test/gen.sh b/test/gen.sh index 94465e5..d8f6d1c 100755 --- a/test/gen.sh +++ b/test/gen.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" || exit 1 +cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit 1 elegen folder -d ../../regolithe/spec/tests || exit 1 @@ -22,13 +22,15 @@ import ( //lint:file-ignore U1000 auto generated code. EOF { - tail -n +12 model/list.go; - tail -n +11 model/task.go; - tail -n +19 model/unmarshalable.go; - tail -n +11 model/user.go; - tail -n +19 model/root.go; - tail -n +5 model/identities_registry.go; - tail -n +4 model/relationships_registry.go; -}>> ../data_test.go - -sed -i '' 's/elemental\.//g' ../data_test.go + tail -n +14 model/list.go + tail -n +13 model/task.go + tail -n +21 model/unmarshalable.go + tail -n +13 model/user.go + tail -n +21 model/root.go + tail -n +7 model/identities_registry.go + tail -n +7 model/relationships_registry.go +} >>../data_test.go + +sed 's/elemental\.//g' ../data_test.go >../data_test.go.new +mv ../data_test.go.new ../data_test.go +rm -f ../data_test.go.new diff --git a/test/model/identities_registry.go b/test/model/identities_registry.go index b55451d..4ecf9c7 100644 --- a/test/model/identities_registry.go +++ b/test/model/identities_registry.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/identities_registry.gotpl) + package testmodel import "go.aporeto.io/elemental" diff --git a/test/model/list.go b/test/model/list.go index fde693b..9974e99 100644 --- a/test/model/list.go +++ b/test/model/list.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/model.gotpl) + package testmodel import ( @@ -29,8 +32,8 @@ func (o ListsList) Identity() elemental.Identity { // Copy returns a pointer to a copy the ListsList. func (o ListsList) Copy() elemental.Identifiables { - copy := append(ListsList{}, o...) - return © + out := append(ListsList{}, o...) + return &out } // Append appends the objects to the a new copy of the ListsList. diff --git a/test/model/relationships_registry.go b/test/model/relationships_registry.go index f0bf7e7..82dd0f9 100644 --- a/test/model/relationships_registry.go +++ b/test/model/relationships_registry.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/relationships_registry.gotpl) + package testmodel import "go.aporeto.io/elemental" diff --git a/test/model/root.go b/test/model/root.go index d53bbb1..21c9835 100644 --- a/test/model/root.go +++ b/test/model/root.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/model.gotpl) + package testmodel import ( diff --git a/test/model/task.go b/test/model/task.go index ef1d6b3..3244558 100644 --- a/test/model/task.go +++ b/test/model/task.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/model.gotpl) + package testmodel import ( @@ -42,8 +45,8 @@ func (o TasksList) Identity() elemental.Identity { // Copy returns a pointer to a copy the TasksList. func (o TasksList) Copy() elemental.Identifiables { - copy := append(TasksList{}, o...) - return © + out := append(TasksList{}, o...) + return &out } // Append appends the objects to the a new copy of the TasksList. diff --git a/test/model/unmarshalable.go b/test/model/unmarshalable.go index edca540..396ed32 100644 --- a/test/model/unmarshalable.go +++ b/test/model/unmarshalable.go @@ -32,8 +32,8 @@ func (o UnmarshalableListsList) Identity() elemental.Identity { // Copy returns a pointer to a copy the UnmarshalableListsList. func (o UnmarshalableListsList) Copy() elemental.Identifiables { - copy := append(UnmarshalableListsList{}, o...) - return © + out := append(UnmarshalableListsList{}, o...) + return &out } // Append appends the objects to the a new copy of the UnmarshalableListsList. diff --git a/test/model/user.go b/test/model/user.go index 3803747..690a159 100644 --- a/test/model/user.go +++ b/test/model/user.go @@ -1,3 +1,6 @@ +// Code generated by elegen. DO NOT EDIT. +// Source: go.aporeto.io/elemental (templates/model.gotpl) + package testmodel import ( @@ -28,8 +31,8 @@ func (o UsersList) Identity() elemental.Identity { // Copy returns a pointer to a copy the UsersList. func (o UsersList) Copy() elemental.Identifiables { - copy := append(UsersList{}, o...) - return © + out := append(UsersList{}, o...) + return &out } // Append appends the objects to the a new copy of the UsersList. diff --git a/verify.go b/verify.go index f7e1202..4f2dcc7 100644 --- a/verify.go +++ b/verify.go @@ -135,6 +135,7 @@ func ResetMaps(v reflect.Value) { indirect := func(vv reflect.Value) reflect.Value { for ; vv.Kind() == reflect.Ptr; vv = vv.Elem() { + _ = vv // this makes the linter happy as the loop is not empty } return vv }