Skip to content

Commit af43e35

Browse files
chore: add underscore for global const
Signed-off-by: Sasha Melentyev <sasha@m8.ru>
1 parent 6568d88 commit af43e35

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

mockgen/deprecated.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
)
88

99
const (
10-
deprecatedFlagProgOnly = "prog_only"
11-
deprecatedFlagExecOnly = "exec_only"
10+
_deprecatedFlagProgOnly = "prog_only"
11+
_deprecatedFlagExecOnly = "exec_only"
1212
)
1313

1414
var (
@@ -23,9 +23,9 @@ func notifyAboutDeprecatedFlags() {
2323

2424
flag.Visit(func(f *flag.Flag) {
2525
switch f.Name {
26-
case deprecatedFlagProgOnly:
26+
case _deprecatedFlagProgOnly:
2727
logger.Println("The -prog_only flag is deprecated and has no effect.", resetColorPostfix)
28-
case deprecatedFlagExecOnly:
28+
case _deprecatedFlagExecOnly:
2929
logger.Println("The -exec_only flag is deprecated and has no effect.", resetColorPostfix)
3030
}
3131
})

mockgen/mockgen.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ import (
4343
"go.uber.org/mock/mockgen/model"
4444
)
4545

46-
const (
47-
gomockImportPath = "go.uber.org/mock/gomock"
48-
)
46+
const _gomockImportPath = "go.uber.org/mock/gomock"
4947

5048
var (
5149
version = ""
@@ -346,7 +344,7 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac
346344

347345
// Get all required imports, and generate unique names for them all.
348346
im := pkg.Imports()
349-
im[gomockImportPath] = true
347+
im[_gomockImportPath] = true
350348

351349
// Only import reflect if it's used. We only use reflect in mocked methods
352350
// so only import if any of the mocked interfaces have methods.

mockgen/model/model.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
"strings"
2424
)
2525

26-
// pkgPath is the importable path for package model
27-
const pkgPath = "go.uber.org/mock/mockgen/model"
26+
// _pkgPath is the importable path for package model
27+
const _pkgPath = "go.uber.org/mock/mockgen/model"
2828

2929
// Package is a Go package. It may be a subset.
3030
type Package struct {
@@ -149,12 +149,12 @@ type Type interface {
149149
func init() {
150150
// Call gob.RegisterName with pkgPath as prefix to avoid conflicting with
151151
// github.com/golang/mock/mockgen/model 's registration.
152-
gob.RegisterName(pkgPath+".ArrayType", &ArrayType{})
153-
gob.RegisterName(pkgPath+".ChanType", &ChanType{})
154-
gob.RegisterName(pkgPath+".FuncType", &FuncType{})
155-
gob.RegisterName(pkgPath+".MapType", &MapType{})
156-
gob.RegisterName(pkgPath+".NamedType", &NamedType{})
157-
gob.RegisterName(pkgPath+".PointerType", &PointerType{})
152+
gob.RegisterName(_pkgPath+".ArrayType", &ArrayType{})
153+
gob.RegisterName(_pkgPath+".ChanType", &ChanType{})
154+
gob.RegisterName(_pkgPath+".FuncType", &FuncType{})
155+
gob.RegisterName(_pkgPath+".MapType", &MapType{})
156+
gob.RegisterName(_pkgPath+".NamedType", &NamedType{})
157+
gob.RegisterName(_pkgPath+".PointerType", &PointerType{})
158158

159159
// Call gob.RegisterName to make sure it has the consistent name registered
160160
// for both gob decoder and encoder.
@@ -163,7 +163,7 @@ func init() {
163163
// calling rt.PkgPath() for a name to register. If your project has vendor
164164
// directory, it is possible that PkgPath will get a path like this:
165165
// ../../../vendor/go.uber.org/mock/mockgen/model
166-
gob.RegisterName(pkgPath+".PredeclaredType", PredeclaredType(""))
166+
gob.RegisterName(_pkgPath+".PredeclaredType", PredeclaredType(""))
167167
}
168168

169169
// ArrayType is an array or slice type.

0 commit comments

Comments
 (0)