Skip to content

arch: add unmarshal support for arch.Arch - #1504

Closed
mvo5 wants to merge 3 commits into
osbuild:mainfrom
mvo5:arch-weaks
Closed

mvo5 wants to merge 3 commits into
osbuild:mainfrom
mvo5:arch-weaks

Conversation

@mvo5

@mvo5 mvo5 commented May 7, 2025 •

Copy link
Copy Markdown
Contributor

This is another split out from #1462 - we will want to define the platforms for the image types in YAML too. Because the architecture(s) are part of that platform definition we need it to be unmarshal-able.

This is part of https://github.com/osbuild/images/compare/main...mvo5:platform_yaml?expand=1 which I will open after (and all part of the larger 1462 effort).


arch: add unmarshal support for arch.Arch

We will define the platform in YAML so we need a way to
unmarshal the architecture (that is part of the platform).


arch: add architecture to "unsupported architecture" errors

The error so far could be more helpful, so far we do:

unsupported architecture

instead we now error with the unsupported architecture as
part of the error message.

unsupported architecture <unsupported-arch>

arch: make arch.FromString() return an error on invalid input

The previous code was panic()ing on invalid input. This is no
longer an option as we will define platforms in YAML and here
we need to be able to handle incorrect input more gracefully
than a panic. The callers are also updated.

mvo5 added 3 commits May 7, 2025 17:18
The previous code was panic()ing on invalid input. This is no
longer an option as we will define platforms in YAML and here
we need to be able to handle incorrect input more gracefully
than a panic. The callers are also updated.
The error so far could be more helpful, so far we do:
```
unsupported architecture
```
instead we now error with the unsupported architecture as
part of the error message.
```
unsupported architecture <unsupported-arch>
```
We will define the platform in YAML so we need a way to
unmarshal the architecture (that is part of the platform).
@mvo5
mvo5 requested a review from a team as a code owner May 7, 2025 16:11

@supakeen supakeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. Love the error.

@mvo5

mvo5 commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1508

@mvo5 mvo5 closed this May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants