-
-
Notifications
You must be signed in to change notification settings - Fork 53
Description
aqua info
$ aqua info
{
"version": "2.55.0",
"commit_hash": "Homebrew",
"os": "darwin",
"arch": "arm64",
"pwd": "/Users/(USER)/***",
"root_dir": "/Users/(USER)/.local/share/***",
"env": {
"AQUA_GITHUB_TOKEN": "(masked)",
"AQUA_GLOBAL_CONFIG": ":/Users/(USER)/.config/aquaproj-aqua/aqua.yaml"
},
"config_files": [
{
"path": "/Users/(USER)/***/aqua.yaml"
}
]
}Overview
Some fields in the PackageInfo struct in pkg/config/registry/package_info.go do not have corresponding yaml tags or "omitempty" settings, while others do. This inconsistency causes problems when importing the struct in other projects and generating registry YAML files. Fields without yaml tags and "omitempty" are always exported, even if they are empty, leading to noisy and incorrect YAML output.
How to reproduce
- Import or use PackageInfo from pkg/config/registry/package_info.go in another project (e.g., for registry YAML generation).
- Export a YAML file based on a PackageInfo instance containing several unset or nil fields.
- Observe that some fields (without yaml:"...,omitempty") are printed even if nil/empty, while others (with yaml:"...,omitempty") are not.
Example registry YAML output:
- type: github_release
repo_owner: sirrend
repo_name: terrap-cli
description: Terrap - a powerful CLI tool that scans your infrastructure and identifies any required changes
asset: terrap-cli_{{trimV .Version}}_{{.OS}}_{{.Arch}}.{{.Format}}
format: tar.gz
private: false
cargo: null
overrides:
- goos: windows
type: ""
format: zip
cargo: null
checksum: null
cosign: null
files:
- name: terrap
checksum:
type: github_release
asset: checksums.txt
url: ""
algorithm: sha256
pattern: null
enabled: null
replacements: {}
cosign: null
minisign: null
cosign: nullNotice fields like "cosign: null" or string fields that show up even when not set.
Expected behaviour
When exporting a PackageInfo struct to YAML, fields that are empty or nil should be omitted from the output, resulting in a clean and correct YAML file according to the struct's actual populated values.
Actual behaviour
Currently, fields without yaml:"...,omitempty" tags are always printed in the YAML output regardless of whether they are set, causing empty, null, or unwanted entries in the exported YAML.
Note
Proposed solution: Please ensure all fields in PackageInfo (and relevant related structs) have proper yaml tags with ",omitempty" so that exporting to YAML behaves consistently and empty fields are omitted. This will improve integration and usability when consuming and exporting registry files in other projects.