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 ( 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()