Skip to content

Replace sync.Once with sync.OnceFunc/OnceValue/OnceValues#4958

Open
pietern wants to merge 3 commits intomainfrom
go1.21-sync-oncefunc
Open

Replace sync.Once with sync.OnceFunc/OnceValue/OnceValues#4958
pietern wants to merge 3 commits intomainfrom
go1.21-sync-oncefunc

Conversation

@pietern
Copy link
Copy Markdown
Contributor

@pietern pietern commented Apr 13, 2026

Summary

  • Migrate all sync.Once usage to sync.OnceFunc, sync.OnceValue, or sync.OnceValues
  • Add a forbidigo lint rule to prevent sync.Once from being reintroduced
  • Deduplicate config loading in bundle/direct/dresources

This pull request was AI-assisted by Isaac.

pietern added 2 commits April 14, 2026 00:04
Migrate all sync.Once usage to the typed helpers added in Go 1.21.
Add a forbidigo lint rule to prevent sync.Once from being reintroduced.

Co-authored-by: Isaac
Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

Approval status: pending

/bundle/ - needs approval

Files: bundle/bundle.go, bundle/direct/dresources/config.go
Suggested: @denik
Also eligible: @anton-107, @shreyas-goenka, @andrewnester, @janniklasrose, @lennartkats-db

/internal/ - needs approval

Files: internal/build/info.go, internal/build/variables.go
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @Divyansh-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

/libs/apps/ - needs approval

Files: libs/apps/logstream/streamer.go, libs/apps/vite/bridge.go
Teams: @databricks/eng-apps-devex

/libs/cmdio/ - needs approval

Files: libs/cmdio/spinner.go
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @Divyansh-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

General files (require maintainer)

Files: .golangci.yaml
Based on git history:

  • @denik -- recent work in bundle/, bundle/direct/dresources/, ./

Any maintainer (@andrewnester, @anton-107, @denik, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@pietern pietern requested review from denik and simonfaltum April 13, 2026 22:07
@simonfaltum
Copy link
Copy Markdown
Member

What is the "why" behind this change? The lint rule is obvious to avoid it in the future but why do we want to avoid it?

@pietern
Copy link
Copy Markdown
Contributor Author

pietern commented Apr 14, 2026

All sync.Once usage (in this repo) is to initialize some value or run some function. These are a shortcut.

Found these (and others) when going over the release notes of the past couple of Go releases.

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