diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index d742b32..d7d0085 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -31,6 +31,7 @@ import ( "os/exec" "path" "path/filepath" + "runtime" "sort" "strconv" "strings" @@ -316,7 +317,11 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac g.p("// Generated by this command:") g.p("//") // only log the name of the executable, not the full path - g.p("//\t%v", strings.Join(append([]string{filepath.Base(os.Args[0])}, os.Args[1:]...), " ")) + name := filepath.Base(os.Args[0]) + if runtime.GOOS == "windows" { + name = strings.TrimSuffix(name, ".exe") + } + g.p("//\t%v", strings.Join(append([]string{name}, os.Args[1:]...), " ")) g.p("//") // Get all required imports, and generate unique names for them all.