fix(style): error strings should not be capitalized or end with punctuation or a newline

This commit is contained in:
Łukasz Mierzwa
2018-08-11 23:03:02 +01:00
parent 78bddce664
commit c6dc362186
7 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ func newBinaryFileSystem(root string) *binaryFileSystem {
Asset: Asset,
// Don't render directory index, return 404 for /static/ requests)
AssetDir: func(path string) ([]string, error) {
return nil, errors.New("Not found")
return nil, errors.New("not found")
},
Prefix: root,
}
+1 -1
View File
@@ -360,7 +360,7 @@ func (am *Alertmanager) SilenceByID(id string) (models.Silence, error) {
s, found := am.silences[id]
if !found {
return models.Silence{}, fmt.Errorf("Silence '%s' not found", id)
return models.Silence{}, fmt.Errorf("silence '%s' not found", id)
}
return s, nil
}
+2 -2
View File
@@ -59,12 +59,12 @@ func NewAlertmanager(name, upstreamURI string, opts ...Option) (*Alertmanager, e
// instances used when pulling alerts from upstreams
func RegisterAlertmanager(am *Alertmanager) error {
if _, found := upstreams[am.Name]; found {
return fmt.Errorf("Alertmanager upstream '%s' already exist", am.Name)
return fmt.Errorf("alertmanager upstream '%s' already exist", am.Name)
}
for _, existingAM := range upstreams {
if existingAM.URI == am.URI {
return fmt.Errorf("Alertmanager upstream '%s' already collects from '%s'", existingAM.Name, existingAM.URI)
return fmt.Errorf("alertmanager upstream '%s' already collects from '%s'", existingAM.Name, existingAM.URI)
}
}
upstreams[am.Name] = am
+2 -2
View File
@@ -44,7 +44,7 @@ func GetAlertMapper(version string) (AlertMapper, error) {
return m, nil
}
}
return nil, fmt.Errorf("Can't find alert mapper for Alertmanager %s", version)
return nil, fmt.Errorf("can't find alert mapper for Alertmanager %s", version)
}
// RegisterSilenceMapper allows to register mapper implementing silence data
@@ -60,5 +60,5 @@ func GetSilenceMapper(version string) (SilenceMapper, error) {
return m, nil
}
}
return nil, fmt.Errorf("Can't find silence mapper for Alertmanager %s", version)
return nil, fmt.Errorf("can't find silence mapper for Alertmanager %s", version)
}
+1 -1
View File
@@ -26,7 +26,7 @@ func RegisterURL(url string, version string, filename string) {
panic(err)
}
if len(mockJSON) == 0 {
panic(fmt.Errorf("Empty mock file '%s'", fullPath))
panic(fmt.Errorf("empty mock file '%s'", fullPath))
}
httpmock.RegisterResponder("GET", url, httpmock.NewBytesResponder(200, mockJSON))
}
+2 -2
View File
@@ -29,7 +29,7 @@ func (r *HTTPURIReader) Read(uri string) (io.ReadCloser, error) {
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Request to %s failed with %s", SanitizeURI(uri), resp.Status)
return nil, fmt.Errorf("request to %s failed with %s", SanitizeURI(uri), resp.Status)
}
var reader io.ReadCloser
@@ -37,7 +37,7 @@ func (r *HTTPURIReader) Read(uri string) (io.ReadCloser, error) {
case "gzip":
reader, err = gzip.NewReader(resp.Body)
if err != nil {
return nil, fmt.Errorf("Failed to decode gzipped content: %s", err.Error())
return nil, fmt.Errorf("failed to decode gzipped content: %s", err.Error())
}
default:
reader = resp.Body
+1 -1
View File
@@ -31,6 +31,6 @@ func NewReader(uri string, timeout time.Duration, clientTransport http.RoundTrip
case "file":
return &FileURIReader{}, nil
default:
return nil, fmt.Errorf("Unsupported URI scheme '%s' in '%s'", u.Scheme, u)
return nil, fmt.Errorf("unsupported URI scheme '%s' in '%s'", u.Scheme, u)
}
}