From 51cdfbdfc767d5858f3bfeceaadecbb26a0555e6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 11 Nov 2025 01:04:30 +0100 Subject: [PATCH 1/2] fix linting issues Signed-off-by: Sebastiaan van Stijn --- cmd/formatter/consts.go | 1 + cmd/formatter/formatter_test.go | 2 +- pkg/compose/loader.go | 6 ++++++ pkg/compose/model.go | 12 ++++++------ pkg/e2e/cancel_test.go | 1 - pkg/e2e/cascade_test.go | 1 - pkg/e2e/container_name_test.go | 1 - pkg/e2e/noDeps_test.go | 1 - pkg/e2e/up_test.go | 1 - pkg/watch/watcher_darwin.go | 1 - pkg/watch/watcher_naive.go | 1 - pkg/watch/watcher_nonwin.go | 1 - pkg/watch/watcher_windows.go | 1 - 13 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cmd/formatter/consts.go b/cmd/formatter/consts.go index c60338ad9bf..0ae447c432f 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 9da0dc85c6e..07b152559c1 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 41d414089bf..9b39ab74b41 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, + // .. and then, a project directory != PWD maybe has been set so let's load .env file cli.WithEnvFiles(options.EnvFiles...), cli.WithDotEnv, + // 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 10af138753c..0629013d9b6 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 51c20062f0b..3e8e760ae29 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 e5b2ac141e0..5bb23e1db54 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 1ddc489a196..99de738c237 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 fad86f2fea6..85f3872f7e9 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 a13ff63da51..d659c973693 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 01c1fb6c908..0e8fdb4e061 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 555bb5596b6..f13a679d86c 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 36071331887..37222663b07 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 69af1ea5d01..a632967d772 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 From 022da41b3b8a042f6fc62e645ac712fcefa57a9b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 11 Nov 2025 01:04:30 +0100 Subject: [PATCH 2/2] Dockerfile: update golangci-lint to v2.6.2 Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 2 +- cmd/compose/compose.go | 4 ++-- pkg/compose/loader.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9b47ed8594d..1488c84e1d9 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 fef0ed45f6e..6f6502e9d64 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/pkg/compose/loader.go b/pkg/compose/loader.go index 9b39ab74b41..6e203012cd2 100644 --- a/pkg/compose/loader.go +++ b/pkg/compose/loader.go @@ -104,8 +104,8 @@ func (s *composeService) buildProjectOptions(options api.ProjectLoadOptions, rem // 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(options.EnvFiles...), - cli.WithDotEnv, + 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),