зеркало из https://github.com/docker/compose-cli.git
Linter fixes
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Родитель
25b335924c
Коммит
81c53672d5
|
@ -231,7 +231,7 @@ func (cs *aciComposeService) Ps(ctx context.Context, projectName string, options
|
|||
}
|
||||
|
||||
func checkUnsupportedPsOptions(ctx context.Context, o api.PsOptions) error {
|
||||
return utils.CheckUnsupported(ctx,nil, o.All, false, "ps", "all")
|
||||
return utils.CheckUnsupported(ctx, nil, o.All, false, "ps", "all")
|
||||
}
|
||||
|
||||
func (cs *aciComposeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) {
|
||||
|
|
|
@ -27,7 +27,11 @@ import (
|
|||
"github.com/docker/compose-cli/api/context/store"
|
||||
)
|
||||
|
||||
const ContextTypeKey = "context_type"
|
||||
// ContextKey defines a type for keys in the context passed
|
||||
type ContextKey string
|
||||
|
||||
// ContextTypeKey is the key for context type stored in context.Context
|
||||
const ContextTypeKey ContextKey = "context_type"
|
||||
|
||||
var configDir string
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@ type ConfigFlags struct {
|
|||
|
||||
// AddConfigFlags adds persistent (global) flags
|
||||
func (c *ConfigFlags) AddConfigFlags(flags *pflag.FlagSet) {
|
||||
flags.StringVar(&c.Config, config.ConfigFlagName, ConfDir(), "Location of the client config files `DIRECTORY`")
|
||||
flags.StringVar(&c.Config, config.ConfigFlagName, confDir(), "Location of the client config files `DIRECTORY`")
|
||||
}
|
||||
|
||||
func ConfDir() string {
|
||||
func confDir() string {
|
||||
env := os.Getenv("DOCKER_CONFIG")
|
||||
if env != "" {
|
||||
return env
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// CheckUnsupported checks if a flag was used when it shouldn't and adds an error in case
|
||||
func CheckUnsupported(ctx context.Context, errs error, toCheck, expectedValue interface{}, commandName, msg string) error {
|
||||
if !(isNil(toCheck) && isNil(expectedValue)) && toCheck != expectedValue {
|
||||
ctype := ctx.Value(config.ContextTypeKey).(string)
|
||||
|
|
|
@ -62,4 +62,4 @@ func isNil(i interface{}) bool {
|
|||
return reflect.ValueOf(i).IsNil()
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче