阶段十:完成 Go 基础包注释基线清零
This commit is contained in:
1 parent
ea1f2ec430
commit
d1a165f897
14 files changed
+135
-924
No files matched your search
@@ -6,10 +6,13 @@ import (
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
// files 保存文件列表,供当前处理流程使用
|
||||
//
|
||||
//go:embed static/*
|
||||
var files embed.FS
|
||||
|
||||
// Static returns the embedded built frontend rooted at static/.
|
||||
// Static 负责Static相关处理。
|
||||
func Static() (fs.FS, error) {
|
||||
return fs.Sub(files, "static")
|
||||
}
|
||||
@@ -5,11 +5,14 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestStaticContainsIndex 负责TestStaticContainsIndex相关处理。
|
||||
func TestStaticContainsIndex(t *testing.T) {
|
||||
// static、err 保存static、err,供当前处理流程使用
|
||||
static, err := Static()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// data、err 保存data、err,供当前处理流程使用
|
||||
data, err := fs.ReadFile(static, "index.html")
|
||||
if err != nil || len(data) == 0 {
|
||||
t.Fatalf("embedded index missing: %v", err)
|
||||
|
||||
Reference in new issue
Block a user