1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-28 08:49:11 +02:00
revive/testdata/golint/error-naming.go
2022-06-28 18:14:26 +03:00

28 lines
590 B
Go

// Test for naming errors.
// Package foo ...
package foo
import (
"errors"
"fmt"
)
var unexp = errors.New("some unexported error") // MATCH /error var unexp should have name of the form errFoo/
// Exp ...
var Exp = errors.New("some exported error")
// MATCH:14 /error var Exp should have name of the form ErrFoo/
var (
e1 = fmt.Errorf("blah %d", 4) // MATCH /error var e1 should have name of the form errFoo/
// E2 ...
E2 = fmt.Errorf("blah %d", 5) // MATCH /error var E2 should have name of the form ErrFoo/
)
func f() {
var whatever = errors.New("ok") // ok
_ = whatever
}