Skip to content

Commit b89c868

Browse files
优化本地调试
1 parent 0d49f33 commit b89c868

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cmd/local/main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"context"
5-
"encoding/json"
65
"flag"
76
"fmt"
87
"io"
@@ -14,7 +13,6 @@ import (
1413
"github.com/pkg/errors"
1514
"go.uber.org/zap"
1615
"gopkg.d7z.net/gitea-pages/pkg"
17-
"gopkg.d7z.net/gitea-pages/pkg/core"
1816
"gopkg.d7z.net/gitea-pages/pkg/providers"
1917
"gopkg.d7z.net/middleware/cache"
2018
"gopkg.d7z.net/middleware/kv"
@@ -60,13 +58,13 @@ func main() {
6058

6159
file, _ := os.ReadFile(filepath.Join(path, ".pages.yaml"))
6260
if file != nil {
63-
var info core.PageConfig
61+
var info map[string]interface{}
6462
err := yaml.Unmarshal(file, &info)
6563
if err != nil {
6664
zap.L().Fatal("parse yaml", zap.Error(err))
6765
}
68-
info.Alias = []string{}
69-
marshal, _ := json.Marshal(info)
66+
delete(info, "alias")
67+
marshal, _ := yaml.Marshal(info)
7068
provider.AddOverlay(".pages.yaml", marshal)
7169
}
7270
memory, err := kv.NewMemory("")

pkg/core/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (p *PageConfigRoute) UnmarshalYAML(value *yaml.Node) error {
3232
keys = append(keys, k)
3333
}
3434
if len(keys) != 1 {
35-
return errors.New("invalid param")
35+
return errors.Errorf("invalid param: %v", keys)
3636
}
3737
p.Type = keys[0]
3838
params := data[p.Type]

0 commit comments

Comments
 (0)