Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version command #195

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ import (
{{- if not $.SkipEnsure -}}
// Ensure, that {{.MockName}} does implement {{$.SrcPkgQualifier}}{{.InterfaceName}}.
// If this is not the case, regenerate this file with moq.
var _ {{$.SrcPkgQualifier}}{{.InterfaceName -}}
var _ {{$.SrcPkgQualifier}}{{.InterfaceName -}}
{{- if .TypeParams }}[
{{- range $index, $param := .TypeParams}}
{{- if $index}}, {{end -}}
{{if $param.Constraint}}{{$param.Constraint.String}}{{else}}{{$param.TypeString}}{{end}}
{{- end -}}
]
{{- end }} = &{{.MockName}}
{{- if .TypeParams }}[
{{- if .TypeParams }}[
{{- range $index, $param := .TypeParams}}
{{- if $index}}, {{end -}}
{{if $param.Constraint}}{{$param.Constraint.String}}{{else}}{{$param.TypeString}}{{end}}
Expand All @@ -83,7 +83,7 @@ var _ {{$.SrcPkgQualifier}}{{.InterfaceName -}}
// // and then make assertions.
//
// }
type {{.MockName}}
type {{.MockName}}
{{- if .TypeParams -}}
[{{- range $index, $param := .TypeParams}}
{{- if $index}}, {{end}}{{$param.Name | Exported}} {{$param.TypeString}}
Expand Down Expand Up @@ -232,8 +232,9 @@ var templateFuncs = template.FuncMap{
if s == "" {
return ""
}
sUpper := strings.ToUpper(s)
for _, initialism := range golintInitialisms {
if strings.ToUpper(s) == initialism {
if sUpper == initialism {
return initialism
}
}
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/matryer/moq/pkg/moq"
)

// Version is the command version, injected at build time.
var Version string = "dev"
// version is the command version, injected at build time.
var version string = "dev"

type userFlags struct {
outFile string
Expand Down Expand Up @@ -52,7 +52,7 @@ func main() {
flags.args = flag.Args()

if *printVersion {
fmt.Printf("moq version %s\n", Version)
fmt.Printf("moq version %s\n", version)
os.Exit(0)
}

Expand Down