Skip to content
Open
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
8 changes: 4 additions & 4 deletions mockgen/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

const (
deprecatedFlagProgOnly = "prog_only"
deprecatedFlagExecOnly = "exec_only"
_deprecatedFlagProgOnly = "prog_only"
_deprecatedFlagExecOnly = "exec_only"
)

var (
Expand All @@ -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)
}
})
Expand Down
6 changes: 2 additions & 4 deletions mockgen/mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions mockgen/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down