mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
volume: stream JSON & Decode
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
4dbbe4f51a
commit
f665be55fe
1 changed files with 5 additions and 2 deletions
|
@ -154,12 +154,15 @@ func (v *Volume) FromDisk() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(pth)
|
jsonSource, err := os.Open(pth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer jsonSource.Close()
|
||||||
|
|
||||||
return json.Unmarshal(data, v)
|
dec := json.NewDecoder(jsonSource)
|
||||||
|
|
||||||
|
return dec.Decode(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Volume) jsonPath() (string, error) {
|
func (v *Volume) jsonPath() (string, error) {
|
||||||
|
|
Loading…
Reference in a new issue