Merge pull request #35823 from thaJeztah/remove-dead-code

Remove dead code and redundant build tags
This commit is contained in:
Yong Tang 2017-12-18 18:05:05 -06:00 committed by GitHub
commit c492e76d13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 0 additions and 363 deletions

View file

@ -1,9 +0,0 @@
package main
import (
"github.com/docker/docker/daemon/config"
"github.com/spf13/pflag"
)
func attachExperimentalFlags(conf *config.Config, cmd *pflag.FlagSet) {
}

View file

@ -1,17 +0,0 @@
package main
import (
"github.com/docker/docker/daemon/config"
"github.com/spf13/pflag"
)
// installConfigFlags adds flags to the pflag.FlagSet to configure the daemon
func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
// First handle install flags which are consistent cross-platform
installCommonConfigFlags(conf, flags)
// Then install flags common to unix platforms
installUnixConfigFlags(conf, flags)
attachExperimentalFlags(conf, flags)
}

View file

@ -44,6 +44,4 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
flags.Var(&conf.ShmSize, "default-shm-size", "Default shm size for containers")
flags.BoolVar(&conf.NoNewPrivileges, "no-new-privileges", false, "Set no-new-privileges by default for new containers")
flags.StringVar(&conf.IpcMode, "default-ipc-mode", config.DefaultIpcMode, `Default mode for containers ipc ("shareable" | "private")`)
attachExperimentalFlags(conf, flags)
}

View file

@ -1,5 +1,3 @@
// +build linux
package main
import systemdDaemon "github.com/coreos/go-systemd/daemon"

View file

