ParseJSONFile reads a file and unmarshals the contents into a *Container.
(path string)
| 897 | |
| 898 | // ParseJSONFile reads a file and unmarshals the contents into a *Container. |
| 899 | func ParseJSONFile(path string) (*Container, error) { |
| 900 | if len(path) > 0 { |
| 901 | cBytes, err := os.ReadFile(path) |
| 902 | if err != nil { |
| 903 | return nil, err |
| 904 | } |
| 905 | |
| 906 | container, err := ParseJSON(cBytes) |
| 907 | if err != nil { |
| 908 | return nil, err |
| 909 | } |
| 910 | |
| 911 | return container, nil |
| 912 | } |
| 913 | return nil, ErrInvalidPath |
| 914 | } |
| 915 | |
| 916 | // ParseJSONBuffer reads a buffer and unmarshals the contents into a *Container. |
| 917 | func ParseJSONBuffer(buffer io.Reader) (*Container, error) { |
nothing calls this directly
no test coverage detected