From 333abbf85a8db9578e34c340032e32de3c8fefe8 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Mon, 28 Jan 2013 14:30:05 -0800 Subject: [PATCH] go fmt --- container.go | 21 +++++++++------------ filesystem.go | 14 ++++++++------ state.go | 5 ++--- utils.go | 2 +- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/container.go b/container.go index fb75b8f69a..959879cea6 100644 --- a/container.go +++ b/container.go @@ -1,6 +1,7 @@ package docker import ( + "bytes" "encoding/json" "errors" "io" @@ -9,10 +10,9 @@ import ( "os" "os/exec" "path" + "strings" "syscall" "time" - "strings" - "bytes" ) type Container struct { @@ -33,8 +33,8 @@ type Container struct { stdout *writeBroadcaster stderr *writeBroadcaster - stdoutLog *bytes.Buffer - stderrLog *bytes.Buffer + stdoutLog *bytes.Buffer + stderrLog *bytes.Buffer } type Config struct { @@ -56,8 +56,8 @@ func createContainer(id string, root string, command string, args []string, laye lxcConfigPath: path.Join(root, "config.lxc"), stdout: newWriteBroadcaster(), stderr: newWriteBroadcaster(), - stdoutLog: new(bytes.Buffer), - stderrLog: new(bytes.Buffer), + stdoutLog: new(bytes.Buffer), + stderrLog: new(bytes.Buffer), } container.stdout.AddWriter(NopWriteCloser(container.stdoutLog)) container.stderr.AddWriter(NopWriteCloser(container.stderrLog)) @@ -83,8 +83,8 @@ func loadContainer(containerPath string) (*Container, error) { return nil, err } container := &Container{ - stdout: newWriteBroadcaster(), - stderr: newWriteBroadcaster(), + stdout: newWriteBroadcaster(), + stderr: newWriteBroadcaster(), stdoutLog: new(bytes.Buffer), stderrLog: new(bytes.Buffer), } @@ -98,7 +98,6 @@ func loadContainer(containerPath string) (*Container, error) { return container, nil } - func (container *Container) Cmd() *exec.Cmd { return container.cmd } @@ -135,7 +134,7 @@ func (container *Container) SetUserData(key, value string) error { return container.saveUserData(data) } -func (container *Container) GetUserData(key string) (string) { +func (container *Container) GetUserData(key string) string { data, err := container.loadUserData() if err != nil { return "" @@ -146,7 +145,6 @@ func (container *Container) GetUserData(key string) (string) { return "" } - func (container *Container) save() (err error) { data, err := json.Marshal(container) if err != nil { @@ -226,7 +224,6 @@ func (container *Container) StdoutLog() io.Reader { return strings.NewReader(container.stdoutLog.String()) } - func (container *Container) StderrPipe() (io.ReadCloser, error) { reader, writer := io.Pipe() container.stderr.AddWriter(writer) diff --git a/filesystem.go b/filesystem.go index 030625a150..096268396a 100644 --- a/filesystem.go +++ b/filesystem.go @@ -3,13 +3,13 @@ package docker import ( "errors" "fmt" + "io" + "io/ioutil" "os" "path/filepath" "strings" "syscall" "time" - "io" - "io/ioutil" ) type Filesystem struct { @@ -104,7 +104,6 @@ func (fs *Filesystem) Tar() (io.Reader, error) { return Tar(fs.RootFS) } - func (fs *Filesystem) EnsureMounted() error { if !fs.IsMounted() { if err := fs.Mount(); err != nil { @@ -130,9 +129,12 @@ type Change struct { func (change *Change) String() string { var kind string switch change.Kind { - case ChangeModify: kind = "C" - case ChangeAdd: kind = "A" - case ChangeDelete: kind = "D" + case ChangeModify: + kind = "C" + case ChangeAdd: + kind = "A" + case ChangeDelete: + kind = "D" } return fmt.Sprintf("%s %s", kind, change.Path) } diff --git a/state.go b/state.go index bdd1d9cd2c..dfcf6c25a6 100644 --- a/state.go +++ b/state.go @@ -1,10 +1,10 @@ package docker import ( - "sync" - "time" "fmt" "github.com/dotcloud/docker/future" + "sync" + "time" ) type State struct { @@ -17,7 +17,6 @@ type State struct { stateChangeCond *sync.Cond } - func newState() *State { lock := new(sync.Mutex) return &State{ diff --git a/utils.go b/utils.go index c1e6695f05..034b561013 100644 --- a/utils.go +++ b/utils.go @@ -4,8 +4,8 @@ import ( "bytes" "container/list" "io" - "sync" "os/exec" + "sync" ) // Tar generates a tar archive from a filesystem path, and returns it as a stream.