mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
Fix error string should not be capitalized (#2608)
From [Golang coding convention](https://github.com/golang/go/wiki/CodeReviewComments#error-strings) Co-Authored-By: Nguyen Van Trung [trungnvfet@outlook.com](mailto:trungnvfet@outlook.com) Signed-off-by: Nguyen Quang Huy [huynq0911@gmail.com](mailto:huynq0911@gmail.com)
This commit is contained in:
committed by
Chris O'Haver
parent
c8dbfbdcd8
commit
42cf6606fc
@@ -26,7 +26,7 @@ const (
|
||||
etcdTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
var errKeyNotFound = errors.New("Key not found")
|
||||
var errKeyNotFound = errors.New("key not found")
|
||||
|
||||
// Etcd is a plugin talks to an etcd cluster.
|
||||
type Etcd struct {
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestDo(t *testing.T) {
|
||||
|
||||
func TestDoErr(t *testing.T) {
|
||||
var g Group
|
||||
someErr := errors.New("Some error")
|
||||
someErr := errors.New("some error")
|
||||
v, err := g.Do(1, func() (interface{}, error) {
|
||||
return nil, someErr
|
||||
})
|
||||
|
||||
@@ -42,7 +42,7 @@ func buildPool(size int) ([]*healthcheck.UpstreamHost, func(), error) {
|
||||
for _, e := range errs {
|
||||
valErr += fmt.Sprintf("%v\n", e)
|
||||
}
|
||||
return nil, nil, fmt.Errorf("Error at allocation of the pool : %v", valErr)
|
||||
return nil, nil, fmt.Errorf("error at allocation of the pool : %v", valErr)
|
||||
}
|
||||
return ups, stopIt, nil
|
||||
}
|
||||
|
||||
@@ -300,10 +300,10 @@ func getSubExprUsage(s string) int {
|
||||
func isValidRegexPattern(rewriteFrom, rewriteTo string) (*regexp.Regexp, error) {
|
||||
rewriteFromPattern, err := regexp.Compile(rewriteFrom)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid regex matching pattern: %s", rewriteFrom)
|
||||
return nil, fmt.Errorf("invalid regex matching pattern: %s", rewriteFrom)
|
||||
}
|
||||
if getSubExprUsage(rewriteTo) > rewriteFromPattern.NumSubexp() {
|
||||
return nil, fmt.Errorf("The rewrite regex pattern (%s) uses more subexpressions than its corresponding matching regex pattern (%s)", rewriteTo, rewriteFrom)
|
||||
return nil, fmt.Errorf("the rewrite regex pattern (%s) uses more subexpressions than its corresponding matching regex pattern (%s)", rewriteTo, rewriteFrom)
|
||||
}
|
||||
return rewriteFromPattern, nil
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ func newTtlRule(nextAction string, args ...string) (Rule, error) {
|
||||
case RegexMatch:
|
||||
regexPattern, err := regexp.Compile(args[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid regex pattern in a ttl rule: %s", args[1])
|
||||
return nil, fmt.Errorf("invalid regex pattern in a ttl rule: %s", args[1])
|
||||
}
|
||||
return ®exTtlRule{
|
||||
nextAction,
|
||||
|
||||
@@ -115,17 +115,17 @@ func OPT(bufsize int, do bool) *dns.OPT {
|
||||
// Header test if the header in resp matches the header as defined in tc.
|
||||
func Header(tc Case, resp *dns.Msg) error {
|
||||
if resp.Rcode != tc.Rcode {
|
||||
return fmt.Errorf("Rcode is %q, expected %q", dns.RcodeToString[resp.Rcode], dns.RcodeToString[tc.Rcode])
|
||||
return fmt.Errorf("rcode is %q, expected %q", dns.RcodeToString[resp.Rcode], dns.RcodeToString[tc.Rcode])
|
||||
}
|
||||
|
||||
if len(resp.Answer) != len(tc.Answer) {
|
||||
return fmt.Errorf("Answer for %q contained %d results, %d expected", tc.Qname, len(resp.Answer), len(tc.Answer))
|
||||
return fmt.Errorf("answer for %q contained %d results, %d expected", tc.Qname, len(resp.Answer), len(tc.Answer))
|
||||
}
|
||||
if len(resp.Ns) != len(tc.Ns) {
|
||||
return fmt.Errorf("Authority for %q contained %d results, %d expected", tc.Qname, len(resp.Ns), len(tc.Ns))
|
||||
return fmt.Errorf("authority for %q contained %d results, %d expected", tc.Qname, len(resp.Ns), len(tc.Ns))
|
||||
}
|
||||
if len(resp.Extra) != len(tc.Extra) {
|
||||
return fmt.Errorf("Additional for %q contained %d results, %d expected", tc.Qname, len(resp.Extra), len(tc.Extra))
|
||||
return fmt.Errorf("additional for %q contained %d results, %d expected", tc.Qname, len(resp.Extra), len(tc.Extra))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func run(t *testing.T, c *exec.Cmd) ([]byte, error) {
|
||||
c.Dir = ".."
|
||||
out, err := c.Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Run: failed to run %s %s: %q", c.Args[0], c.Args[1], err)
|
||||
return nil, fmt.Errorf("run: failed to run %s %s: %q", c.Args[0], c.Args[1], err)
|
||||
}
|
||||
return out, nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user