Added a convention that sentinel errors go near the top of the file, and applied it

This commit is contained in:
bwilliams committed 2026-10-16 13:23:47 +01:00
1 parent 848edc73e2
commit e32e270db0
5 files changed
+44 -16

No files matched your search

+3 -2
View File
@@ -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