Skip to content

Commit

Permalink
Fixed paths for go:generate to work with -o parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdigest committed Jan 2, 2024
1 parent 983f018 commit 67ccb42
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions cmd/minimock/minimock.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ func processPackage(opts generator.Options, interfaces []types.InterfaceSpecific
return errors.Wrapf(err, "failed to generate mock for %s", iface.InterfaceName)
}

opts.HeaderVars["OutputFile"] = filepath.Base(opts.OutputFile)

opts.Vars["MockName"] = fmt.Sprintf("%sMock", opts.InterfaceName)
if mockName != "" {
opts.Vars["MockName"] = mockName
Expand Down
2 changes: 1 addition & 1 deletion template.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const (
// Code generated by http://github.com/gojuno/minimock ({{$.Options.HeaderVars.Version}}). DO NOT EDIT.
{{if $.Options.HeaderVars.GenerateInstruction}}
//go:generate minimock -i {{$.SourcePackage.PkgPath}}.{{$.Options.InterfaceName}} -o {{$.Options.OutputFile}} -n {{(title (index $.Vars "MockName"))}}
//go:generate minimock -i {{$.SourcePackage.PkgPath}}.{{$.Options.InterfaceName}} -o {{$.Options.HeaderVars.OutputFile}} -n {{(title (index $.Vars "MockName"))}}
{{end}}
import (
Expand Down
2 changes: 1 addition & 1 deletion tests/context_accepter_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/formatter_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/formatter_with_custom_name_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_complex_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/generic_in.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_inline_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_inline_with_many_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_inout.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_multiple_args_with_different_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_simple_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/generic_specific.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/tester_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67ccb42

Please sign in to comment.