mirror of https://github.com/docker/cli.git
Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
3e3934c19f
commit
3724fb7f37
|
@ -111,12 +111,7 @@ func runExec(dockerCli command.Cli, options *execOptions, container string, exec
|
|||
Tty: execConfig.Tty,
|
||||
}
|
||||
|
||||
if err := client.ContainerExecStart(ctx, execID, execStartCheck); err != nil {
|
||||
return err
|
||||
}
|
||||
// For now don't print this - wait for when we support exec wait()
|
||||
// fmt.Fprintf(dockerCli.Out(), "%s\n", execID)
|
||||
return nil
|
||||
return client.ContainerExecStart(ctx, execID, execStartCheck)
|
||||
}
|
||||
|
||||
// Interactive exec requested.
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
deviceCgroupRuleRegexp = regexp.MustCompile("^[acb] ([0-9]+|\\*):([0-9]+|\\*) [rwm]{1,3}$")
|
||||
deviceCgroupRuleRegexp = regexp.MustCompile(`^[acb] ([0-9]+|\*):([0-9]+|\*) [rwm]{1,3}$`)
|
||||
)
|
||||
|
||||
// containerOptions is a data object with all the options for creating a container
|
||||
|
|
|
@ -65,7 +65,7 @@ reclaimable: {{.Reclaimable}}
|
|||
}
|
||||
|
||||
func (ctx *DiskUsageContext) Write() (err error) {
|
||||
if ctx.Verbose == false {
|
||||
if !ctx.Verbose {
|
||||
ctx.buffer = bytes.NewBufferString("")
|
||||
ctx.preFormat()
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
|||
|
||||
// getMaxLength gets the maximum length of the number in base 10
|
||||
func getMaxLength(i int) int {
|
||||
return len(strconv.FormatInt(int64(i), 10))
|
||||
return len(strconv.Itoa(i))
|
||||
}
|
||||
|
||||
type taskFormatter struct {
|
||||
|
|
|
@ -354,7 +354,7 @@ func convertNetworks(ctx context.Context, apiClient client.NetworkAPIClient, net
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
netAttach = append(netAttach, swarm.NetworkAttachmentConfig{Target: net.Target, Aliases: net.Aliases, DriverOpts: net.DriverOpts})
|
||||
netAttach = append(netAttach, swarm.NetworkAttachmentConfig(net))
|
||||
}
|
||||
sort.Sort(byNetworkTarget(netAttach))
|
||||
return netAttach, nil
|
||||
|
|
|
@ -134,11 +134,8 @@ func getConfigDetails(composefile string) (composetypes.ConfigDetails, error) {
|
|||
// TODO: support multiple files
|
||||
details.ConfigFiles = []composetypes.ConfigFile{*configFile}
|
||||
details.Environment, err = buildEnvironment(os.Environ())
|
||||
if err != nil {
|
||||
return details, err
|
||||
}
|
||||
return details, nil
|
||||
}
|
||||
|
||||
func buildEnvironment(env []string) (map[string]string, error) {
|
||||
result := make(map[string]string, len(env))
|
||||
|
|
|
@ -69,7 +69,7 @@ func getStacks(ctx context.Context, apiclient client.APIClient) ([]*formatter.St
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := make(map[string]*formatter.Stack, 0)
|
||||
m := make(map[string]*formatter.Stack)
|
||||
for _, service := range services {
|
||||
labels := service.Spec.Labels
|
||||
name, ok := labels[convert.LabelNamespace]
|
||||
|
|
|
@ -263,7 +263,7 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
|
|||
if info.RegistryConfig != nil && (len(info.RegistryConfig.InsecureRegistryCIDRs) > 0 || len(info.RegistryConfig.IndexConfigs) > 0) {
|
||||
fmt.Fprintln(dockerCli.Out(), "Insecure Registries:")
|
||||
for _, registry := range info.RegistryConfig.IndexConfigs {
|
||||
if registry.Secure == false {
|
||||
if !registry.Secure {
|
||||
fmt.Fprintf(dockerCli.Out(), " %s\n", registry.Name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -563,9 +563,6 @@ func convertCredentialSpec(spec composetypes.CredentialSpecConfig) (*swarm.Crede
|
|||
if spec.File != "" && spec.Registry != "" {
|
||||
return nil, errors.New("Invalid credential spec - must provide one of `File` or `Registry`")
|
||||
}
|
||||
|
||||
return &swarm.CredentialSpec{
|
||||
File: spec.File,
|
||||
Registry: spec.Registry,
|
||||
}, nil
|
||||
swarmCredSpec := swarm.CredentialSpec(spec)
|
||||
return &swarmCredSpec, nil
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ac, _ := fileConfigs[registry] // might contain Email
|
||||
ac := fileConfigs[registry] // might contain Email
|
||||
ac.Username = creds.Username
|
||||
ac.Password = creds.Password
|
||||
ac.IdentityToken = creds.IdentityToken
|
||||
|
|
|
@ -53,8 +53,7 @@ func (c *fakeStore) Get(serverAddress string) (types.AuthConfig, error) {
|
|||
if c.getFunc != nil {
|
||||
return c.getFunc(serverAddress)
|
||||
}
|
||||
authConfig, _ := c.store[serverAddress]
|
||||
return authConfig, nil
|
||||
return c.store[serverAddress], nil
|
||||
}
|
||||
|
||||
func (c *fakeStore) GetAll() (map[string]types.AuthConfig, error) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Vendor": true,
|
||||
"Deadline": "5m",
|
||||
"Deadline": "8m",
|
||||
"Sort": ["linter", "severity", "path"],
|
||||
"Exclude": ["cli/compose/schema/bindata.go"],
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
|||
"gofmt",
|
||||
"goimports",
|
||||
"golint",
|
||||
"gosimple",
|
||||
"ineffassign",
|
||||
"interfacer",
|
||||
"lll",
|
||||
|
|
|
@ -75,12 +75,7 @@ func (opt *WeightdeviceOpt) String() string {
|
|||
|
||||
// GetList returns a slice of pointers to WeightDevices.
|
||||
func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice {
|
||||
var weightdevice []*blkiodev.WeightDevice
|
||||
for _, v := range opt.values {
|
||||
weightdevice = append(weightdevice, v)
|
||||
}
|
||||
|
||||
return weightdevice
|
||||
return opt.values
|
||||
}
|
||||
|
||||
// Type returns the option type
|
||||
|
|
Loading…
Reference in New Issue