Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@thaJeztah
Copy link
Member


  • Use a errgroup.Group and add a appendErr utility to not fail-fast, but collect errors.
  • replace doneCh for a global context to cancel goroutines
  • Commented out attachCtx code, as it didn't appear to be functional (as it wouldn't be cancelled).

What I did

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

signalChan := make(chan os.Signal, 2)
defer close(signalChan)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(signalChan)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing the signalChan isn't needed for these; signal.Stop should be enough.

Comment on lines 141 to 143
select {
case <-doneCh:
case <-globalCtx.Done():
if watcher != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a bit of input from my AI friends to see if we could have everything handled through the context (there were some paths that were a bit involved, and I saw some paths were possibly errgroup.Wait were not handled).

So pay close attention if I did it right, as I'm not so familiar with this code ❤️ 🙈

Comment on lines 215 to 233
_, attachCtx := errgroup.WithContext(ctx)
containers, err := s.attach(attachCtx, project, printer.HandleEvent, options.Start.AttachTo)
//
// FIXME(thaJeztah): this context was never cancelled, so didn't add anything? See https://github.com/docker/compose/commit/2c12ad19db5003cdf4cc0de8711970dbb6914b17
// _, attachCtx := errgroup.WithContext(ctx)
// containers, err := s.attach(attachCtx, project, printer.HandleEvent, options.Start.AttachTo)
containers, err := s.attach(globalCtx, project, printer.HandleEvent, options.Start.AttachTo)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part seemed like it was not yet functional, or at least, the derived context was never cancelled, and the new error-group was discarded, so effectively it was just a copy of the context that was never cancelled (added in 2c12ad1)

I didn't remove the code yet, because it probably needs to be looked at, and either removed, or perhaps the "attach" ones being in their own errgroup? I wasn't sure, so could use input here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to me this is legacy code that wasn't removed during recent refactoring

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let me remove the comment and commented-out code

- Use a errgroup.Group and add a appendErr utility to not fail-fast,
  but collect errors.
- replace doneCh for a global context to cancel goroutines
- Commented out attachCtx code, as it didn't appear to be functional
  (as it wouldn't be cancelled).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the rm_multierror_step2 branch from 4a8f839 to 666906e Compare August 25, 2025 13:13
@thaJeztah thaJeztah marked this pull request as ready for review August 25, 2025 13:14
@thaJeztah thaJeztah requested a review from a team as a code owner August 25, 2025 13:14
@thaJeztah thaJeztah requested a review from glours August 25, 2025 13:14
@thaJeztah thaJeztah closed this Aug 26, 2025
@thaJeztah thaJeztah reopened this Aug 26, 2025
@thaJeztah
Copy link
Member Author

CI is green again; ptal @ndeloof 🤗

@ndeloof ndeloof merged commit 1d69f4a into docker:main Aug 27, 2025
48 of 51 checks passed
@thaJeztah thaJeztah deleted the rm_multierror_step2 branch August 27, 2025 14:06
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Sep 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [docker/compose](https://github.com/docker/compose) | patch | `v2.39.2` -> `v2.39.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>docker/compose (docker/compose)</summary>

### [`v2.39.3`](https://github.com/docker/compose/releases/tag/v2.39.3)

[Compare Source](docker/compose@v2.39.2...v2.39.3)

#### What's Changed

##### ✨ Improvements

- Add completions for the `--progress` flag by [@&#8203;m4rch3n1ng](https://github.com/m4rch3n1ng) in [#&#8203;13158](docker/compose#13158)

##### 🐛 Fixes

- Add `--provenance` and `--sbom` flag to generated `bake` command line, by [@&#8203;glours](https://github.com/glours) in [#&#8203;13147](docker/compose#13147)
- Fix runtime operations failing when env file is missing by [@&#8203;maxproske](https://github.com/maxproske) in [#&#8203;13156](docker/compose#13156)
- Check the assume yes publish flag command before the presence of bind mounts by [@&#8203;glours](https://github.com/glours) in [#&#8203;13151](docker/compose#13151)
- Fix: incorrect time when last tag time is not set by [@&#8203;kianelbo](https://github.com/kianelbo) in [#&#8203;13171](docker/compose#13171)
- Fix sigint/sigterm support in logs `--follow` by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13193](docker/compose#13193)
- Prefer application container vs one-off running `exec` without index by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13178](docker/compose#13178)
- Only force plain mode build if progress is set to `auto` by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13181](docker/compose#13181)
- Only propagate os.Env to bake, not the whole project.Environment by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13180](docker/compose#13180)
- Detect container is restarted by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13210](docker/compose#13210)
- Fix run `--build` support for `service:* reference` in additional\_context by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13183](docker/compose#13183)
- Detect compose run wit `--host` and set `DOCKER_HOST` accordingly running bake by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13182](docker/compose#13182)

##### 🔧  Internal

- Refactor to use maps.Copy by [@&#8203;cuiweixie](https://github.com/cuiweixie) in [#&#8203;13174](docker/compose#13174)
- Replace most uses of hashicorp/go-multierror for stdlib by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13176](docker/compose#13176)
- pkg/compose: composeService.Up: rewrite without go-multierror by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13177](docker/compose#13177)
- Use enum-consts for State and Health by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13186](docker/compose#13186)
- Unquote volume names in creation events by [@&#8203;rrjjvv](https://github.com/rrjjvv) in [#&#8203;13188](docker/compose#13188)
- pkg/compose: use state consts from moby API by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13216](docker/compose#13216)
- Document (hidden) `--tty` `--interactive` flags by [@&#8203;ndeloof](https://github.com/ndeloof) in [#&#8203;13201](docker/compose#13201)

##### ⚙️ Dependencies

- go.mod: github.com/docker/buildx v0.27.0 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13170](docker/compose#13170)
- Build(deps): bump go.uber.org/mock from 0.5.2 to 0.6.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13162](docker/compose#13162)
- go.mod: bump buildkit v0.24.0-rc1, buildx v0.28.0-rc1 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13185](docker/compose#13185)
- Build(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13184](docker/compose#13184)
- go.mod: bump buildx v0.28.0-rc2, buildkit v0.24.0-rc2 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13197](docker/compose#13197)
- Build(deps): bump github.com/spf13/pflag from 1.0.7 to 1.0.9 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13195](docker/compose#13195)
- Build(deps): bump github.com/spf13/cobra from 1.9.1 to 1.10.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13198](docker/compose#13198)
- go.mod: bump github.com/docker/docker, docker/cli v28.4.0 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;13168](docker/compose#13168)
- Build(deps): bump github.com/docker/buildx from 0.28.0-rc2 to 0.28.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13207](docker/compose#13207)
- Build(deps): bump github.com/spf13/pflag from 1.0.9 to 1.0.10 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13200](docker/compose#13200)
- Bump golang to version 1.24.7 by [@&#8203;glours](https://github.com/glours) in [#&#8203;13219](docker/compose#13219)
- Build(deps): bump golang.org/x/sync from 0.16.0 to 0.17.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13218](docker/compose#13218)
- Build(deps): bump golang.org/x/sys from 0.35.0 to 0.36.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;13217](docker/compose#13217)
- Bump compose-go to version v2.8.2 by [@&#8203;glours](https://github.com/glours) in [#&#8203;13220](docker/compose#13220)

#### New Contributors

- [@&#8203;cuiweixie](https://github.com/cuiweixie) made their first contribution in [#&#8203;13174](docker/compose#13174)
- [@&#8203;m4rch3n1ng](https://github.com/m4rch3n1ng) made their first contribution in [#&#8203;13158](docker/compose#13158)
- [@&#8203;kianelbo](https://github.com/kianelbo) made their first contribution in [#&#8203;13171](docker/compose#13171)
- [@&#8203;rrjjvv](https://github.com/rrjjvv) made their first contribution in [#&#8203;13188](docker/compose#13188)

**Full Changelog**: <docker/compose@v2.39.2...v2.39.3>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45OC4xIiwidXBkYXRlZEluVmVyIjoiNDEuOTguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants