osbuild2: small code reorganisation

Move main type to the top of the file
This commit is contained in:
Achilleas Koutsou 2021-09-07 16:21:23 +02:00 committed by Ondřej Budai
parent 10eb0d65a1
commit 5f8bd4fd6e

View file

@ -9,6 +9,14 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild1"
)
type Result struct {
Type string `json:"type"`
Success bool `json:"success"`
Error json.RawMessage `json:"error"`
Log map[string]PipelineResult `json:"log"`
Metadata map[string]PipelineMetadata `json:"metadata"`
}
type PipelineResult []StageResult
type StageResult struct {
@ -85,14 +93,6 @@ func (md PipelineMetadata) UnmarshalJSON(data []byte) error {
return nil
}
type Result struct {
Type string `json:"type"`
Success bool `json:"success"`
Error json.RawMessage `json:"error"`
Log map[string]PipelineResult `json:"log"`
Metadata map[string]PipelineMetadata `json:"metadata"`
}
func (res *Result) UnmarshalJSON(data []byte) error {
// detect if the input is v1 result
if v1Result, err := isV1Result(data); err != nil {