Add deadcode linter.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-05-02 15:48:52 -04:00
parent 1378bf3dbe
commit 8f73a12f9b
8 changed files with 15 additions and 28 deletions

View File

@ -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 {

View File

@ -12,7 +12,6 @@ import (
const (
defaultSecretTableFormat = "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}\t{{.UpdatedAt}}"
secretIDHeader = "ID"
secretNameHeader = "NAME"
secretCreatedHeader = "CREATED"
secretUpdatedHeader = "UPDATED"
)

View File

@ -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

View File

@ -26,7 +26,6 @@ const (
flagExternalCA = "external-ca"
flagMaxSnapshots = "max-snapshots"
flagSnapshotInterval = "snapshot-interval"
flagLockKey = "lock-key"
flagAutolock = "autolock"
flagAvailability = "availability"
)

View File

@ -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) {

View File

@ -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),

View File

@ -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 {

View File

@ -4,5 +4,11 @@
"Exclude": ["cli/compose/schema/bindata.go"],
"DisableAll": true,
"Enable": ["gofmt", "vet", "golint", "goimports"]
"Enable": [
"gofmt",
"vet",
"golint",
"goimports",
"deadcode"
]
}