diff --git a/cli/command/events_utils.go b/cli/command/events_utils.go index e710c97576..c271b20508 100644 --- a/cli/command/events_utils.go +++ b/cli/command/events_utils.go @@ -7,8 +7,6 @@ import ( eventtypes "github.com/docker/docker/api/types/events" ) -type eventProcessor func(eventtypes.Message, error) error - // EventHandler is abstract interface for user to customize // own handle functions of each type of events type EventHandler interface { diff --git a/cli/command/formatter/secret.go b/cli/command/formatter/secret.go index 7ec6f9a62e..46c97e2393 100644 --- a/cli/command/formatter/secret.go +++ b/cli/command/formatter/secret.go @@ -12,7 +12,6 @@ import ( const ( defaultSecretTableFormat = "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}\t{{.UpdatedAt}}" secretIDHeader = "ID" - secretNameHeader = "NAME" secretCreatedHeader = "CREATED" secretUpdatedHeader = "UPDATED" ) diff --git a/cli/command/service/update.go b/cli/command/service/update.go index 2845086217..0686850c94 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -16,7 +16,6 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/opts" runconfigopts "github.com/docker/docker/runconfig/opts" - "github.com/docker/go-connections/nat" "github.com/docker/swarmkit/api/defaults" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -585,10 +584,6 @@ func envKey(value string) string { return kv[0] } -func itemKey(value string) string { - return value -} - func buildToRemoveSet(flags *pflag.FlagSet, flag string) map[string]struct{} { var empty struct{} toRemove := make(map[string]struct{}) @@ -826,11 +821,6 @@ func equalPublishMode(mode1, mode2 swarm.PortConfigPublishMode) bool { (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 { if !flags.Changed(flagReplicas) { return nil diff --git a/cli/command/swarm/opts.go b/cli/command/swarm/opts.go index 6eddddccae..225d38d110 100644 --- a/cli/command/swarm/opts.go +++ b/cli/command/swarm/opts.go @@ -26,7 +26,6 @@ const ( flagExternalCA = "external-ca" flagMaxSnapshots = "max-snapshots" flagSnapshotInterval = "snapshot-interval" - flagLockKey = "lock-key" flagAutolock = "autolock" flagAvailability = "availability" ) diff --git a/cli/compose/loader/loader.go b/cli/compose/loader/loader.go index c6d92e4f26..a6a3409942 100644 --- a/cli/compose/loader/loader.go +++ b/cli/compose/loader/loader.go @@ -4,7 +4,6 @@ import ( "fmt" "path" "reflect" - "regexp" "sort" "strings" @@ -23,10 +22,6 @@ import ( 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 // structure, and returns it. func ParseYAML(source []byte) (map[string]interface{}, error) { diff --git a/client/client_mock_test.go b/client/client_mock_test.go index 0ab935d536..e75c3ecbfc 100644 --- a/client/client_mock_test.go +++ b/client/client_mock_test.go @@ -9,6 +9,14 @@ import ( "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 { return &http.Client{ Transport: transportFunc(doer), diff --git a/client/transport.go b/client/transport.go index 401ab15d30..73f6ef7b4d 100644 --- a/client/transport.go +++ b/client/transport.go @@ -5,14 +5,6 @@ import ( "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 // RoundTripper. func resolveTLSConfig(transport http.RoundTripper) *tls.Config { diff --git a/gometalinter.json b/gometalinter.json index c3ae185dbd..053fd2c155 100644 --- a/gometalinter.json +++ b/gometalinter.json @@ -4,5 +4,11 @@ "Exclude": ["cli/compose/schema/bindata.go"], "DisableAll": true, - "Enable": ["gofmt", "vet", "golint", "goimports"] + "Enable": [ + "gofmt", + "vet", + "golint", + "goimports", + "deadcode" + ] }