Skip to content

Commit

Permalink
Add back replace-types
Browse files Browse the repository at this point in the history
Per #864
  • Loading branch information
LandonTClipp committed Jan 20, 2025
1 parent 85c4718 commit 1d437a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ type Config struct {
MockName *string `koanf:"mockname"`
PkgName *string `koanf:"pkgname"`
Recursive *bool `koanf:"recursive"`
ReplaceType []string `koanf:"replace-type"`
Template *string `koanf:"template"`
TemplateData map[string]any `koanf:"template-data"`
UnrollVariadic *bool `koanf:"unroll-variadic"`
Expand Down
2 changes: 2 additions & 0 deletions internal/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (g *TemplateGenerator) methodData(ctx context.Context, method *types.Func)
log.Debug().Str("import", imprt.Path()).Str("import-qualifier", imprt.Qualifier()).Msg("existing imports")
}

// TODO: ReplaceTypes logic should go here in the AddVar.
params[j] = template.ParamData{
Var: methodScope.AddVar(param, ""),
Variadic: signature.Variadic() && j == signature.Params().Len()-1,
Expand Down Expand Up @@ -287,6 +288,7 @@ func (g *TemplateGenerator) Generate(
Str("method-name", method.Name).
Logger().
WithContext(ctx))
method.Scope.ReplaceTypes()
}

ifaceLog.Debug().Str("template-data", fmt.Sprintf("%v", ifaceMock.Config.TemplateData)).Msg("printing template data")
Expand Down

0 comments on commit 1d437a6

Please sign in to comment.