mirror of
https://github.com/mgechev/revive.git
synced 2024-11-28 08:49:11 +02:00
29 lines
512 B
Go
29 lines
512 B
Go
package fixtures
|
|
|
|
import "errors"
|
|
|
|
type tt int
|
|
|
|
func (t tt) m() {}
|
|
|
|
func deferrer() {
|
|
for {
|
|
go func() {
|
|
defer println()
|
|
}()
|
|
defer func() {}() // MATCH /prefer not to defer inside loops/
|
|
}
|
|
|
|
defer tt.m() // MATCH /be careful when deferring calls to methods without pointer receiver/
|
|
|
|
defer func() error {
|
|
return errors.New("error") //MATCH /return in a defer function has no effect/
|
|
}()
|
|
|
|
defer recover()
|
|
|
|
recover() //MATCH /recover must be called inside a deferred function/
|
|
|
|
defer deferrer()
|
|
}
|