mirror of
https://github.com/docker/compose.git
synced 2026-02-09 01:59:22 +08:00
fix linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Nicolas De loof
parent
f2b14fe1aa
commit
89d3944837
@@ -22,6 +22,7 @@ const (
|
|||||||
// TemplateLegacyJSON the legacy json formatting value using go template
|
// TemplateLegacyJSON the legacy json formatting value using go template
|
||||||
TemplateLegacyJSON = "{{json.}}"
|
TemplateLegacyJSON = "{{json.}}"
|
||||||
// PRETTY is the constant for default formats on list commands
|
// PRETTY is the constant for default formats on list commands
|
||||||
|
//
|
||||||
// Deprecated: use TABLE
|
// Deprecated: use TABLE
|
||||||
PRETTY = "pretty"
|
PRETTY = "pretty"
|
||||||
// TABLE Print output in table format with column headers (default)
|
// TABLE Print output in table format with column headers (default)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func TestPrint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
assert.NilError(t, Print(testList, PRETTY, b, func(w io.Writer) {
|
assert.NilError(t, Print(testList, TABLE, b, func(w io.Writer) {
|
||||||
for _, t := range testList {
|
for _, t := range testList {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\n", t.Name, t.Status)
|
_, _ = fmt.Fprintf(w, "%s\t%s\n", t.Name, t.Status)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,12 +95,18 @@ func (s *composeService) buildProjectOptions(options api.ProjectLoadOptions, rem
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts = append(opts,
|
opts = append(opts,
|
||||||
|
// Load PWD/.env if present and no explicit --env-file has been set
|
||||||
cli.WithEnvFiles(options.EnvFiles...),
|
cli.WithEnvFiles(options.EnvFiles...),
|
||||||
|
// read dot env file to populate project environment
|
||||||
cli.WithDotEnv,
|
cli.WithDotEnv,
|
||||||
|
// get compose file path set by COMPOSE_FILE
|
||||||
cli.WithConfigFileEnv,
|
cli.WithConfigFileEnv,
|
||||||
|
// if none was selected, get default compose.yaml file from current dir or parent folder
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
|
// .. and then, a project directory != PWD maybe has been set so let's load .env file
|
||||||
cli.WithEnvFiles(options.EnvFiles...),
|
cli.WithEnvFiles(options.EnvFiles...),
|
||||||
cli.WithDotEnv,
|
cli.WithDotEnv,
|
||||||
|
// eventually COMPOSE_PROFILES should have been set
|
||||||
cli.WithDefaultProfiles(options.Profiles...),
|
cli.WithDefaultProfiles(options.Profiles...),
|
||||||
cli.WithName(options.ProjectName),
|
cli.WithName(options.ProjectName),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ func (s *composeService) ensureModels(ctx context.Context, project *types.Projec
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
api, err := s.newModelAPI(project)
|
mdlAPI, err := s.newModelAPI(project)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer api.Close()
|
defer mdlAPI.Close()
|
||||||
availableModels, err := api.ListModels(ctx)
|
availableModels, err := mdlAPI.ListModels(ctx)
|
||||||
|
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
return api.SetModelVariables(ctx, project)
|
return mdlAPI.SetModelVariables(ctx, project)
|
||||||
})
|
})
|
||||||
|
|
||||||
for name, config := range project.Models {
|
for name, config := range project.Models {
|
||||||
@@ -57,12 +57,12 @@ func (s *composeService) ensureModels(ctx context.Context, project *types.Projec
|
|||||||
}
|
}
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
if !slices.Contains(availableModels, config.Model) {
|
if !slices.Contains(availableModels, config.Model) {
|
||||||
err = api.PullModel(ctx, config, quietPull, s.events)
|
err = mdlAPI.PullModel(ctx, config, quietPull, s.events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return api.ConfigureModel(ctx, config, s.events)
|
return mdlAPI.ConfigureModel(ctx, config, s.events)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return eg.Wait()
|
return eg.Wait()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2020 Docker Compose CLI authors
|
Copyright 2020 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 Docker Compose CLI authors
|
Copyright 2022 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 Docker Compose CLI authors
|
Copyright 2022 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 Docker Compose CLI authors
|
Copyright 2022 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 Docker Compose CLI authors
|
Copyright 2022 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build darwin
|
//go:build darwin
|
||||||
// +build darwin
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2020 Docker Compose CLI authors
|
Copyright 2020 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !darwin
|
//go:build !darwin
|
||||||
// +build !darwin
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2020 Docker Compose CLI authors
|
Copyright 2020 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2020 Docker Compose CLI authors
|
Copyright 2020 Docker Compose CLI authors
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
// +build windows
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2020 Docker Compose CLI authors
|
Copyright 2020 Docker Compose CLI authors
|
||||||
|
|||||||
Reference in New Issue
Block a user