Code cleanup from emmanuels comment
This commit is contained in:
parent
9640547c01
commit
95b16b3830
|
@ -48,16 +48,12 @@ func exportSeed(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeSeed(seed certifiers.Seed, path string) (err error) {
|
func writeSeed(seed certifiers.Seed, path string) (err error) {
|
||||||
var f *os.File
|
f, err := os.Create(path)
|
||||||
f, err = os.Create(path)
|
if err != nil {
|
||||||
if err == nil {
|
return errors.WithStack(err)
|
||||||
stream := json.NewEncoder(f)
|
|
||||||
err = stream.Encode(seed)
|
|
||||||
f.Close()
|
|
||||||
}
|
|
||||||
// we don't write, but this is not an error
|
|
||||||
if os.IsExist(err) {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
defer f.Close()
|
||||||
|
stream := json.NewEncoder(f)
|
||||||
|
err = stream.Encode(seed)
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue