libnetwork: setKey(): remove intermediate buffer
Use json.NewDecoder() instead, which accepts a reader. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a813d7e961
commit
9d8fcb3296
1 changed files with 1 additions and 5 deletions
|
@ -60,12 +60,8 @@ func setKey() error {
|
|||
containerID, shortCtlrID := args[0], args[1]
|
||||
|
||||
// We expect specs.State as a json string in <stdin>
|
||||
stateBuf, err := io.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var state specs.State
|
||||
if err = json.Unmarshal(stateBuf, &state); err != nil {
|
||||
if err := json.NewDecoder(os.Stdin).Decode(&state); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue