Browse Source

Use fmt.Errorf when appropriate.

Caleb Spare 12 năm trước cách đây
mục cha
commit
e93afcdd2b
1 tập tin đã thay đổi với 1 bổ sung2 xóa
  1. 1 2
      archive.go

+ 1 - 2
archive.go

@@ -4,7 +4,6 @@ import (
 	"archive/tar"
 	"archive/tar"
 	"bufio"
 	"bufio"
 	"bytes"
 	"bytes"
-	"errors"
 	"fmt"
 	"fmt"
 	"github.com/dotcloud/docker/utils"
 	"github.com/dotcloud/docker/utils"
 	"io"
 	"io"
@@ -251,7 +250,7 @@ func CmdStream(cmd *exec.Cmd) (io.Reader, error) {
 		}
 		}
 		errText := <-errChan
 		errText := <-errChan
 		if err := cmd.Wait(); err != nil {
 		if err := cmd.Wait(); err != nil {
-			pipeW.CloseWithError(errors.New(err.Error() + ": " + string(errText)))
+			pipeW.CloseWithError(fmt.Errorf("%s: %s", err, errText))
 		} else {
 		} else {
 			pipeW.Close()
 			pipeW.Close()
 		}
 		}