Merge pull request #35823 from thaJeztah/remove-dead-code
Remove dead code and redundant build tags
This commit is contained in:
commit
c492e76d13
62 changed files with 0 additions and 363 deletions
|
@ -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) {
|
||||
}
|
|
@ -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)
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
import systemdDaemon "github.com/coreos/go-systemd/daemon"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package cluster
|
||||
|
||||
import (
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package daemon
|
||||
|
||||
func configsSupported() bool {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package daemon
|
||||
|
||||
func configsSupported() bool {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
//+build windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package graphdriver
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package vfs
|
||||
|
||||
import "github.com/docker/docker/daemon/graphdriver/copy"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package vfs
|
||||
|
||||
import "github.com/docker/docker/daemon/graphdriver/quota"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package initlayer
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build !windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build !windows
|
||||
|
||||
package listeners
|
||||
|
||||
import (
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package gcplogs
|
||||
|
||||
import (
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package daemon
|
||||
|
||||
func secretsSupported() bool {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package daemon
|
||||
|
||||
func secretsSupported() bool {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package daemon
|
||||
|
||||
import "github.com/opencontainers/selinux/go-selinux"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package stats
|
||||
|
||||
// platformNewStatsCollector performs platform specific initialisation of the
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package distribution
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package opts
|
||||
|
||||
// DefaultHost constant defines the default host string used by docker on Windows
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package archive
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package directory
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package dmesg
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package fsutils
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package homedir
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package idtools
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package ioutils
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package mount
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package mount
|
||||
|
||||
// MakeShared ensures a mounted filesystem has the SHARED mount option enabled.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package kernel
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package reexec
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package reexec
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package signal
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package sysinfo
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package sysinfo
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package sysinfo
|
||||
|
||||
// New returns an empty SysInfo for windows for now.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package system
|
||||
|
||||
// Mknod is not implemented on Windows.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package system
|
||||
|
||||
// Umask is not supported on the windows platform.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
|
|
|
@ -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 }
|
|
@ -1,5 +1,3 @@
|
|||
// +build windows
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build linux
|
||||
|
||||
package v2
|
||||
|
||||
import (
|
||||
|
|
Loading…
Add table
Reference in a new issue