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..22bed5b 100644 --- a/pkg/moq/testpackages/generics/generics.go +++ b/pkg/moq/testpackages/generics/generics.go @@ -5,26 +5,32 @@ 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] +// Key1 is a test interface. type Key1 interface { fmt.Stringer } +// Key2 is a test interface. type Key2 interface { ~[]byte | string } +// KeyImpl is a test type. type KeyImpl []byte func (x KeyImpl) String() string { diff --git a/pkg/moq/testpackages/genparamname/iface.go b/pkg/moq/testpackages/genparamname/iface.go index 2ceaf45..83e3272 100644 --- a/pkg/moq/testpackages/genparamname/iface.go +++ b/pkg/moq/testpackages/genparamname/iface.go @@ -12,10 +12,13 @@ import ( ) type ( - Go func() + // Go is a test function. + Go func() + myType struct{} ) +// Interface is a test interface. type Interface interface { Method( *myType, diff --git a/pkg/moq/testpackages/importalias/middleman.go b/pkg/moq/testpackages/importalias/middleman.go index 831394f..b012307 100644 --- a/pkg/moq/testpackages/importalias/middleman.go +++ b/pkg/moq/testpackages/importalias/middleman.go @@ -5,6 +5,7 @@ import ( tgtclient "github.com/matryer/moq/pkg/moq/testpackages/importalias/target/client" ) +// MiddleMan is a test interface. type MiddleMan interface { Connect(src srcclient.Client, tgt tgtclient.Client) } diff --git a/pkg/moq/testpackages/importalias/source/client/src_client.go b/pkg/moq/testpackages/importalias/source/client/src_client.go index 54cf8ad..78598dd 100644 --- a/pkg/moq/testpackages/importalias/source/client/src_client.go +++ b/pkg/moq/testpackages/importalias/source/client/src_client.go @@ -1,3 +1,4 @@ package client +// Client is a test struct. type Client struct{} diff --git a/pkg/moq/testpackages/importalias/target/client/tgt_client.go b/pkg/moq/testpackages/importalias/target/client/tgt_client.go index 54cf8ad..78598dd 100644 --- a/pkg/moq/testpackages/importalias/target/client/tgt_client.go +++ b/pkg/moq/testpackages/importalias/target/client/tgt_client.go @@ -1,3 +1,4 @@ package client +// Client is a test struct. type Client struct{} diff --git a/pkg/moq/testpackages/paramconflict/iface.go b/pkg/moq/testpackages/paramconflict/iface.go index b02e5fd..e4829fd 100644 --- a/pkg/moq/testpackages/paramconflict/iface.go +++ b/pkg/moq/testpackages/paramconflict/iface.go @@ -2,6 +2,7 @@ package paramconflict import "time" +// Interface is a test interface. type Interface interface { Method(string, bool, string, bool, int, int32, int64, float32, float64, time.Time, time.Time) } diff --git a/pkg/moq/testpackages/shadow/http/thing.go b/pkg/moq/testpackages/shadow/http/thing.go index 5d4c621..7bbd5e2 100644 --- a/pkg/moq/testpackages/shadow/http/thing.go +++ b/pkg/moq/testpackages/shadow/http/thing.go @@ -2,6 +2,7 @@ package http import "net/http" +// Thing is a test interface. type Thing interface { Blah(w http.ResponseWriter, r *http.Request) }