podman-build/pkg/domain/infra/abi/config.go
2025-10-11 12:30:35 +09:00

25 lines
488 B
Go

//go:build !remote
package abi
import (
"encoding/json"
"errors"
"io"
"github.com/containers/image/v5/manifest"
)
// DecodeOverrideConfig reads a Schema2Config from a Reader, suppressing EOF
// errors.
func DecodeOverrideConfig(reader io.Reader) (*manifest.Schema2Config, error) {
config := manifest.Schema2Config{}
if reader != nil {
err := json.NewDecoder(reader).Decode(&config)
if err != nil && !errors.Is(err, io.EOF) {
return nil, err
}
}
return &config, nil
}