Added a convention that sentinel errors go near the top of the file, and applied it
This commit is contained in:
1 parent
848edc73e2
commit
e32e270db0
5 files changed
+44
-16
No files matched your search
@@ -10,6 +10,9 @@ import (
|
||||
"git.avsdev.uk/Go/job-search/internal/util"
|
||||
)
|
||||
|
||||
// errRejected is the error testValidated.validate rejects "bad" with.
|
||||
var errRejected = errors.New("rejected")
|
||||
|
||||
// Test sections exercising every field shape section.go supports.
|
||||
type testInner struct {
|
||||
Name string `cfg:"name" default:"inner"`
|
||||
@@ -51,8 +54,6 @@ type testValidated struct {
|
||||
Value string `cfg:"value"`
|
||||
}
|
||||
|
||||
var errRejected = errors.New("rejected")
|
||||
|
||||
func (c *testValidated) validate(key string, value any) error {
|
||||
if key == "value" && value.(string) == "bad" {
|
||||
return errRejected
|
||||
|
||||
Reference in new issue
Block a user