Skip to content

Commit

Permalink
error string starts with lowercase and do not contain trailing '.'
Browse files Browse the repository at this point in the history
Signed-off-by: Minh-Quan TRAN <[email protected]>
  • Loading branch information
itscaro authored and alexellis committed Jan 17, 2018
1 parent cadf7de commit 6ec90d8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion builder/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func checkDestinationFiles(dir string, numberOfFiles, mode int) error {
return err
}
if fileStat.Mode() != os.FileMode(mode) {
return errors.New("Expected mode did not match")
return errors.New("expected mode did not match")
}
}

Expand Down
4 changes: 2 additions & 2 deletions commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ func parseMap(envvars []string, keyName string) (map[string]string, error) {
envvarValue := s[1]

if !(len(envvarName) > 0) {
return nil, fmt.Errorf("Empty %s name: [%s]", keyName, envvar)
return nil, fmt.Errorf("empty %s name: [%s]", keyName, envvar)
}
if !(len(envvarValue) > 0) {
return nil, fmt.Errorf("Empty %s value: [%s]", keyName, envvar)
return nil, fmt.Errorf("empty %s value: [%s]", keyName, envvar)
}

result[envvarName] = envvarValue
Expand Down
2 changes: 1 addition & 1 deletion commands/template_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Currently supported verbs: %v`, supportedVerbs)
var validURL = regexp.MustCompile(repositoryRegexpGithub + "|" + repositoryRegexpMockedServer)

if !validURL.MatchString(args[1]) {
return fmt.Errorf("The repository URL must be in the format https://github.com/<owner>/<repository>")
return fmt.Errorf("the repository URL must be in the format https://github.com/<owner>/<repository>")
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions commands/template_pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func Test_templatePull_error_not_valid_url(t *testing.T) {
faasCmd.SetOutput(&buf)
err := faasCmd.Execute()

if !strings.Contains(err.Error(), "The repository URL must be in the format https://github.com/<owner>/<repository>") {
t.Fatal("Output does not contain the required string", err.Error())
if !strings.Contains(err.Error(), "the repository URL must be in the format https://github.com/<owner>/<repository>") {
t.Fatalf("Output does not contain the required string '%s'", err.Error())
}
}

Expand Down
8 changes: 4 additions & 4 deletions legacy_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ func translateLegacyOpts(args []string) ([]string, error) {
}
if opt == "-action" {
if len(optsCache) == idx+1 {
return []string{""}, fmt.Errorf("No action supplied after deprecated -action flag")
return []string{""}, fmt.Errorf("no action supplied after deprecated -action flag")
}
if translated, ok := validActions[optsCache[idx+1]]; ok {
translatedArgs = append(translatedArgs, translated)
optsCache = append(optsCache[:idx], optsCache[idx+2:]...)
action = translated
} else {
return []string{""}, fmt.Errorf("Unknown action supplied to deprecated -action flag: %s", optsCache[idx+1])
return []string{""}, fmt.Errorf("unknown action supplied to deprecated -action flag: %s", optsCache[idx+1])
}
}
if strings.HasPrefix(opt, "-action"+"=") {
s := strings.SplitN(opt, "=", 2)
if len(s[1]) == 0 {
return []string{""}, fmt.Errorf("No action supplied after deprecated -action= flag")
return []string{""}, fmt.Errorf("no action supplied after deprecated -action= flag")
}
if translated, ok := validActions[s[1]]; ok {
translatedArgs = append(translatedArgs, translated)
optsCache = append(optsCache[:idx], optsCache[idx+1:]...)
action = translated
} else {
return []string{""}, fmt.Errorf("Unknown action supplied to deprecated -action= flag: %s", s[1])
return []string{""}, fmt.Errorf("unknown action supplied to deprecated -action= flag: %s", s[1])
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions proxy/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func InvokeFunction(gateway string, name string, bytesIn *[]byte, contentType st
default:
bytesOut, err := ioutil.ReadAll(res.Body)
if err == nil {
return nil, fmt.Errorf("Server returned unexpected status code: %d - %s", res.StatusCode, string(bytesOut))
return nil, fmt.Errorf("server returned unexpected status code: %d - %s", res.StatusCode, string(bytesOut))
}
}

Expand All @@ -80,10 +80,10 @@ func buildQueryString(query []string) (string, error) {
for _, queryValue := range query {
qs = qs + queryValue + "&"
if strings.Contains(queryValue, "=") == false {
return "", fmt.Errorf("The --query flags must take the form of key=value (= not found)")
return "", fmt.Errorf("the --query flags must take the form of key=value (= not found)")
}
if strings.HasSuffix(queryValue, "=") {
return "", fmt.Errorf("The --query flag must take the form of: key=value (empty value given, or value ends in =)")
return "", fmt.Errorf("the --query flag must take the form of: key=value (empty value given, or value ends in =)")
}
}
qs = strings.TrimRight(qs, "&")
Expand Down
2 changes: 1 addition & 1 deletion proxy/invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Test_InvokeFunction_Not2xx(t *testing.T) {
t.Fatalf("Error was not returned")
}

r := regexp.MustCompile(`(?m:Server returned unexpected status code)`)
r := regexp.MustCompile(`(?m:server returned unexpected status code)`)
if !r.MatchString(err.Error()) {
t.Fatalf("Error not matched: %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func ParseYAMLData(fileData []byte, regex string, filter string) (*Services, err
}

if regexExists && filterExists {
return nil, fmt.Errorf("Pass in a regex or a filter, not both.")
return nil, fmt.Errorf("pass in a regex or a filter, not both")
}

if regexExists || filterExists {
Expand All @@ -79,7 +79,7 @@ func ParseYAMLData(fileData []byte, regex string, filter string) (*Services, err
}

if len(services.Functions) == 0 {
return nil, fmt.Errorf("No functions matching --filter/--regex were found in the YAML file")
return nil, fmt.Errorf("no functions matching --filter/--regex were found in the YAML file")
}

}
Expand Down
2 changes: 1 addition & 1 deletion stack/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const TestData_2 string = `provider:
`

const noMatchesErrorMsg string = "No functions matching --filter/--regex were found in the YAML file"
const noMatchesErrorMsg string = "no functions matching --filter/--regex were found in the YAML file"
const invalidRegexErrorMsg string = "error parsing regexp"

var ParseYAMLTests_Regex = []struct {
Expand Down

0 comments on commit 6ec90d8

Please sign in to comment.