diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index 50487070..0dc4acc4 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -31,6 +31,7 @@ import ( "os/exec" "path" "path/filepath" + "runtime/debug" "sort" "strconv" "strings" @@ -279,6 +280,18 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac } else { g.p("// Source: %v (interfaces: %v)", g.srcPackage, g.srcInterfaces) } + g.p("//") + + g.p("// Generated by this command:") + invokedArgs := strings.Join(os.Args, " ") + g.p("// %v", invokedArgs) + + g.p("//") + if version != "" { + g.p("// Mockgen version: %s", version) + } else if bi, exists := debug.ReadBuildInfo(); exists { + g.p("// Mockgen version: %s", bi.Main.Version) + } g.p("") // Get all required imports, and generate unique names for them all.