From 8dd88afb5b5f8ce353c00bfc71edf8238f3a0452 Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Wed, 16 Mar 2016 19:15:14 -0700 Subject: [PATCH] remove dead code Signed-off-by: Jessica Frazelle --- api/client/build.go | 16 ---------- builder/dockerfile/dispatchers.go | 5 ---- daemon/config_unix.go | 1 - daemon/config_windows.go | 1 - daemon/execdriver/native/init.go | 5 ---- daemon/execdriver/windows/run.go | 4 --- daemon/info.go | 11 ------- daemon/logger/fluentd/fluentd.go | 10 +++---- daemon/volumes_unix.go | 49 ------------------------------- 9 files changed, 4 insertions(+), 98 deletions(-) diff --git a/api/client/build.go b/api/client/build.go index eef716a99e..81d369086b 100644 --- a/api/client/build.go +++ b/api/client/build.go @@ -286,22 +286,6 @@ func validateTag(rawRepo string) (string, error) { return rawRepo, nil } -// writeToFile copies from the given reader and writes it to a file with the -// given filename. -func writeToFile(r io.Reader, filename string) error { - file, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0600)) - if err != nil { - return fmt.Errorf("unable to create file: %v", err) - } - defer file.Close() - - if _, err := io.Copy(file, r); err != nil { - return fmt.Errorf("unable to write file: %v", err) - } - - return nil -} - var dockerfileFromLinePattern = regexp.MustCompile(`(?i)^[\s]*FROM[ \f\r\t\v]+(?P[^ \f\r\t\v\n#]+)`) // resolvedTag records the repository, tag, and resolved digest reference diff --git a/builder/dockerfile/dispatchers.go b/builder/dockerfile/dispatchers.go index cc2d177ccd..6323b75621 100644 --- a/builder/dockerfile/dispatchers.go +++ b/builder/dockerfile/dispatchers.go @@ -27,11 +27,6 @@ import ( "github.com/docker/go-connections/nat" ) -// dispatch with no layer / parsing. This is effectively not a command. -func nullDispatch(b *Builder, args []string, attributes map[string]bool, original string) error { - return nil -} - // ENV foo bar // // Sets the environment variable foo to bar, also makes interpolation diff --git a/daemon/config_unix.go b/daemon/config_unix.go index 044b5d1cea..1047f00f1e 100644 --- a/daemon/config_unix.go +++ b/daemon/config_unix.go @@ -14,7 +14,6 @@ import ( var ( defaultPidFile = "/var/run/docker.pid" defaultGraph = "/var/lib/docker" - defaultExec = "native" ) // Config defines the configuration of a docker daemon. diff --git a/daemon/config_windows.go b/daemon/config_windows.go index 9d5d61bffb..81480ad80b 100644 --- a/daemon/config_windows.go +++ b/daemon/config_windows.go @@ -9,7 +9,6 @@ import ( var ( defaultPidFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker.pid" defaultGraph = os.Getenv("programdata") + string(os.PathSeparator) + "docker" - defaultExec = "windows" ) // bridgeConfig stores all the bridge driver specific diff --git a/daemon/execdriver/native/init.go b/daemon/execdriver/native/init.go index 307b5b1b80..015b1678c3 100644 --- a/daemon/execdriver/native/init.go +++ b/daemon/execdriver/native/init.go @@ -38,8 +38,3 @@ func initializer() { panic("unreachable") } - -func writeError(err error) { - fmt.Fprint(os.Stderr, err) - os.Exit(1) -} diff --git a/daemon/execdriver/windows/run.go b/daemon/execdriver/windows/run.go index 6ecfee4e36..8c13448b15 100644 --- a/daemon/execdriver/windows/run.go +++ b/daemon/execdriver/windows/run.go @@ -36,10 +36,6 @@ type layer struct { Path string } -type defConfig struct { - DefFile string -} - type portBinding struct { Protocol string InternalPort int diff --git a/daemon/info.go b/daemon/info.go index 2750447ce7..5db37f8a32 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -3,7 +3,6 @@ package daemon import ( "os" "runtime" - "strings" "sync/atomic" "time" @@ -163,13 +162,3 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo { return pluginsInfo } - -// The uppercase and the lowercase are available for the proxy settings. -// See the Go specification for details on these variables. https://golang.org/pkg/net/http/ -func getProxyEnv(key string) string { - proxyValue := os.Getenv(strings.ToUpper(key)) - if proxyValue == "" { - return os.Getenv(strings.ToLower(key)) - } - return proxyValue -} diff --git a/daemon/logger/fluentd/fluentd.go b/daemon/logger/fluentd/fluentd.go index 788482b8bb..648e845dd4 100644 --- a/daemon/logger/fluentd/fluentd.go +++ b/daemon/logger/fluentd/fluentd.go @@ -24,12 +24,10 @@ type fluentd struct { } const ( - name = "fluentd" - defaultHostName = "localhost" - defaultPort = 24224 - defaultTagPrefix = "docker" - defaultIgnoreConnectErrorOnStart = false // So that we do not break existing behaviour - defaultBufferLimit = 1 * 1024 * 1024 // 1M buffer by default + name = "fluentd" + defaultHostName = "localhost" + defaultPort = 24224 + defaultBufferLimit = 1 * 1024 * 1024 // 1M buffer by default ) func init() { diff --git a/daemon/volumes_unix.go b/daemon/volumes_unix.go index f257da770c..2668114f47 100644 --- a/daemon/volumes_unix.go +++ b/daemon/volumes_unix.go @@ -10,8 +10,6 @@ import ( "github.com/docker/docker/container" "github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/volume" - volumedrivers "github.com/docker/docker/volume/drivers" - "github.com/docker/docker/volume/local" ) // setupMounts iterates through each of the mount points for a container and @@ -70,53 +68,6 @@ func sortMounts(m []execdriver.Mount) []execdriver.Mount { return m } -// migrateVolume links the contents of a volume created pre Docker 1.7 -// into the location expected by the local driver. -// It creates a symlink from DOCKER_ROOT/vfs/dir/VOLUME_ID to DOCKER_ROOT/volumes/VOLUME_ID/_container_data. -// It preserves the volume json configuration generated pre Docker 1.7 to be able to -// downgrade from Docker 1.7 to Docker 1.6 without losing volume compatibility. -func migrateVolume(id, vfs string) error { - l, err := volumedrivers.Lookup(volume.DefaultDriverName) - if err != nil { - return err - } - - newDataPath := l.(*local.Root).DataPath(id) - fi, err := os.Stat(newDataPath) - if err != nil && !os.IsNotExist(err) { - return err - } - - if fi != nil && fi.IsDir() { - return nil - } - - return os.Symlink(vfs, newDataPath) -} - -// validVolumeLayout checks whether the volume directory layout -// is valid to work with Docker post 1.7 or not. -func validVolumeLayout(files []os.FileInfo) bool { - if len(files) == 1 && files[0].Name() == local.VolumeDataPathName && files[0].IsDir() { - return true - } - - if len(files) != 2 { - return false - } - - for _, f := range files { - if f.Name() == "config.json" || - (f.Name() == local.VolumeDataPathName && f.Mode()&os.ModeSymlink == os.ModeSymlink) { - // Old volume configuration, we ignore it - continue - } - return false - } - - return true -} - // setBindModeIfNull is platform specific processing to ensure the // shared mode is set to 'z' if it is null. This is called in the case // of processing a named volume and not a typical bind.