Skip to content

Commit

Permalink
fix: register type with prefix (#52)
Browse files Browse the repository at this point in the history
fix #51
  • Loading branch information
bcho authored Aug 12, 2023
1 parent d58347a commit a4dec54
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mockgen/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ type Type interface {
}

func init() {
gob.Register(&ArrayType{})
gob.Register(&ChanType{})
gob.Register(&FuncType{})
gob.Register(&MapType{})
gob.Register(&NamedType{})
gob.Register(&PointerType{})
// 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{})

// Call gob.RegisterName to make sure it has the consistent name registered
// for both gob decoder and encoder.
Expand Down

0 comments on commit a4dec54

Please sign in to comment.