浏览代码

fix merge issue and gofmt

Victor Vieux 11 年之前
父节点
当前提交
89fb51f606
共有 5 个文件被更改,包括 12 次插入11 次删除
  1. 1 1
      network.go
  2. 0 2
      runtime_test.go
  3. 3 0
      server.go
  4. 5 5
      state.go
  5. 3 3
      utils_test.go

+ 1 - 1
network.go

@@ -5,8 +5,8 @@ import (
 	"errors"
 	"fmt"
 	"github.com/dotcloud/docker/iptables"
-	"github.com/dotcloud/docker/proxy"
 	"github.com/dotcloud/docker/netlink"
+	"github.com/dotcloud/docker/proxy"
 	"github.com/dotcloud/docker/utils"
 	"log"
 	"net"

+ 0 - 2
runtime_test.go

@@ -95,7 +95,6 @@ func init() {
 	startFds, startGoroutines = utils.GetTotalUsedFds(), runtime.NumGoroutine()
 }
 
-
 func setupBaseImage() {
 	config := &DaemonConfig{
 		GraphPath:   unitTestStoreBase,
@@ -123,7 +122,6 @@ func setupBaseImage() {
 	}
 }
 
-
 func spawnGlobalDaemon() {
 	if globalRuntime != nil {
 		utils.Debugf("Global runtime already exists. Skipping.")

+ 3 - 0
server.go

@@ -1216,6 +1216,9 @@ func (srv *Server) ContainerStart(name string, hostConfig *HostConfig) error {
 			}
 
 			childName := parts["name"]
+			if childName[0] != '/' {
+				childName = "/" + childName
+			}
 			if err := runtime.Link(fmt.Sprintf("/%s", container.ID), childName, parts["alias"]); err != nil {
 				return err
 			}

+ 5 - 5
state.go

@@ -9,12 +9,12 @@ import (
 
 type State struct {
 	sync.Mutex
-	Running   bool
-	Pid       int
-	ExitCode  int
-	StartedAt time.Time
+	Running    bool
+	Pid        int
+	ExitCode   int
+	StartedAt  time.Time
 	FinishedAt time.Time
-	Ghost     bool
+	Ghost      bool
 }
 
 // String returns a human-readable description of the state

+ 3 - 3
utils_test.go

@@ -1,15 +1,15 @@
 package docker
 
 import (
-	"github.com/dotcloud/docker/utils"
 	"fmt"
+	"github.com/dotcloud/docker/utils"
 	"io"
 	"io/ioutil"
 	"os"
 	"path"
+	"runtime"
 	"strings"
 	"testing"
-	"runtime"
 )
 
 // This file contains utility functions for docker's unit test suite.
@@ -26,7 +26,7 @@ func mkRuntime(f Fataler) *Runtime {
 	pc, _, _, _ := runtime.Caller(1)
 	callerLongName := runtime.FuncForPC(pc).Name()
 	parts := strings.Split(callerLongName, ".")
-	callerShortName := parts[len(parts) - 1]
+	callerShortName := parts[len(parts)-1]
 	if globalTestID == "" {
 		globalTestID = GenerateID()[:4]
 	}