Browse Source

Remove dead code

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Antonio Murdaca 10 years ago
parent
commit
927d13bc3c
8 changed files with 24 additions and 66 deletions
  1. 0 3
      daemon/daemon_unix.go
  2. 0 2
      daemon/daemon_windows.go
  3. 0 2
      docker/client.go
  4. 0 2
      docker/daemon.go
  5. 0 14
      graph/graph.go
  6. 0 24
      registry/registry.go
  7. 24 0
      registry/registry_test.go
  8. 0 19
      runconfig/parse.go

+ 0 - 3
daemon/daemon_unix.go

@@ -31,9 +31,6 @@ import (
 	"github.com/docker/libnetwork/options"
 )
 
-const runDir = "/var/run/docker"
-const defaultVolumesPathName = "volumes"
-
 func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error) {
 	initID := fmt.Sprintf("%s-init", container.ID)
 	return daemon.driver.Changes(container.ID, initID)

+ 0 - 2
daemon/daemon_windows.go

@@ -12,8 +12,6 @@ import (
 	"github.com/docker/libnetwork"
 )
 
-var runDir = os.Getenv("TEMP")
-
 func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error) {
 	return daemon.driver.Changes(container.ID, container.ImageID)
 }

+ 0 - 2
docker/client.go

@@ -6,8 +6,6 @@ import (
 	"log" // see gh#8745, client needs to use go log pkg
 )
 
-const CanDaemon = false
-
 func mainDaemon() {
 	log.Fatal("This is a client-only binary - running the Docker daemon is not supported.")
 }

+ 0 - 2
docker/daemon.go

@@ -24,8 +24,6 @@ import (
 	"github.com/docker/docker/utils"
 )
 
-const CanDaemon = true
-
 var (
 	daemonCfg   = &daemon.Config{}
 	registryCfg = &registry.Options{}

+ 0 - 14
graph/graph.go

@@ -270,20 +270,6 @@ func bufferToFile(f *os.File, src io.Reader) (int64, digest.Digest, error) {
 	return n, digest.NewDigest("sha256", h), nil
 }
 
-// Check if given error is "not empty".
-// Note: this is the way golang does it internally with os.IsNotExists.
-func isNotEmpty(err error) bool {
-	switch pe := err.(type) {
-	case nil:
-		return false
-	case *os.PathError:
-		err = pe.Err
-	case *os.LinkError:
-		err = pe.Err
-	}
-	return strings.Contains(err.Error(), " not empty")
-}
-
 // Delete atomically removes an image from the graph.
 func (graph *Graph) Delete(name string) error {
 	id, err := graph.idIndex.Get(name)

+ 0 - 24
registry/registry.go

@@ -8,7 +8,6 @@ import (
 	"io/ioutil"
 	"net"
 	"net/http"
-	"net/http/httputil"
 	"os"
 	"path"
 	"path/filepath"
@@ -200,29 +199,6 @@ func DockerHeaders(metaHeaders http.Header) []transport.RequestModifier {
 	return modifiers
 }
 
-type debugTransport struct {
-	http.RoundTripper
-	log func(...interface{})
-}
-
-func (tr debugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
-	dump, err := httputil.DumpRequestOut(req, false)
-	if err != nil {
-		tr.log("could not dump request")
-	}
-	tr.log(string(dump))
-	resp, err := tr.RoundTripper.RoundTrip(req)
-	if err != nil {
-		return nil, err
-	}
-	dump, err = httputil.DumpResponse(resp, false)
-	if err != nil {
-		tr.log("could not dump response")
-	}
-	tr.log(string(dump))
-	return resp, err
-}
-
 func HTTPClient(transport http.RoundTripper) *http.Client {
 	if transport == nil {
 		transport = NewTransport(ConnectTimeout, true)

+ 24 - 0
registry/registry_test.go

@@ -3,6 +3,7 @@ package registry
 import (
 	"fmt"
 	"net/http"
+	"net/http/httputil"
 	"net/url"
 	"strings"
 	"testing"
@@ -911,3 +912,26 @@ func TestIsSecureIndex(t *testing.T) {
 		}
 	}
 }
+
+type debugTransport struct {
+	http.RoundTripper
+	log func(...interface{})
+}
+
+func (tr debugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
+	dump, err := httputil.DumpRequestOut(req, false)
+	if err != nil {
+		tr.log("could not dump request")
+	}
+	tr.log(string(dump))
+	resp, err := tr.RoundTripper.RoundTrip(req)
+	if err != nil {
+		return nil, err
+	}
+	dump, err = httputil.DumpResponse(resp, false)
+	if err != nil {
+		tr.log("could not dump response")
+	}
+	tr.log(string(dump))
+	return resp, err
+}

+ 0 - 19
runconfig/parse.go

@@ -451,25 +451,6 @@ func ParseRestartPolicy(policy string) (RestartPolicy, error) {
 	return p, nil
 }
 
-// options will come in the format of name.key=value or name.option
-func parseDriverOpts(opts opts.ListOpts) (map[string][]string, error) {
-	out := make(map[string][]string, len(opts.GetAll()))
-	for _, o := range opts.GetAll() {
-		parts := strings.SplitN(o, ".", 2)
-		if len(parts) < 2 {
-			return nil, fmt.Errorf("invalid opt format %s", o)
-		} else if strings.TrimSpace(parts[0]) == "" {
-			return nil, fmt.Errorf("key cannot be empty %s", o)
-		}
-		values, exists := out[parts[0]]
-		if !exists {
-			values = []string{}
-		}
-		out[parts[0]] = append(values, parts[1])
-	}
-	return out, nil
-}
-
 func parseKeyValueOpts(opts opts.ListOpts) ([]KeyValuePair, error) {
 	out := make([]KeyValuePair, opts.Len())
 	for i, o := range opts.GetAll() {