@ -1,5 +1,3 @@
// +build windows
package container
import (

View file

@ -1,7 +0,0 @@
package container
// setFromExitStatus is a platform specific helper function to set the state
// based on the ExitStatus structure.
func (s *State) setFromExitStatus(exitStatus *ExitStatus) {
s.ExitCodeValue = exitStatus.ExitCode
}

View file

@ -1,5 +1,3 @@
// +build windows
package daemon
import (

View file

@ -1,5 +1,3 @@
// +build linux
package cluster
import (

View file

@ -1,57 +0,0 @@
package cluster
import (
"bufio"
"fmt"
"net"
"os/exec"
"strings"
)
func (c *Cluster) resolveSystemAddr() (net.IP, error) {
defRouteCmd := "/usr/sbin/ipadm show-addr -p -o addr " +
"`/usr/sbin/route get default | /usr/bin/grep interface | " +
"/usr/bin/awk '{print $2}'`"
out, err := exec.Command("/usr/bin/bash", "-c", defRouteCmd).Output()
if err != nil {
return nil, fmt.Errorf("cannot get default route: %v", err)
}
defInterface := strings.SplitN(string(out), "/", 2)
defInterfaceIP := net.ParseIP(defInterface[0])
return defInterfaceIP, nil
}
func listSystemIPs() []net.IP {
var systemAddrs []net.IP
cmd := exec.Command("/usr/sbin/ipadm", "show-addr", "-p", "-o", "addr")
cmdReader, err := cmd.StdoutPipe()
if err != nil {
return nil
}
if err := cmd.Start(); err != nil {
return nil
}
scanner := bufio.NewScanner(cmdReader)
go func() {
for scanner.Scan() {
text := scanner.Text()
nameAddrPair := strings.SplitN(text, "/", 2)
// Let go of loopback interfaces and docker interfaces
systemAddrs = append(systemAddrs, net.ParseIP(nameAddrPair[0]))
}
}()
if err := scanner.Err(); err != nil {
fmt.Printf("scan underwent err: %+v\n", err)
}
if err := cmd.Wait(); err != nil {
fmt.Printf("run command wait: %+v\n", err)
}
return systemAddrs
}

View file

@ -1,30 +0,0 @@
package config
// Config defines the configuration of a docker daemon.
// These are the configuration settings that you pass
// to the docker daemon when you launch it with say: `docker -d -e lxc`
type Config struct {
CommonConfig
// These fields are common to all unix platforms.
CommonUnixConfig
}
// BridgeConfig stores all the bridge driver specific
// configuration.
type BridgeConfig struct {
commonBridgeConfig
// Fields below here are platform specific.
commonUnixBridgeConfig
}
// IsSwarmCompatible defines if swarm mode can be enabled in this config
func (conf *Config) IsSwarmCompatible() error {
return nil
}
// ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
func (conf *Config) ValidatePlatformConfig() error {
return nil
}

View file

@ -1,5 +1,3 @@
// +build linux
package daemon
func configsSupported() bool {

View file

@ -1,5 +1,3 @@
// +build windows
package daemon
func configsSupported() bool {

View file

@ -1,5 +1,3 @@
//+build windows
package daemon
import (

View file

@ -1,7 +0,0 @@
package daemon
import "github.com/docker/docker/api/types/container"
func (daemon *Daemon) verifyExperimentalContainerSettings(hostConfig *container.HostConfig, config *container.Config) ([]string, error) {
return nil, nil
}

View file

@ -574,11 +574,6 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
var warnings []string
sysInfo := sysinfo.New(true)
warnings, err := daemon.verifyExperimentalContainerSettings(hostConfig, config)
if err != nil {
return warnings, err
}
w, err := verifyContainerResources(&hostConfig.Resources, sysInfo, update)
// no matter err is nil or not, w could have data in itself.

View file

@ -1,11 +0,0 @@
package daemon
import (
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/exec"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
func (daemon *Daemon) execSetPlatformOpt(_ *container.Container, _ *exec.Config, _ *specs.Process) error {
return nil
}

View file

@ -1,5 +1,3 @@
// +build linux
package graphdriver
import (

View file

@ -1,5 +1,3 @@
// +build linux
package vfs
import "github.com/docker/docker/daemon/graphdriver/copy"

View file

@ -1,5 +1,3 @@
// +build linux
package vfs
import "github.com/docker/docker/daemon/graphdriver/quota"

View file

@ -1,5 +1,3 @@
// +build windows
package initlayer
import (

View file

@ -1,5 +1,3 @@
// +build !windows
package daemon
import (

View file

@ -1,27 +0,0 @@
package daemon
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/versions/v1p19"
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/exec"
)
// This sets platform-specific fields
func setPlatformSpecificContainerFields(container *container.Container, contJSONBase *types.ContainerJSONBase) *types.ContainerJSONBase {
return contJSONBase
}
// containerInspectPre120 get containers for pre 1.20 APIs.
func (daemon *Daemon) containerInspectPre120(name string) (*v1p19.ContainerJSON, error) {
return &v1p19.ContainerJSON{}, nil
}
func inspectExecProcessConfig(e *exec.Config) *backend.ExecProcessConfig {
return &backend.ExecProcessConfig{
Tty: e.Tty,
Entrypoint: e.Entrypoint,
Arguments: e.Args,
}
}

View file

@ -1,5 +1,3 @@
// +build !windows
package listeners
import (

View file

@ -1,43 +0,0 @@
package listeners
import (
"crypto/tls"
"fmt"
"net"
"os"
"github.com/docker/go-connections/sockets"
"github.com/sirupsen/logrus"
)
// Init creates new listeners for the server.
func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) (ls []net.Listener, err error) {
switch proto {
case "tcp":
l, err := sockets.NewTCPSocket(addr, tlsConfig)
if err != nil {
return nil, err
}
ls = append(ls, l)
case "unix":
gid, err := lookupGID(socketGroup)
if err != nil {
if socketGroup != "" {
if socketGroup != defaultSocketGroup {
return nil, err
}
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
}
gid = os.Getgid()
}
l, err := sockets.NewUnixSocket(addr, gid)
if err != nil {
return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
}
ls = append(ls, l)
default:
return nil, fmt.Errorf("Invalid protocol format: %q", proto)
}
return
}

View file

@ -1,5 +1,3 @@
// +build linux
package gcplogs
import (

View file

@ -1,11 +0,0 @@
package daemon
import (
"github.com/docker/docker/container"
"github.com/docker/docker/libcontainerd"
)
// postRunProcessing perfoms any processing needed on the container after it has stopped.
func (daemon *Daemon) postRunProcessing(_ *container.Container, _ libcontainerd.EventInfo) error {
return nil
}

View file

@ -1,5 +1,3 @@
// +build linux
package daemon
func secretsSupported() bool {

View file

@ -1,5 +1,3 @@
// +build windows
package daemon
func secretsSupported() bool {

View file

@ -1,5 +1,3 @@
// +build linux
package daemon
import "github.com/opencontainers/selinux/go-selinux"

View file

@ -1,5 +1,3 @@
// +build windows
package stats
// platformNewStatsCollector performs platform specific initialisation of the

View file

@ -1,5 +1,3 @@
// +build linux
package daemon
import (

View file

@ -1,11 +0,0 @@
package daemon
import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/libcontainerd"
)
func toContainerdResources(resources container.Resources) libcontainerd.Resources {
var r libcontainerd.Resources
return r
}

View file

@ -1,5 +1,3 @@
// +build windows
package daemon
import (

View file

@ -1,5 +1,3 @@
// +build windows
package daemon
import (

View file

@ -1,5 +1,3 @@
// +build windows
package distribution
import (

View file

@ -1,5 +1,3 @@
// +build windows
package opts
// DefaultHost constant defines the default host string used by docker on Windows

View file

@ -1,5 +1,3 @@
// +build windows
package archive
import (

View file

@ -1,5 +1,3 @@
// +build windows
package directory
import (

View file

@ -1,5 +1,3 @@
// +build linux
package dmesg
import (

View file

@ -1,5 +1,3 @@
// +build linux
package fsutils
import (

View file

@ -1,5 +1,3 @@
// +build linux
package homedir
import (

View file

@ -1,5 +1,3 @@
// +build windows
package idtools
import (

View file

@ -1,5 +1,3 @@
// +build windows
package ioutils
import (

View file

@ -1,5 +1,3 @@
// +build linux
package mount
import (

View file

@ -1,5 +1,3 @@
// +build linux
package mount
// MakeShared ensures a mounted filesystem has the SHARED mount option enabled.

View file

@ -1,5 +1,3 @@
// +build windows
package kernel
import (

View file

@ -1,5 +1,3 @@
// +build linux
package reexec
import (

View file

@ -1,5 +1,3 @@
// +build windows
package reexec
import (

View file

@ -1,5 +1,3 @@
// +build windows
package signal
import (

View file

@ -1,5 +1,3 @@
// +build linux
package sysinfo
import (

View file

@ -1,5 +1,3 @@
// +build windows
package sysinfo
import (

View file

@ -1,5 +1,3 @@
// +build windows
package sysinfo
// New returns an empty SysInfo for windows for now.

View file

@ -1,5 +1,3 @@
// +build windows
package system
import (

View file

@ -1,5 +1,3 @@
// +build windows
package system
import (

View file

@ -1,5 +1,3 @@
// +build windows
package system
// Mknod is not implemented on Windows.

View file

@ -1,5 +1,3 @@
// +build windows
package system
// Umask is not supported on the windows platform.

View file

@ -1,5 +1,3 @@
// +build windows
package term
import (

View file

@ -1,5 +1,3 @@
// +build linux
package plugin
import (

View file

@ -1,5 +1,3 @@
// +build linux
package plugin
import (

View file

@ -1,30 +0,0 @@
package plugin
import (
"fmt"
"github.com/docker/docker/plugin/v2"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
return fmt.Errorf("Not implemented")
}
func (pm *Manager) initSpec(p *v2.Plugin) (*specs.Spec, error) {
return nil, fmt.Errorf("Not implemented")
}
func (pm *Manager) disable(p *v2.Plugin, c *controller) error {
return fmt.Errorf("Not implemented")
}
func (pm *Manager) restore(p *v2.Plugin) error {
return fmt.Errorf("Not implemented")
}
// Shutdown plugins
func (pm *Manager) Shutdown() {
}
func setupRoot(root string) error { return nil }

View file

@ -1,5 +1,3 @@
// +build windows
package plugin
import (

View file

@ -1,5 +1,3 @@
// +build linux
package v2
import (