mirror of https://github.com/docker/docs.git
go fmt
This commit is contained in:
parent
f8f9285cca
commit
94b1cf4be3
14
container.go
14
container.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/kr/pty"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
@ -13,7 +14,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"github.com/kr/pty"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Container struct {
|
type Container struct {
|
||||||
|
@ -41,10 +41,10 @@ type Container struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Hostname string
|
Hostname string
|
||||||
Ram int64
|
Ram int64
|
||||||
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
|
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
|
||||||
OpenStdin bool // Open stdin
|
OpenStdin bool // Open stdin
|
||||||
}
|
}
|
||||||
|
|
||||||
func createContainer(id string, root string, command string, args []string, layers []string, config *Config) (*Container, error) {
|
func createContainer(id string, root string, command string, args []string, layers []string, config *Config) (*Container, error) {
|
||||||
|
@ -67,7 +67,7 @@ func createContainer(id string, root string, command string, args []string, laye
|
||||||
if container.Config.OpenStdin {
|
if container.Config.OpenStdin {
|
||||||
container.stdin, container.stdinPipe = io.Pipe()
|
container.stdin, container.stdinPipe = io.Pipe()
|
||||||
} else {
|
} else {
|
||||||
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
|
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
|
||||||
}
|
}
|
||||||
container.stdout.AddWriter(NopWriteCloser(container.stdoutLog))
|
container.stdout.AddWriter(NopWriteCloser(container.stdoutLog))
|
||||||
container.stderr.AddWriter(NopWriteCloser(container.stderrLog))
|
container.stderr.AddWriter(NopWriteCloser(container.stderrLog))
|
||||||
|
@ -107,7 +107,7 @@ func loadContainer(containerPath string) (*Container, error) {
|
||||||
if container.Config.OpenStdin {
|
if container.Config.OpenStdin {
|
||||||
container.stdin, container.stdinPipe = io.Pipe()
|
container.stdin, container.stdinPipe = io.Pipe()
|
||||||
} else {
|
} else {
|
||||||
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
|
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
|
||||||
}
|
}
|
||||||
container.State = newState()
|
container.State = newState()
|
||||||
return container, nil
|
return container, nil
|
||||||
|
|
|
@ -117,7 +117,6 @@ func NewFromDirectory(root string) (*Docker, error) {
|
||||||
return docker, nil
|
return docker, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type History []*Container
|
type History []*Container
|
||||||
|
|
||||||
func (history *History) Len() int {
|
func (history *History) Len() int {
|
||||||
|
@ -140,4 +139,3 @@ func (history *History) Add(container *Container) {
|
||||||
*history = append(*history, container)
|
*history = append(*history, container)
|
||||||
sort.Sort(history)
|
sort.Sort(history)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue