From a02d9c846340ced4426103ee35cb08459299567c Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Fri, 18 Nov 2022 01:30:37 +0800 Subject: [PATCH] fix: check error type on file not found (#2383) --- server/static/static.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/static/static.go b/server/static/static.go index 9191e9cb..74c4a7f7 100644 --- a/server/static/static.go +++ b/server/static/static.go @@ -1,6 +1,7 @@ package static import ( + "errors" "fmt" "io/fs" "net/http" @@ -18,7 +19,7 @@ import ( func InitIndex() { index, err := public.Public.ReadFile("dist/index.html") if err != nil { - if err == fs.ErrNotExist { + if errors.Is(err, fs.ErrNotExist) { utils.Log.Fatalf("index.html not exist, you may forget to put dist of frontend to public/dist") } utils.Log.Fatalf("failed to read index.html: %v", err)