Add unconvert linter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
master
Daniel Nephin 2017-06-09 16:41:53 -04:00
parent a712993e93
commit 3bf0317fea
10 changed files with 15 additions and 21 deletions

View File

@ -171,11 +171,11 @@ func (c *containerContext) Command() string {
}
func (c *containerContext) CreatedAt() string {
return time.Unix(int64(c.c.Created), 0).String()
return time.Unix(c.c.Created, 0).String()
}
func (c *containerContext) RunningFor() string {
createdAt := time.Unix(int64(c.c.Created), 0)
createdAt := time.Unix(c.c.Created, 0)
return units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
}

View File

@ -79,21 +79,18 @@ func (c *historyContext) ID() string {
}
func (c *historyContext) CreatedAt() string {
var created string
created = units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(c.h.Created), 0)))
return created
return units.HumanDuration(time.Now().UTC().Sub(time.Unix(c.h.Created, 0)))
}
func (c *historyContext) CreatedSince() string {
var created string
created = units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(c.h.Created), 0)))
created := units.HumanDuration(time.Now().UTC().Sub(time.Unix(c.h.Created, 0)))
return created + " ago"
}
func (c *historyContext) CreatedBy() string {
createdBy := strings.Replace(c.h.CreatedBy, "\t", " ", -1)
if c.trunc {
createdBy = stringutils.Ellipsis(createdBy, 45)
return stringutils.Ellipsis(createdBy, 45)
}
return createdBy
}

View File

@ -234,12 +234,12 @@ func (c *imageContext) Digest() string {
}
func (c *imageContext) CreatedSince() string {
createdAt := time.Unix(int64(c.i.Created), 0)
createdAt := time.Unix(c.i.Created, 0)
return units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
}
func (c *imageContext) CreatedAt() string {
return time.Unix(int64(c.i.Created), 0).String()
return time.Unix(c.i.Created, 0).String()
}
func (c *imageContext) Size() string {

View File

@ -217,13 +217,13 @@ func parseExternalCA(caSpec string) (*swarm.ExternalCA, error) {
}
func addSwarmCAFlags(flags *pflag.FlagSet, opts *swarmOptions) {
flags.DurationVar(&opts.nodeCertExpiry, flagCertExpiry, time.Duration(90*24*time.Hour), "Validity period for node certificates (ns|us|ms|s|m|h)")
flags.DurationVar(&opts.nodeCertExpiry, flagCertExpiry, 90*24*time.Hour, "Validity period for node certificates (ns|us|ms|s|m|h)")
flags.Var(&opts.externalCA, flagExternalCA, "Specifications of one or more certificate signing endpoints")
}
func addSwarmFlags(flags *pflag.FlagSet, opts *swarmOptions) {
flags.Int64Var(&opts.taskHistoryLimit, flagTaskHistoryLimit, 5, "Task history retention limit")
flags.DurationVar(&opts.dispatcherHeartbeat, flagDispatcherHeartbeat, time.Duration(5*time.Second), "Dispatcher heartbeat period (ns|us|ms|s|m|h)")
flags.DurationVar(&opts.dispatcherHeartbeat, flagDispatcherHeartbeat, 5*time.Second, "Dispatcher heartbeat period (ns|us|ms|s|m|h)")
flags.Uint64Var(&opts.maxSnapshots, flagMaxSnapshots, 0, "Number of additional Raft snapshots to retain")
flags.SetAnnotation(flagMaxSnapshots, "version", []string{"1.25"})
flags.Uint64Var(&opts.snapshotInterval, flagSnapshotInterval, 10000, "Number of log entries between Raft snapshots")

View File

@ -5,7 +5,6 @@ import (
"io"
"sort"
"strings"
"time"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
@ -120,7 +119,7 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
fmt.Fprintf(dockerCli.Out(), " Heartbeat Tick: %d\n", info.Swarm.Cluster.Spec.Raft.HeartbeatTick)
fmt.Fprintf(dockerCli.Out(), " Election Tick: %d\n", info.Swarm.Cluster.Spec.Raft.ElectionTick)
fmt.Fprintf(dockerCli.Out(), " Dispatcher:\n")
fmt.Fprintf(dockerCli.Out(), " Heartbeat Period: %s\n", units.HumanDuration(time.Duration(info.Swarm.Cluster.Spec.Dispatcher.HeartbeatPeriod)))
fmt.Fprintf(dockerCli.Out(), " Heartbeat Period: %s\n", units.HumanDuration(info.Swarm.Cluster.Spec.Dispatcher.HeartbeatPeriod))
fmt.Fprintf(dockerCli.Out(), " CA Configuration:\n")
fmt.Fprintf(dockerCli.Out(), " Expiry Duration: %s\n", units.HumanDuration(info.Swarm.Cluster.Spec.CAConfig.NodeCertExpiry))
fmt.Fprintf(dockerCli.Out(), " Force Rotate: %d\n", info.Swarm.Cluster.Spec.CAConfig.ForceRotate)

View File

@ -161,7 +161,7 @@ func GetNotaryRepository(streams command.Streams, repoInfo *registry.RepositoryI
}
tokenHandler := auth.NewTokenHandlerWithOptions(tokenHandlerOptions)
basicHandler := auth.NewBasicHandler(creds)
modifiers = append(modifiers, transport.RequestModifier(auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler)))
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler))
tr := transport.NewTransport(base, modifiers...)
return client.NewNotaryRepository(

View File

@ -15,6 +15,7 @@
"interfacer",
"lll",
"misspell",
"unconvert",
"unused",
"vet"
],

View File

@ -179,7 +179,7 @@ func (opts *MapOpts) GetAll() map[string]string {
}
func (opts *MapOpts) String() string {
return fmt.Sprintf("%v", map[string]string((opts.values)))
return fmt.Sprintf("%v", opts.values)
}
// Type returns a string name for this Option type

View File

@ -18,7 +18,7 @@ func (s *QuotedString) Type() string {
}
func (s *QuotedString) String() string {
return string(*s.value)
return *s.value
}
func trimQuotes(value string) string {

View File

@ -52,10 +52,7 @@ func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error) {
return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer", val)
}
return &blkiodev.ThrottleDevice{
Path: split[0],
Rate: uint64(rate),
}, nil
return &blkiodev.ThrottleDevice{Path: split[0], Rate: rate}, nil
}
// ThrottledeviceOpt defines a map of ThrottleDevices