Sfoglia il codice sorgente

Merge pull request #21464 from coolljt0725/cleanup_dot

Cleanup: remove redundant period
Vincent Demeester 9 anni fa
parent
commit
2b6b2e1af8
2 ha cambiato i file con 5 aggiunte e 6 eliminazioni
  1. 3 4
      api/client/run.go
  2. 2 2
      daemon/start.go

+ 3 - 4
api/client/run.go

@@ -20,8 +20,8 @@ import (
 )
 
 const (
-	errCmdNotFound          = "not found or does not exist."
-	errCmdCouldNotBeInvoked = "could not be invoked."
+	errCmdNotFound          = "not found or does not exist"
+	errCmdCouldNotBeInvoked = "could not be invoked"
 )
 
 func (cid *cidFile) Close() error {
@@ -48,9 +48,8 @@ func (cid *cidFile) Write(id string) error {
 // if container start fails with 'command cannot be invoked' error, return 126
 // return 125 for generic docker daemon failures
 func runStartContainerErr(err error) error {
-	trimmedErr := strings.Trim(err.Error(), "Error response from daemon: ")
+	trimmedErr := strings.TrimPrefix(err.Error(), "Error response from daemon: ")
 	statusError := Cli.StatusError{StatusCode: 125}
-
 	if strings.HasPrefix(trimmedErr, "Container command") {
 		if strings.Contains(trimmedErr, errCmdNotFound) {
 			statusError = Cli.StatusError{StatusCode: 127}

+ 2 - 2
daemon/start.go

@@ -140,12 +140,12 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
 			strings.Contains(err.Error(), "no such file or directory") ||
 			strings.Contains(err.Error(), "system cannot find the file specified") {
 			container.ExitCode = 127
-			err = fmt.Errorf("Container command '%s' not found or does not exist.", container.Path)
+			err = fmt.Errorf("Container command '%s' not found or does not exist", container.Path)
 		}
 		// set to 126 for container cmd can't be invoked errors
 		if strings.Contains(err.Error(), syscall.EACCES.Error()) {
 			container.ExitCode = 126
-			err = fmt.Errorf("Container command '%s' could not be invoked.", container.Path)
+			err = fmt.Errorf("Container command '%s' could not be invoked", container.Path)
 		}
 
 		container.Reset(false)