From 87f49e6b962e9faf48ee4326484b26cb0ebd2947 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 11 Sep 2023 12:27:47 +0700 Subject: [PATCH] strip the path of the mockgen executable when recording invocation --- mockgen/mockgen.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index e19be97..a359c3c 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -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()