diff --git a/Dockerfile b/Dockerfile index 9b47ed8594..1488c84e1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ARG GO_VERSION=1.24.9 ARG XX_VERSION=1.6.1 -ARG GOLANGCI_LINT_VERSION=v2.0.2 +ARG GOLANGCI_LINT_VERSION=v2.6.2 ARG ADDLICENSE_VERSION=v1.0.0 ARG BUILD_TAGS="e2e" diff --git a/cmd/compose/compose.go b/cmd/compose/compose.go index fef0ed45f6..6f6502e9d6 100644 --- a/cmd/compose/compose.go +++ b/cmd/compose/compose.go @@ -393,8 +393,8 @@ func (o *ProjectOptions) toProjectOptions(po ...cli.ProjectOptionsFn) (*cli.Proj // if none was selected, get default compose.yaml file from current dir or parent folder cli.WithDefaultConfigPath, // .. and then, a project directory != PWD maybe has been set so let's load .env file - cli.WithEnvFiles(o.EnvFiles...), - cli.WithDotEnv, + cli.WithEnvFiles(o.EnvFiles...), //nolint:gocritic // intentionally applying cli.WithEnvFiles twice. + cli.WithDotEnv, //nolint:gocritic // intentionally applying cli.WithDotEnv twice. // eventually COMPOSE_PROFILES should have been set cli.WithDefaultProfiles(o.Profiles...), cli.WithName(o.ProjectName), diff --git a/cmd/formatter/consts.go b/cmd/formatter/consts.go index c60338ad9b..0ae447c432 100644 --- a/cmd/formatter/consts.go +++ b/cmd/formatter/consts.go @@ -22,6 +22,7 @@ const ( // TemplateLegacyJSON the legacy json formatting value using go template TemplateLegacyJSON = "{{json.}}" // PRETTY is the constant for default formats on list commands + // // Deprecated: use TABLE PRETTY = "pretty" // TABLE Print output in table format with column headers (default) diff --git a/cmd/formatter/formatter_test.go b/cmd/formatter/formatter_test.go index 9da0dc85c6..07b152559c 100644 --- a/cmd/formatter/formatter_test.go +++ b/cmd/formatter/formatter_test.go @@ -45,7 +45,7 @@ func TestPrint(t *testing.T) { } 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 { _, _ = fmt.Fprintf(w, "%s\t%s\n", t.Name, t.Status) } diff --git a/pkg/compose/loader.go b/pkg/compose/loader.go index 41d414089b..6e203012cd 100644 --- a/pkg/compose/loader.go +++ b/pkg/compose/loader.go @@ -95,12 +95,18 @@ func (s *composeService) buildProjectOptions(options api.ProjectLoadOptions, rem } opts = append(opts, + // Load PWD/.env if present and no explicit --env-file has been set cli.WithEnvFiles(options.EnvFiles...), + // read dot env file to populate project environment cli.WithDotEnv, + // get compose file path set by COMPOSE_FILE cli.WithConfigFileEnv, + // if none was selected, get default compose.yaml file from current dir or parent folder cli.WithDefaultConfigPath, - cli.WithEnvFiles(options.EnvFiles...), - cli.WithDotEnv, + // .. and then, a project directory != PWD maybe has been set so let's load .env file + cli.WithEnvFiles(options.EnvFiles...), //nolint:gocritic // intentionally applying cli.WithEnvFiles twice. + cli.WithDotEnv, //nolint:gocritic // intentionally applying cli.WithDotEnv twice. + // eventually COMPOSE_PROFILES should have been set cli.WithDefaultProfiles(options.Profiles...), cli.WithName(options.ProjectName), ) diff --git a/pkg/compose/model.go b/pkg/compose/model.go index 10af138753..0629013d9b 100644 --- a/pkg/compose/model.go +++ b/pkg/compose/model.go @@ -39,16 +39,16 @@ func (s *composeService) ensureModels(ctx context.Context, project *types.Projec return nil } - api, err := s.newModelAPI(project) + mdlAPI, err := s.newModelAPI(project) if err != nil { return err } - defer api.Close() - availableModels, err := api.ListModels(ctx) + defer mdlAPI.Close() + availableModels, err := mdlAPI.ListModels(ctx) eg, ctx := errgroup.WithContext(ctx) eg.Go(func() error { - return api.SetModelVariables(ctx, project) + return mdlAPI.SetModelVariables(ctx, project) }) for name, config := range project.Models { @@ -57,12 +57,12 @@ func (s *composeService) ensureModels(ctx context.Context, project *types.Projec } eg.Go(func() error { 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 { return err } } - return api.ConfigureModel(ctx, config, s.events) + return mdlAPI.ConfigureModel(ctx, config, s.events) }) } return eg.Wait() diff --git a/pkg/e2e/cancel_test.go b/pkg/e2e/cancel_test.go index 51c20062f0..3e8e760ae2 100644 --- a/pkg/e2e/cancel_test.go +++ b/pkg/e2e/cancel_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2020 Docker Compose CLI authors diff --git a/pkg/e2e/cascade_test.go b/pkg/e2e/cascade_test.go index e5b2ac141e..5bb23e1db5 100644 --- a/pkg/e2e/cascade_test.go +++ b/pkg/e2e/cascade_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2022 Docker Compose CLI authors diff --git a/pkg/e2e/container_name_test.go b/pkg/e2e/container_name_test.go index 1ddc489a19..99de738c23 100644 --- a/pkg/e2e/container_name_test.go +++ b/pkg/e2e/container_name_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2022 Docker Compose CLI authors diff --git a/pkg/e2e/noDeps_test.go b/pkg/e2e/noDeps_test.go index fad86f2fea..85f3872f7e 100644 --- a/pkg/e2e/noDeps_test.go +++ b/pkg/e2e/noDeps_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2022 Docker Compose CLI authors diff --git a/pkg/e2e/up_test.go b/pkg/e2e/up_test.go index a13ff63da5..d659c97369 100644 --- a/pkg/e2e/up_test.go +++ b/pkg/e2e/up_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2022 Docker Compose CLI authors diff --git a/pkg/watch/watcher_darwin.go b/pkg/watch/watcher_darwin.go index 01c1fb6c90..0e8fdb4e06 100644 --- a/pkg/watch/watcher_darwin.go +++ b/pkg/watch/watcher_darwin.go @@ -1,5 +1,4 @@ //go:build darwin -// +build darwin /* Copyright 2020 Docker Compose CLI authors diff --git a/pkg/watch/watcher_naive.go b/pkg/watch/watcher_naive.go index 555bb5596b..f13a679d86 100644 --- a/pkg/watch/watcher_naive.go +++ b/pkg/watch/watcher_naive.go @@ -1,5 +1,4 @@ //go:build !darwin -// +build !darwin /* Copyright 2020 Docker Compose CLI authors diff --git a/pkg/watch/watcher_nonwin.go b/pkg/watch/watcher_nonwin.go index 3607133188..37222663b0 100644 --- a/pkg/watch/watcher_nonwin.go +++ b/pkg/watch/watcher_nonwin.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2020 Docker Compose CLI authors diff --git a/pkg/watch/watcher_windows.go b/pkg/watch/watcher_windows.go index 69af1ea5d0..a632967d77 100644 --- a/pkg/watch/watcher_windows.go +++ b/pkg/watch/watcher_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows /* Copyright 2020 Docker Compose CLI authors