Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -13,14 +13,6 @@ import ( |
| 13 | 13 |
"google.golang.org/grpc/codes" |
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 |
-// httpStatusError is an interface |
|
| 17 |
-// that errors with custom status codes |
|
| 18 |
-// implement to tell the api layer |
|
| 19 |
-// which response status to set. |
|
| 20 |
-type httpStatusError interface {
|
|
| 21 |
- HTTPErrorStatusCode() int |
|
| 22 |
-} |
|
| 23 |
- |
|
| 24 | 16 |
type causer interface {
|
| 25 | 17 |
Cause() error |
| 26 | 18 |
} |
| ... | ... |
@@ -276,14 +276,6 @@ func (filters Args) Validate(accepted map[string]bool) error {
|
| 276 | 276 |
return nil |
| 277 | 277 |
} |
| 278 | 278 |
|
| 279 |
-type invalidFilterError string |
|
| 280 |
- |
|
| 281 |
-func (e invalidFilterError) Error() string {
|
|
| 282 |
- return "Invalid filter: '" + string(e) + "'" |
|
| 283 |
-} |
|
| 284 |
- |
|
| 285 |
-func (invalidFilterError) InvalidParameter() {}
|
|
| 286 |
- |
|
| 287 | 279 |
// WalkValues iterates over the list of filtered values for a field. |
| 288 | 280 |
// It stops the iteration if it finds an error and it returns that error. |
| 289 | 281 |
func (filters Args) WalkValues(field string, op func(value string) error) error {
|
| ... | ... |
@@ -9,6 +9,14 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 |
+// transportFunc allows us to inject a mock transport for testing. We define it |
|
| 13 |
+// here so we can detect the tlsconfig and return nil for only this type. |
|
| 14 |
+type transportFunc func(*http.Request) (*http.Response, error) |
|
| 15 |
+ |
|
| 16 |
+func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
| 17 |
+ return tf(req) |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 12 | 20 |
func newMockClient(doer func(*http.Request) (*http.Response, error)) *http.Client {
|
| 13 | 21 |
return &http.Client{
|
| 14 | 22 |
Transport: transportFunc(doer), |
| ... | ... |
@@ -5,14 +5,6 @@ import ( |
| 5 | 5 |
"net/http" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 |
-// transportFunc allows us to inject a mock transport for testing. We define it |
|
| 9 |
-// here so we can detect the tlsconfig and return nil for only this type. |
|
| 10 |
-type transportFunc func(*http.Request) (*http.Response, error) |
|
| 11 |
- |
|
| 12 |
-func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
| 13 |
- return tf(req) |
|
| 14 |
-} |
|
| 15 |
- |
|
| 16 | 8 |
// resolveTLSConfig attempts to resolve the TLS configuration from the |
| 17 | 9 |
// RoundTripper. |
| 18 | 10 |
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
|
| ... | ... |
@@ -5,27 +5,14 @@ package main |
| 5 | 5 |
import ( |
| 6 | 6 |
"fmt" |
| 7 | 7 |
"net" |
| 8 |
- "os" |
|
| 9 | 8 |
"path/filepath" |
| 10 | 9 |
|
| 11 | 10 |
"github.com/docker/docker/libcontainerd" |
| 12 |
- "github.com/docker/docker/pkg/system" |
|
| 13 | 11 |
"golang.org/x/sys/unix" |
| 14 | 12 |
) |
| 15 | 13 |
|
| 16 | 14 |
const defaultDaemonConfigFile = "" |
| 17 | 15 |
|
| 18 |
-// currentUserIsOwner checks whether the current user is the owner of the given |
|
| 19 |
-// file. |
|
| 20 |
-func currentUserIsOwner(f string) bool {
|
|
| 21 |
- if fileInfo, err := system.Stat(f); err == nil && fileInfo != nil {
|
|
| 22 |
- if int(fileInfo.UID()) == os.Getuid() {
|
|
| 23 |
- return true |
|
| 24 |
- } |
|
| 25 |
- } |
|
| 26 |
- return false |
|
| 27 |
-} |
|
| 28 |
- |
|
| 29 | 16 |
// setDefaultUmask sets the umask to 0022 to avoid problems |
| 30 | 17 |
// caused by custom umask |
| 31 | 18 |
func setDefaultUmask() error {
|
| ... | ... |
@@ -14,12 +14,6 @@ import ( |
| 14 | 14 |
|
| 15 | 15 |
var defaultDaemonConfigFile = "" |
| 16 | 16 |
|
| 17 |
-// currentUserIsOwner checks whether the current user is the owner of the given |
|
| 18 |
-// file. |
|
| 19 |
-func currentUserIsOwner(f string) bool {
|
|
| 20 |
- return false |
|
| 21 |
-} |
|
| 22 |
- |
|
| 23 | 17 |
// setDefaultUmask doesn't do anything on windows |
| 24 | 18 |
func setDefaultUmask() error {
|
| 25 | 19 |
return nil |
| ... | ... |
@@ -22,7 +22,7 @@ import ( |
| 22 | 22 |
"github.com/docker/libnetwork/netlabel" |
| 23 | 23 |
"github.com/docker/libnetwork/netutils" |
| 24 | 24 |
lntypes "github.com/docker/libnetwork/types" |
| 25 |
- "github.com/opencontainers/runtime-spec/specs-go" |
|
| 25 |
+ specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 26 | 26 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 27 | 27 |
"github.com/pkg/errors" |
| 28 | 28 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -32,10 +32,9 @@ import ( |
| 32 | 32 |
import "C" |
| 33 | 33 |
|
| 34 | 34 |
const ( |
| 35 |
- defaultVirtualSwitch = "Virtual Switch" |
|
| 36 |
- platformSupported = true |
|
| 37 |
- solarisMinCPUShares = 1 |
|
| 38 |
- solarisMaxCPUShares = 65535 |
|
| 35 |
+ platformSupported = true |
|
| 36 |
+ solarisMinCPUShares = 1 |
|
| 37 |
+ solarisMaxCPUShares = 65535 |
|
| 39 | 38 |
) |
| 40 | 39 |
|
| 41 | 40 |
func getMemoryResources(config containertypes.Resources) specs.CappedMemory {
|
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"os" |
| 6 | 6 |
"path/filepath" |
| 7 | 7 |
"strings" |
| 8 |
- "syscall" |
|
| 9 | 8 |
|
| 10 | 9 |
"github.com/Microsoft/hcsshim" |
| 11 | 10 |
"github.com/docker/docker/api/types" |
| ... | ... |
@@ -38,9 +37,6 @@ const ( |
| 38 | 38 |
windowsMaxCPUShares = 10000 |
| 39 | 39 |
windowsMinCPUPercent = 1 |
| 40 | 40 |
windowsMaxCPUPercent = 100 |
| 41 |
- windowsMinCPUCount = 1 |
|
| 42 |
- |
|
| 43 |
- errInvalidState = syscall.Errno(0x139F) |
|
| 44 | 41 |
) |
| 45 | 42 |
|
| 46 | 43 |
// Windows has no concept of an execution state directory. So use config.Root here. |
| ... | ... |
@@ -60,22 +56,6 @@ func parseSecurityOpt(container *container.Container, config *containertypes.Hos |
| 60 | 60 |
return nil |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
-func getBlkioReadIOpsDevices(config *containertypes.HostConfig) ([]blkiodev.ThrottleDevice, error) {
|
|
| 64 |
- return nil, nil |
|
| 65 |
-} |
|
| 66 |
- |
|
| 67 |
-func getBlkioWriteIOpsDevices(config *containertypes.HostConfig) ([]blkiodev.ThrottleDevice, error) {
|
|
| 68 |
- return nil, nil |
|
| 69 |
-} |
|
| 70 |
- |
|
| 71 |
-func getBlkioReadBpsDevices(config *containertypes.HostConfig) ([]blkiodev.ThrottleDevice, error) {
|
|
| 72 |
- return nil, nil |
|
| 73 |
-} |
|
| 74 |
- |
|
| 75 |
-func getBlkioWriteBpsDevices(config *containertypes.HostConfig) ([]blkiodev.ThrottleDevice, error) {
|
|
| 76 |
- return nil, nil |
|
| 77 |
-} |
|
| 78 |
- |
|
| 79 | 63 |
func (daemon *Daemon) getLayerInit() func(string) error {
|
| 80 | 64 |
return nil |
| 81 | 65 |
} |
| ... | ... |
@@ -2,22 +2,12 @@ package graphdriver |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 |
- "io" |
|
| 6 | 5 |
"path/filepath" |
| 7 | 6 |
|
| 8 | 7 |
"github.com/docker/docker/pkg/plugingetter" |
| 9 | 8 |
"github.com/docker/docker/plugin/v2" |
| 10 | 9 |
) |
| 11 | 10 |
|
| 12 |
-type pluginClient interface {
|
|
| 13 |
- // Call calls the specified method with the specified arguments for the plugin. |
|
| 14 |
- Call(string, interface{}, interface{}) error
|
|
| 15 |
- // Stream calls the specified method with the specified arguments for the plugin and returns the response IO stream |
|
| 16 |
- Stream(string, interface{}) (io.ReadCloser, error)
|
|
| 17 |
- // SendFile calls the specified method, and passes through the IO stream |
|
| 18 |
- SendFile(string, io.Reader, interface{}) error
|
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 | 11 |
func lookupPlugin(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) {
|
| 22 | 12 |
if !config.ExperimentalEnabled {
|
| 23 | 13 |
return nil, fmt.Errorf("graphdriver plugins are only supported with experimental mode")
|
| ... | ... |
@@ -45,8 +45,7 @@ const ( |
| 45 | 45 |
const ( |
| 46 | 46 |
// Exit status codes that can be returned by the probe command. |
| 47 | 47 |
|
| 48 |
- exitStatusHealthy = 0 // Container is healthy |
|
| 49 |
- exitStatusUnhealthy = 1 // Container is unhealthy |
|
| 48 |
+ exitStatusHealthy = 0 // Container is healthy |
|
| 50 | 49 |
) |
| 51 | 50 |
|
| 52 | 51 |
// probe implementations know how to run a particular type of probe. |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/pkg/mount" |
| 8 | 8 |
"github.com/docker/docker/pkg/plugingetter" |
| 9 |
- "github.com/docker/go-metrics" |
|
| 9 |
+ metrics "github.com/docker/go-metrics" |
|
| 10 | 10 |
"github.com/pkg/errors" |
| 11 | 11 |
"github.com/prometheus/client_golang/prometheus" |
| 12 | 12 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -16,7 +16,6 @@ const metricsPluginType = "MetricsCollector" |
| 16 | 16 |
|
| 17 | 17 |
var ( |
| 18 | 18 |
containerActions metrics.LabeledTimer |
| 19 |
- containerStates metrics.LabeledGauge |
|
| 20 | 19 |
imageActions metrics.LabeledTimer |
| 21 | 20 |
networkActions metrics.LabeledTimer |
| 22 | 21 |
engineInfo metrics.LabeledGauge |
| ... | ... |
@@ -60,12 +60,7 @@ install_gometalinter() {
|
| 60 | 60 |
cd "$GOPATH/src/github.com/alecthomas/gometalinter" |
| 61 | 61 |
git checkout -q "$GOMETALINTER_COMMIT" |
| 62 | 62 |
go build -o /usr/local/bin/gometalinter github.com/alecthomas/gometalinter |
| 63 |
- ( |
|
| 64 |
- export GOBIN=/usr/local/bin |
|
| 65 |
- export GOPATH="$PWD/_linters/" |
|
| 66 |
- go install github.com/golang/lint/golint |
|
| 67 |
- go install golang.org/x/tools/cmd/goimports |
|
| 68 |
- ) |
|
| 63 |
+ GOBIN=/usr/local/bin gometalinter --install |
|
| 69 | 64 |
} |
| 70 | 65 |
|
| 71 | 66 |
for prog in "$@" |
| ... | ... |
@@ -1,17 +1,11 @@ |
| 1 | 1 |
package foo |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "fmt" |
|
| 5 |
- |
|
| 6 | 4 |
aliasedio "io" |
| 7 | 5 |
|
| 8 | 6 |
"github.com/docker/docker/pkg/plugins/pluginrpc-gen/fixtures/otherfixture" |
| 9 | 7 |
) |
| 10 | 8 |
|
| 11 |
-var ( |
|
| 12 |
- errFakeImport = fmt.Errorf("just to import fmt for imports tests")
|
|
| 13 |
-) |
|
| 14 |
- |
|
| 15 | 9 |
type wobble struct {
|
| 16 | 10 |
Some string |
| 17 | 11 |
Val string |
| ... | ... |
@@ -32,7 +32,7 @@ import ( |
| 32 | 32 |
"github.com/docker/docker/pkg/system" |
| 33 | 33 |
"github.com/docker/docker/plugin/v2" |
| 34 | 34 |
refstore "github.com/docker/docker/reference" |
| 35 |
- "github.com/opencontainers/go-digest" |
|
| 35 |
+ digest "github.com/opencontainers/go-digest" |
|
| 36 | 36 |
"github.com/pkg/errors" |
| 37 | 37 |
"github.com/sirupsen/logrus" |
| 38 | 38 |
"golang.org/x/net/context" |
| ... | ... |
@@ -652,22 +652,6 @@ func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error {
|
| 652 | 652 |
return nil |
| 653 | 653 |
} |
| 654 | 654 |
|
| 655 |
-func getMounts(root string) ([]string, error) {
|
|
| 656 |
- infos, err := mount.GetMounts() |
|
| 657 |
- if err != nil {
|
|
| 658 |
- return nil, errors.Wrap(err, "failed to read mount table") |
|
| 659 |
- } |
|
| 660 |
- |
|
| 661 |
- var mounts []string |
|
| 662 |
- for _, m := range infos {
|
|
| 663 |
- if strings.HasPrefix(m.Mountpoint, root) {
|
|
| 664 |
- mounts = append(mounts, m.Mountpoint) |
|
| 665 |
- } |
|
| 666 |
- } |
|
| 667 |
- |
|
| 668 |
- return mounts, nil |
|
| 669 |
-} |
|
| 670 |
- |
|
| 671 | 655 |
// Set sets plugin args |
| 672 | 656 |
func (pm *Manager) Set(name string, args []string) error {
|
| 673 | 657 |
p, err := pm.config.Store.GetV2Plugin(name) |
| ... | ... |
@@ -32,6 +32,7 @@ func NewVolumeDriver(name string, baseHostPath string, c client) volume.Driver {
|
| 32 | 32 |
// volumeDriver defines the available functions that volume plugins must implement. |
| 33 | 33 |
// This interface is only defined to generate the proxy objects. |
| 34 | 34 |
// It's not intended to be public or reused. |
| 35 |
+// nolint: deadcode |
|
| 35 | 36 |
type volumeDriver interface {
|
| 36 | 37 |
// Create a volume with the given name |
| 37 | 38 |
Create(name string, opts map[string]string) (err error) |
| ... | ... |
@@ -183,13 +183,6 @@ func validateNotRoot(p string) error {
|
| 183 | 183 |
return nil |
| 184 | 184 |
} |
| 185 | 185 |
|
| 186 |
-func validateCopyMode(mode bool) error {
|
|
| 187 |
- if mode {
|
|
| 188 |
- return fmt.Errorf("Windows does not support copying image path content")
|
|
| 189 |
- } |
|
| 190 |
- return nil |
|
| 191 |
-} |
|
| 192 |
- |
|
| 193 | 186 |
func convertSlash(p string) string {
|
| 194 | 187 |
return filepath.FromSlash(p) |
| 195 | 188 |
} |