mirror of https://github.com/docker/cli.git
Add deadcode linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
1378bf3dbe
commit
8f73a12f9b
|
@ -7,8 +7,6 @@ import (
|
||||||
eventtypes "github.com/docker/docker/api/types/events"
|
eventtypes "github.com/docker/docker/api/types/events"
|
||||||
)
|
)
|
||||||
|
|
||||||
type eventProcessor func(eventtypes.Message, error) error
|
|
||||||
|
|
||||||
// EventHandler is abstract interface for user to customize
|
// EventHandler is abstract interface for user to customize
|
||||||
// own handle functions of each type of events
|
// own handle functions of each type of events
|
||||||
type EventHandler interface {
|
type EventHandler interface {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
const (
|
const (
|
||||||
defaultSecretTableFormat = "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}\t{{.UpdatedAt}}"
|
defaultSecretTableFormat = "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}\t{{.UpdatedAt}}"
|
||||||
secretIDHeader = "ID"
|
secretIDHeader = "ID"
|
||||||
secretNameHeader = "NAME"
|
|
||||||
secretCreatedHeader = "CREATED"
|
secretCreatedHeader = "CREATED"
|
||||||
secretUpdatedHeader = "UPDATED"
|
secretUpdatedHeader = "UPDATED"
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,6 @@ import (
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||||
"github.com/docker/go-connections/nat"
|
|
||||||
"github.com/docker/swarmkit/api/defaults"
|
"github.com/docker/swarmkit/api/defaults"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -585,10 +584,6 @@ func envKey(value string) string {
|
||||||
return kv[0]
|
return kv[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
func itemKey(value string) string {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildToRemoveSet(flags *pflag.FlagSet, flag string) map[string]struct{} {
|
func buildToRemoveSet(flags *pflag.FlagSet, flag string) map[string]struct{} {
|
||||||
var empty struct{}
|
var empty struct{}
|
||||||
toRemove := make(map[string]struct{})
|
toRemove := make(map[string]struct{})
|
||||||
|
@ -826,11 +821,6 @@ func equalPublishMode(mode1, mode2 swarm.PortConfigPublishMode) bool {
|
||||||
(mode2 == swarm.PortConfigPublishMode("") && mode1 == swarm.PortConfigPublishModeIngress)
|
(mode2 == swarm.PortConfigPublishMode("") && mode1 == swarm.PortConfigPublishModeIngress)
|
||||||
}
|
}
|
||||||
|
|
||||||
func equalPort(targetPort nat.Port, port swarm.PortConfig) bool {
|
|
||||||
return (string(port.Protocol) == targetPort.Proto() &&
|
|
||||||
port.TargetPort == uint32(targetPort.Int()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateReplicas(flags *pflag.FlagSet, serviceMode *swarm.ServiceMode) error {
|
func updateReplicas(flags *pflag.FlagSet, serviceMode *swarm.ServiceMode) error {
|
||||||
if !flags.Changed(flagReplicas) {
|
if !flags.Changed(flagReplicas) {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -26,7 +26,6 @@ const (
|
||||||
flagExternalCA = "external-ca"
|
flagExternalCA = "external-ca"
|
||||||
flagMaxSnapshots = "max-snapshots"
|
flagMaxSnapshots = "max-snapshots"
|
||||||
flagSnapshotInterval = "snapshot-interval"
|
flagSnapshotInterval = "snapshot-interval"
|
||||||
flagLockKey = "lock-key"
|
|
||||||
flagAutolock = "autolock"
|
flagAutolock = "autolock"
|
||||||
flagAvailability = "availability"
|
flagAvailability = "availability"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -23,10 +22,6 @@ import (
|
||||||
yaml "gopkg.in/yaml.v2"
|
yaml "gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
fieldNameRegexp = regexp.MustCompile("[A-Z][a-z0-9]+")
|
|
||||||
)
|
|
||||||
|
|
||||||
// ParseYAML reads the bytes from a file, parses the bytes into a mapping
|
// ParseYAML reads the bytes from a file, parses the bytes into a mapping
|
||||||
// structure, and returns it.
|
// structure, and returns it.
|
||||||
func ParseYAML(source []byte) (map[string]interface{}, error) {
|
func ParseYAML(source []byte) (map[string]interface{}, error) {
|
||||||
|
|
|
@ -9,6 +9,14 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// transportFunc allows us to inject a mock transport for testing. We define it
|
||||||
|
// here so we can detect the tlsconfig and return nil for only this type.
|
||||||
|
type transportFunc func(*http.Request) (*http.Response, error)
|
||||||
|
|
||||||
|
func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
return tf(req)
|
||||||
|
}
|
||||||
|
|
||||||
func newMockClient(doer func(*http.Request) (*http.Response, error)) *http.Client {
|
func newMockClient(doer func(*http.Request) (*http.Response, error)) *http.Client {
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: transportFunc(doer),
|
Transport: transportFunc(doer),
|
||||||
|
|
|
@ -5,14 +5,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// transportFunc allows us to inject a mock transport for testing. We define it
|
|
||||||
// here so we can detect the tlsconfig and return nil for only this type.
|
|
||||||
type transportFunc func(*http.Request) (*http.Response, error)
|
|
||||||
|
|
||||||
func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
||||||
return tf(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// resolveTLSConfig attempts to resolve the TLS configuration from the
|
// resolveTLSConfig attempts to resolve the TLS configuration from the
|
||||||
// RoundTripper.
|
// RoundTripper.
|
||||||
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
|
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
|
||||||
|
|
|
@ -4,5 +4,11 @@
|
||||||
"Exclude": ["cli/compose/schema/bindata.go"],
|
"Exclude": ["cli/compose/schema/bindata.go"],
|
||||||
|
|
||||||
"DisableAll": true,
|
"DisableAll": true,
|
||||||
"Enable": ["gofmt", "vet", "golint", "goimports"]
|
"Enable": [
|
||||||
|
"gofmt",
|
||||||
|
"vet",
|
||||||
|
"golint",
|
||||||
|
"goimports",
|
||||||
|
"deadcode"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue