only open
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s

This commit is contained in:
matst80
2024-11-11 17:24:11 +01:00
parent ef0583d70a
commit ef31ebce03

View File

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