Skip to content

Commit

Permalink
remove redundant return after panic to keep vet happy
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin birch committed Nov 30, 2017
1 parent 1a380e2 commit 12a6142
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 47 deletions.
3 changes: 1 addition & 2 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Fake{{.Name}} is a mock implementation of {{.Name}} for testing.
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to Fake{{.Name}}.
{{end}}{{end}}*/
type Fake{{.Name}} struct {
Expand All @@ -67,7 +67,6 @@ func NewFake{{.Name}}DefaultPanic() *Fake{{.Name}} {
return &Fake{{.Name}}{
{{range .Methods}} {{.Name}}Hook: func({{.ParametersSignature}}) ({{.ResultsDeclaration}}) {
panic("Unexpected call to {{.Interface}}.{{.Name}}")
return
},
{{end}}
}
Expand Down
6 changes: 1 addition & 5 deletions testdata/array/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeArrayParameter.
*/
type FakeArray struct {
Expand All @@ -76,19 +76,15 @@ func NewFakeArrayDefaultPanic() *FakeArray {
return &FakeArray{
ArrayParameterHook: func([3]string) {
panic("Unexpected call to Array.ArrayParameter")
return
},
ArrayReturnHook: func() (ident2 [3]string) {
panic("Unexpected call to Array.ArrayReturn")
return
},
SliceParameterHook: func([]string) {
panic("Unexpected call to Array.SliceParameter")
return
},
SliceReturnHook: func() (ident4 []string) {
panic("Unexpected call to Array.SliceReturn")
return
},
}
}
Expand Down
7 changes: 1 addition & 6 deletions testdata/channeler/channeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeChannel.
*/
type FakeChanneler struct {
Expand All @@ -100,23 +100,18 @@ func NewFakeChannelerDefaultPanic() *FakeChanneler {
return &FakeChanneler{
ChannelHook: func(chan int) (ident2 chan int) {
panic("Unexpected call to Channeler.Channel")
return
},
ChannelReceiveHook: func(<-chan int) (ident4 <-chan int) {
panic("Unexpected call to Channeler.ChannelReceive")
return
},
ChannelSendHook: func(chan<- int) (ident6 chan<- int) {
panic("Unexpected call to Channeler.ChannelSend")
return
},
ChannelPointerHook: func(*chan int) (ident8 *chan int) {
panic("Unexpected call to Channeler.ChannelPointer")
return
},
ChannelInterfaceHook: func(chan interface{}) (ident10 chan interface{}) {
panic("Unexpected call to Channeler.ChannelInterface")
return
},
}
}
Expand Down
5 changes: 1 addition & 4 deletions testdata/embedder/embedder.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeString.
*/
type FakeEmbedder struct {
Expand All @@ -73,15 +73,12 @@ func NewFakeEmbedderDefaultPanic() *FakeEmbedder {
return &FakeEmbedder{
StringHook: func() (ident5 string) {
panic("Unexpected call to Embedder.String")
return
},
EmbedHook: func(string) (ident9 string) {
panic("Unexpected call to Embedder.Embed")
return
},
OtherHook: func(string) (ident7 string) {
panic("Unexpected call to Embedder.Other")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/funcer/funcer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeFuncParameter.
*/
type FakeFuncer struct {
Expand All @@ -58,11 +58,9 @@ func NewFakeFuncerDefaultPanic() *FakeFuncer {
return &FakeFuncer{
FuncParameterHook: func(func(string) string) {
panic("Unexpected call to Funcer.FuncParameter")
return
},
FuncReturnHook: func() (ident2 func(string) string) {
panic("Unexpected call to Funcer.FuncReturn")
return
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions testdata/importer/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeScan.
*/
type FakeImporter struct {
Expand All @@ -54,7 +54,6 @@ func NewFakeImporterDefaultPanic() *FakeImporter {
return &FakeImporter{
ScanHook: func(*Scanner) (ident10 z.Reader) {
panic("Unexpected call to Importer.Scan")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/interfacer/interfacer.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeInterface.
*/
type FakeInterfacer struct {
Expand All @@ -64,11 +64,9 @@ func NewFakeInterfacerDefaultPanic() *FakeInterfacer {
return &FakeInterfacer{
InterfaceHook: func(interface{}) (ident2 interface{}) {
panic("Unexpected call to Interfacer.Interface")
return
},
NamedInterfaceHook: func(interface{}) (z interface{}) {
panic("Unexpected call to Interfacer.NamedInterface")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeMapParameter.
*/
type FakeMapper struct {
Expand All @@ -58,11 +58,9 @@ func NewFakeMapperDefaultPanic() *FakeMapper {
return &FakeMapper{
MapParameterHook: func(map[string]string) {
panic("Unexpected call to Mapper.MapParameter")
return
},
MapReturnHook: func() (ident2 map[string]string) {
panic("Unexpected call to Mapper.MapReturn")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/multireturner/multireturner.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeMultiReturn.
*/
type FakeMultireturner struct {
Expand All @@ -61,11 +61,9 @@ func NewFakeMultireturnerDefaultPanic() *FakeMultireturner {
return &FakeMultireturner{
MultiReturnHook: func() (ident1 string, ident2 int) {
panic("Unexpected call to Multireturner.MultiReturn")
return
},
NamedReturnHook: func() (a int, b int, c int, d int) {
panic("Unexpected call to Multireturner.NamedReturn")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/namedvaluer/namedvaluer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeManyNamed.
*/
type FakeNamedvaluer struct {
Expand All @@ -68,11 +68,9 @@ func NewFakeNamedvaluerDefaultPanic() *FakeNamedvaluer {
return &FakeNamedvaluer{
ManyNamedHook: func(string, string, int, int) (ret bool) {
panic("Unexpected call to Namedvaluer.ManyNamed")
return
},
NamedHook: func(int, string) (ret bool) {
panic("Unexpected call to Namedvaluer.Named")
return
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions testdata/pointer/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakePoint.
*/
type FakePointer struct {
Expand All @@ -52,7 +52,6 @@ func NewFakePointerDefaultPanic() *FakePointer {
return &FakePointer{
PointHook: func(*string) (ident2 int) {
panic("Unexpected call to Pointer.Point")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/qualifier/qualifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeQualify.
*/
type FakeQualifier struct {
Expand All @@ -67,11 +67,9 @@ func NewFakeQualifierDefaultPanic() *FakeQualifier {
return &FakeQualifier{
QualifyHook: func(fmt.Scanner) (ident7 fmt.Scanner) {
panic("Unexpected call to Qualifier.Qualify")
return
},
NamedQualifyHook: func(fmt.Scanner, fmt.Scanner, fmt.Scanner) (d fmt.Scanner) {
panic("Unexpected call to Qualifier.NamedQualify")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/structer/structer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeStruct.
*/
type FakeStructer struct {
Expand Down Expand Up @@ -100,7 +100,6 @@ func NewFakeStructerDefaultPanic() *FakeStructer {
d string
}) {
panic("Unexpected call to Structer.Struct")
return
},
NamedStructHook: func(struct {
a string
Expand All @@ -110,7 +109,6 @@ func NewFakeStructerDefaultPanic() *FakeStructer {
d string
}) {
panic("Unexpected call to Structer.NamedStruct")
return
},
}
}
Expand Down
4 changes: 1 addition & 3 deletions testdata/variadic/variadic.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeSingleVariadic.
*/
type FakeVariadic struct {
Expand All @@ -61,11 +61,9 @@ func NewFakeVariadicDefaultPanic() *FakeVariadic {
return &FakeVariadic{
SingleVariadicHook: func(...string) {
panic("Unexpected call to Variadic.SingleVariadic")
return
},
MixedVariadicHook: func(int, int, int, ...string) {
panic("Unexpected call to Variadic.MixedVariadic")
return
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions testdata/voider/voider.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Use it in your tests as in this example:
}
Create anonymous function implementations for only those interface methods that
should be called in the code under test. This will force a painc if any
should be called in the code under test. This will force a panic if any
unexpected calls are made to FakeVoidMethod.
*/
type FakeVoider struct {
Expand All @@ -45,7 +45,6 @@ func NewFakeVoiderDefaultPanic() *FakeVoider {
return &FakeVoider{
VoidMethodHook: func() {
panic("Unexpected call to Voider.VoidMethod")
return
},
}
}
Expand Down

0 comments on commit 12a6142

Please sign in to comment.