This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@@ -55,11 +54,12 @@ func getCartPath(id string) string {
|
|||||||
func loadMessages(grain Grain, id CartId) error {
|
func loadMessages(grain Grain, id CartId) error {
|
||||||
var err error
|
var err error
|
||||||
path := getCartPath(id.String())
|
path := getCartPath(id.String())
|
||||||
if _, err = os.Stat(path); errors.Is(err, os.ErrNotExist) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
file, err := os.Open(path)
|
file, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user