diff --git a/mockgen/deprecated.go b/mockgen/deprecated.go index 0b45a2e3..ec0451fa 100644 --- a/mockgen/deprecated.go +++ b/mockgen/deprecated.go @@ -7,8 +7,8 @@ import ( ) const ( - deprecatedFlagProgOnly = "prog_only" - deprecatedFlagExecOnly = "exec_only" + _deprecatedFlagProgOnly = "prog_only" + _deprecatedFlagExecOnly = "exec_only" ) var ( @@ -23,9 +23,9 @@ func notifyAboutDeprecatedFlags() { flag.Visit(func(f *flag.Flag) { switch f.Name { - case deprecatedFlagProgOnly: + case _deprecatedFlagProgOnly: logger.Println("The -prog_only flag is deprecated and has no effect.", resetColorPostfix) - case deprecatedFlagExecOnly: + case _deprecatedFlagExecOnly: logger.Println("The -exec_only flag is deprecated and has no effect.", resetColorPostfix) } }) diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index 79cce84b..57bd3423 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -43,9 +43,7 @@ import ( "go.uber.org/mock/mockgen/model" ) -const ( - gomockImportPath = "go.uber.org/mock/gomock" -) +const _gomockImportPath = "go.uber.org/mock/gomock" var ( version = "" @@ -346,7 +344,7 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac // Get all required imports, and generate unique names for them all. im := pkg.Imports() - im[gomockImportPath] = true + im[_gomockImportPath] = true // Only import reflect if it's used. We only use reflect in mocked methods // so only import if any of the mocked interfaces have methods. diff --git a/mockgen/model/model.go b/mockgen/model/model.go index 853dbf2d..16e7682a 100644 --- a/mockgen/model/model.go +++ b/mockgen/model/model.go @@ -23,8 +23,8 @@ import ( "strings" ) -// pkgPath is the importable path for package model -const pkgPath = "go.uber.org/mock/mockgen/model" +// _pkgPath is the importable path for package model +const _pkgPath = "go.uber.org/mock/mockgen/model" // Package is a Go package. It may be a subset. type Package struct { @@ -149,12 +149,12 @@ type Type interface { func init() { // Call gob.RegisterName with pkgPath as prefix to avoid conflicting with // github.com/golang/mock/mockgen/model 's registration. - gob.RegisterName(pkgPath+".ArrayType", &ArrayType{}) - gob.RegisterName(pkgPath+".ChanType", &ChanType{}) - gob.RegisterName(pkgPath+".FuncType", &FuncType{}) - gob.RegisterName(pkgPath+".MapType", &MapType{}) - gob.RegisterName(pkgPath+".NamedType", &NamedType{}) - gob.RegisterName(pkgPath+".PointerType", &PointerType{}) + gob.RegisterName(_pkgPath+".ArrayType", &ArrayType{}) + gob.RegisterName(_pkgPath+".ChanType", &ChanType{}) + gob.RegisterName(_pkgPath+".FuncType", &FuncType{}) + gob.RegisterName(_pkgPath+".MapType", &MapType{}) + gob.RegisterName(_pkgPath+".NamedType", &NamedType{}) + gob.RegisterName(_pkgPath+".PointerType", &PointerType{}) // Call gob.RegisterName to make sure it has the consistent name registered // for both gob decoder and encoder. @@ -163,7 +163,7 @@ func init() { // calling rt.PkgPath() for a name to register. If your project has vendor // directory, it is possible that PkgPath will get a path like this: // ../../../vendor/go.uber.org/mock/mockgen/model - gob.RegisterName(pkgPath+".PredeclaredType", PredeclaredType("")) + gob.RegisterName(_pkgPath+".PredeclaredType", PredeclaredType("")) } // ArrayType is an array or slice type.