首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 15:18:32 +08:00
commit d6393266b0
193 changed files with 14287 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package main
import (
"embed"
"fmt"
)
//go:embed file/embed.txt
var embedFile embed.FS
func embedFileDemo() {
// 读取编译嵌入的文件,无磁盘IO操作
data, err := embedFile.ReadFile("file/embed.txt")
if err != nil {
fmt.Printf("读取嵌入文件失败: %v\n", err)
return
}
fmt.Printf("嵌入文件内容: %s\n", string(data))
}
func main() {
embedFileDemo()
}