scripts/mockgen_fix.go
package main
import (
"fmt"
"io"
"os"
"regexp"
)
var re = regexp.MustCompile(
`(?ms)^(\/\/ Code generated by MockGen.+?Source: .+?)$` +
`.*?` +
`^(// Package mock_.+?)$`,
)
func main() {
b, err := io.ReadAll(os.Stdin)
if err != nil {
return
}
result := re.ReplaceAllString(string(b), "$1\n//\n$2")
fmt.Print(result)
}