update cart
This commit is contained in:
@@ -71,6 +71,14 @@ func (sf *StateFile) GetVoucher(code string) (*Voucher, bool) {
|
||||
func LoadStateFile(fileName string) (*StateFile, error) {
|
||||
f, err := os.Open(fileName)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return &StateFile{
|
||||
State: State{
|
||||
Vouchers: []Voucher{},
|
||||
},
|
||||
Version: 1,
|
||||
}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
Reference in New Issue
Block a user