diff --git a/internal/template/template_data.go b/internal/template/template_data.go index 2a3caeb..eb39fc9 100644 --- a/internal/template/template_data.go +++ b/internal/template/template_data.go @@ -90,6 +90,7 @@ func (m MethodData) ReturnArgNameList() string { return strings.Join(params, ", ") } +// TypeParamData extends ParamData with a constraint. type TypeParamData struct { ParamData Constraint types.Type diff --git a/pkg/moq/testpackages/anonimport/iface.go b/pkg/moq/testpackages/anonimport/iface.go index a56856a..12dbd1d 100644 --- a/pkg/moq/testpackages/anonimport/iface.go +++ b/pkg/moq/testpackages/anonimport/iface.go @@ -4,6 +4,7 @@ import ( "context" ) +// Example is a test interface. type Example interface { Ctx(ctx context.Context) } diff --git a/pkg/moq/testpackages/anonimport/second_file.go b/pkg/moq/testpackages/anonimport/second_file.go index c4cadf2..028ec63 100644 --- a/pkg/moq/testpackages/anonimport/second_file.go +++ b/pkg/moq/testpackages/anonimport/second_file.go @@ -1,5 +1,5 @@ package anonimport import ( - _ "context" + _ "context" // import for side effects ) diff --git a/pkg/moq/testpackages/blankid/swallower.go b/pkg/moq/testpackages/blankid/swallower.go index 7d73d7b..1fe3d31 100644 --- a/pkg/moq/testpackages/blankid/swallower.go +++ b/pkg/moq/testpackages/blankid/swallower.go @@ -1,5 +1,6 @@ package blankid +// Swallower is a test interface. type Swallower interface { Swallow(_ string) } diff --git a/pkg/moq/testpackages/genericreturn/genericreturn.go b/pkg/moq/testpackages/genericreturn/genericreturn.go index da23042..e0fad2b 100644 --- a/pkg/moq/testpackages/genericreturn/genericreturn.go +++ b/pkg/moq/testpackages/genericreturn/genericreturn.go @@ -2,10 +2,12 @@ package genericreturn import "github.com/matryer/moq/pkg/moq/testpackages/genericreturn/otherpackage" +// GenericFoo is a test type. type GenericBar[T any] struct { Bar T } +// IFooBar is a test interface. type IFooBar interface { Foobar() GenericBar[otherpackage.Foo] } diff --git a/pkg/moq/testpackages/genericreturn/otherpackage/otherpackage.go b/pkg/moq/testpackages/genericreturn/otherpackage/otherpackage.go index e755f52..241acbc 100644 --- a/pkg/moq/testpackages/genericreturn/otherpackage/otherpackage.go +++ b/pkg/moq/testpackages/genericreturn/otherpackage/otherpackage.go @@ -1,5 +1,6 @@ package otherpackage +// Foo is a test struct. type Foo struct { A int B string diff --git a/pkg/moq/testpackages/generics/generics.go b/pkg/moq/testpackages/generics/generics.go index 9e7a82c..3cc0c06 100644 --- a/pkg/moq/testpackages/generics/generics.go +++ b/pkg/moq/testpackages/generics/generics.go @@ -5,16 +5,19 @@ import ( "fmt" ) +// GenericStore1 is a test interface. type GenericStore1[T Key1, S any] interface { Get(ctx context.Context, id T) (S, error) Create(ctx context.Context, id T, value S) error } +// GenericStore2 is a test interface. type GenericStore2[T Key2, S any] interface { Get(ctx context.Context, id T) (S, error) Create(ctx context.Context, id T, value S) error } +// AliasStore is a test interface. type AliasStore GenericStore1[KeyImpl, bool] type Key1 interface {