File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ func (o *Options) SetDefaults() {
3131 if o .ShouldInclude == nil {
3232 o .ShouldInclude = func (reflect.Method ) bool { return true }
3333 }
34+ if o .ExtraImports == nil {
35+ o .ExtraImports = func (reflect.Method ) []string { return nil }
36+ }
3437}
3538
3639type Option func (* Options )
Original file line number Diff line number Diff line change @@ -41,9 +41,12 @@ type InterfacesClient interface {
4141
4242func TestGenerate (t * testing.T ) {
4343 dir := t .TempDir ()
44- err := Generate ([]any {& Client {}}, dir , WithIncludeFunc (func (m reflect.Method ) bool {
45- return MethodHasAnyPrefix (m , []string {"List" }) && MethodHasAnySuffix (m , []string {"Tables" })
46- }))
44+ err := Generate ([]any {& Client {}}, dir ,
45+ WithIncludeFunc (func (m reflect.Method ) bool {
46+ return MethodHasAnyPrefix (m , []string {"List" }) && MethodHasAnySuffix (m , []string {"Tables" })
47+ }),
48+ WithExtraImports (func (m reflect.Method ) []string { return []string {"net/http" } },
49+ ))
4750 if err != nil {
4851 t .Fatalf ("unexpected error: %v" , err )
4952 }
You can’t perform that action at this time.
0 commit comments