Skip to content

Commit

Permalink
strip the path of the mockgen executable when recording invocation (#82)
Browse files Browse the repository at this point in the history
This commit changes the generated invocation comment to only print the name of the executable, rather than the full path.
  • Loading branch information
marten-seemann authored Sep 15, 2023
1 parent dde4646 commit 7826b9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mockgen/mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac
}
g.p("//")
g.p("// Generated by this command:")
g.p("// %v", strings.Join(os.Args, " "))
// only log the name of the executable, not the full path
g.p("// %v", strings.Join(append([]string{filepath.Base(os.Args[0])}, os.Args[1:]...), " "))

// Get all required imports, and generate unique names for them all.
im := pkg.Imports()
Expand Down

0 comments on commit 7826b9c

Please sign in to comment.