Skip to content

Fix: Make the config field optional#1309

Merged
sudo-bmitch merged 1 commit intoopencontainers:mainfrom
sudo-bmitch:pr-optional-config
Feb 26, 2026
Merged

Fix: Make the config field optional#1309
sudo-bmitch merged 1 commit intoopencontainers:mainfrom
sudo-bmitch:pr-optional-config

Conversation

@sudo-bmitch
Copy link
Contributor

A struct in Go cannot be empty (unlike a pointer) and will never match the "omitempty" feature in the json package. The option added in 1.24 to support this is omitzero. Older versions of Go will ignore an unknown struct tag which is the same as the current behavior.

This came up when running go fix ./... in some other code that had a copy of the struct. Our config docs already indicates the field is optional. And the json schema only lists architecture, os, and rootfs as the required fields (matching the docs and rest of the Go spec).

A struct in Go cannot be empty.
The option added in 1.24 to support this is omitzero.
Older versions of Go will ignore an unknown struct tag which is the same as the current behavior.

Signed-off-by: Brandon Mitchell <git@bmitch.net>
@sudo-bmitch sudo-bmitch merged commit a4c6ade into opencontainers:main Feb 26, 2026
5 checks passed
@sudo-bmitch sudo-bmitch deleted the pr-optional-config branch February 26, 2026 10:21
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.

3 participants