mirror of https://github.com/docker/docs.git
Use a *println or *print function instead of *printf where appropriate.
This commit is contained in:
parent
15b3088157
commit
c298a91f95
14
commands.go
14
commands.go
|
@ -146,12 +146,12 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout io.Writer, args ...strin
|
||||||
newAuthConfig := auth.NewAuthConfig(username, password, email, srv.runtime.root)
|
newAuthConfig := auth.NewAuthConfig(username, password, email, srv.runtime.root)
|
||||||
status, err := auth.Login(newAuthConfig)
|
status, err := auth.Login(newAuthConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(stdout, "Error : %s\n", err)
|
fmt.Fprintln(stdout, "Error:", err)
|
||||||
} else {
|
} else {
|
||||||
srv.runtime.authConfig = newAuthConfig
|
srv.runtime.authConfig = newAuthConfig
|
||||||
}
|
}
|
||||||
if status != "" {
|
if status != "" {
|
||||||
fmt.Fprintf(stdout, status)
|
fmt.Fprint(stdout, status)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string
|
||||||
if !rcli.DEBUG_FLAG {
|
if !rcli.DEBUG_FLAG {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "debug mode enabled\n")
|
fmt.Fprintln(stdout, "debug mode enabled")
|
||||||
fmt.Fprintf(stdout, "fds: %d\ngoroutines: %d\n", getTotalUsedFds(), runtime.NumGoroutine())
|
fmt.Fprintf(stdout, "fds: %d\ngoroutines: %d\n", getTotalUsedFds(), runtime.NumGoroutine())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...str
|
||||||
}
|
}
|
||||||
w := tabwriter.NewWriter(stdout, 20, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(stdout, 20, 1, 3, ' ', 0)
|
||||||
defer w.Flush()
|
defer w.Flush()
|
||||||
fmt.Fprintf(w, "ID\tCREATED\tCREATED BY\n")
|
fmt.Fprintln(w, "ID\tCREATED\tCREATED BY")
|
||||||
return image.WalkHistory(func(img *Image) error {
|
return image.WalkHistory(func(img *Image) error {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%s\n",
|
fmt.Fprintf(w, "%s\t%s\t%s\n",
|
||||||
srv.runtime.repositories.ImageName(img.ShortId()),
|
srv.runtime.repositories.ImageName(img.ShortId()),
|
||||||
|
@ -438,7 +438,7 @@ func (srv *Server) CmdImport(stdin io.ReadCloser, stdout io.Writer, args ...stri
|
||||||
u.Host = src
|
u.Host = src
|
||||||
u.Path = ""
|
u.Path = ""
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "Downloading from %s\n", u.String())
|
fmt.Fprintln(stdout, "Downloading from", u)
|
||||||
// Download with curl (pretty progress bar)
|
// Download with curl (pretty progress bar)
|
||||||
// If curl is not available, fallback to http.Get()
|
// If curl is not available, fallback to http.Get()
|
||||||
resp, err = Download(u.String(), stdout)
|
resp, err = Download(u.String(), stdout)
|
||||||
|
@ -564,7 +564,7 @@ func (srv *Server) CmdImages(stdin io.ReadCloser, stdout io.Writer, args ...stri
|
||||||
}
|
}
|
||||||
w := tabwriter.NewWriter(stdout, 20, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(stdout, 20, 1, 3, ' ', 0)
|
||||||
if !*quiet {
|
if !*quiet {
|
||||||
fmt.Fprintf(w, "REPOSITORY\tTAG\tID\tCREATED\tPARENT\n")
|
fmt.Fprintln(w, "REPOSITORY\tTAG\tID\tCREATED\tPARENT")
|
||||||
}
|
}
|
||||||
var allImages map[string]*Image
|
var allImages map[string]*Image
|
||||||
var err error
|
var err error
|
||||||
|
@ -647,7 +647,7 @@ func (srv *Server) CmdPs(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
||||||
}
|
}
|
||||||
w := tabwriter.NewWriter(stdout, 12, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(stdout, 12, 1, 3, ' ', 0)
|
||||||
if !*quiet {
|
if !*quiet {
|
||||||
fmt.Fprintf(w, "ID\tIMAGE\tCOMMAND\tCREATED\tSTATUS\tCOMMENT\n")
|
fmt.Fprintln(w, "ID\tIMAGE\tCOMMAND\tCREATED\tSTATUS\tCOMMENT")
|
||||||
}
|
}
|
||||||
for _, container := range srv.runtime.List() {
|
for _, container := range srv.runtime.List() {
|
||||||
if !container.State.Running && !*flAll {
|
if !container.State.Running && !*flAll {
|
||||||
|
|
|
@ -458,8 +458,8 @@ func (container *Container) Stop() error {
|
||||||
|
|
||||||
// 1. Send a SIGTERM
|
// 1. Send a SIGTERM
|
||||||
if output, err := exec.Command("lxc-kill", "-n", container.Id, "15").CombinedOutput(); err != nil {
|
if output, err := exec.Command("lxc-kill", "-n", container.Id, "15").CombinedOutput(); err != nil {
|
||||||
log.Printf(string(output))
|
log.Print(string(output))
|
||||||
log.Printf("Failed to send SIGTERM to the process, force killing")
|
log.Print("Failed to send SIGTERM to the process, force killing")
|
||||||
if err := container.Kill(); err != nil {
|
if err := container.Kill(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ func ListenAndServeHTTP(addr string, service Service) error {
|
||||||
func(w http.ResponseWriter, r *http.Request) {
|
func(w http.ResponseWriter, r *http.Request) {
|
||||||
cmd, args := URLToCall(r.URL)
|
cmd, args := URLToCall(r.URL)
|
||||||
if err := call(service, r.Body, &AutoFlush{w}, append([]string{cmd}, args...)...); err != nil {
|
if err := call(service, r.Body, &AutoFlush{w}, append([]string{cmd}, args...)...); err != nil {
|
||||||
fmt.Fprintf(w, "Error: "+err.Error()+"\n")
|
fmt.Fprintln(w, "Error:", err.Error())
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ func ListenAndServe(proto, addr string, service Service) error {
|
||||||
CLIENT_SOCKET = conn
|
CLIENT_SOCKET = conn
|
||||||
}
|
}
|
||||||
if err := Serve(conn, service); err != nil {
|
if err := Serve(conn, service); err != nil {
|
||||||
log.Printf("Error: " + err.Error() + "\n")
|
log.Println("Error:", err.Error())
|
||||||
fmt.Fprintf(conn, "Error: "+err.Error()+"\n")
|
fmt.Fprintln(conn, "Error:", err.Error())
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue