google / google/gvisor

Ban `init()` functions in non-test Go files

Open
#14,580 1 comment 0 reactions 1 assignee Claimed by @EtiennePerot View on GitHub
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

Per title.

They are way too convenient but come at unexpected costs, especially with respect to the OCI interface which pays the `init` cost redundantly. They also make it easy to allocate large data structures on the heap at startup that may never end up being needed, bloating memory.

Need some helper library to make it easier to do a 2-function pattern: one to kick off `init`-like work, and a second to join on the completion of that work, after which no further synchronization is needed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.