From ec1ae9504ebb7051ee0c099b94cce5c99785a0d8 Mon Sep 17 00:00:00 2001 From: lion Date: Mon, 5 May 2025 19:46:13 +0800 Subject: [PATCH] fix the bug of undefined:io --- binding/golang/xdb/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding/golang/xdb/util.go b/binding/golang/xdb/util.go index d3b6019..b35eb56 100644 --- a/binding/golang/xdb/util.go +++ b/binding/golang/xdb/util.go @@ -11,6 +11,7 @@ package xdb import ( "embed" "fmt" + "io" "os" "strconv" "strings" @@ -182,7 +183,7 @@ func LoadContentFromFile(dbFile string) ([]byte, error) { return cBuff, nil } -// LoadContentFromFS 提供了一个通用的方法来从 embed.FS 中加载文件内容 +// LoadContentFromFS load the whole xdb binary from embed.FS func LoadContentFromFS(fs embed.FS, filePath string) ([]byte, error) { file, err := fs.Open(filePath) if err != nil { @@ -190,7 +191,6 @@ func LoadContentFromFS(fs embed.FS, filePath string) ([]byte, error) { } defer file.Close() - // 读取文件内容到字节数组 var cBuff []byte cBuff, err = io.ReadAll(file) if err != nil {