Open rootshk opened 1 year ago
文件内容
version: "3" services: markdown-blog: container_name: markdown-blog image: willgao/markdown-blog:latest restart: always ports: - 5006:5006 volumes: - ./md:/md - ./cache:/cache
请求5006 却异常
[HTTP Server] http: panic serving 192.168.123.100:50051: runtime error: index out of range [0] with length 0 goroutine 31 [running]: net/http.(*conn).serve.func1() net/http/server.go:1850 +0xbf panic({0xdcb920, 0xc00003a0d8}) runtime/panic.go:890 +0x262 github.com/gaowei-space/markdown-blog/internal/app.getFirstNav({{0x0, 0x0}, {0x0, 0x0}, {0xc0000dec55, 0x3}, {0x0, 0x0}, {0x0, 0x0}, ...}) github.com/gaowei-space/markdown-blog/internal/app/app.go:219 +0x16d github.com/gaowei-space/markdown-blog/internal/app.getNavs({0x0, 0x0}) github.com/gaowei-space/markdown-blog/internal/app/app.go:198 +0x2b8 github.com/gaowei-space/markdown-blog/internal/app.RunWeb.func1(0xc00065e820?) github.com/gaowei-space/markdown-blog/internal/app/app.go:67 +0x79 github.com/kataras/iris/v12/context.(*Context).Do(...) github.com/kataras/iris/v12@v12.2.0-beta2/context/context.go:532 github.com/kataras/iris/v12/core/router.(*routerHandler).HandleRequest(0xc00057c000, 0xc00065e820) github.com/kataras/iris/v12@v12.2.0-beta2/core/router/handler.go:440 +0x406 github.com/kataras/iris/v12/core/router.(*Router).buildMainHandlerWithFilters.func1(0x1531568?) github.com/kataras/iris/v12@v12.2.0-beta2/core/router/router.go:111 +0x44 github.com/kataras/iris/v12/context.(*Context).Next(0xc00065e820?) github.com/kataras/iris/v12@v12.2.0-beta2/context/context.go:682 +0x58 github.com/kataras/iris/v12/middleware/accesslog.(*AccessLog).Handler(0xc000248640, 0xc00065e820) github.com/kataras/iris/v12@v12.2.0-beta2/middleware/accesslog/accesslog.go:748 +0x131 github.com/kataras/iris/v12/context.(*Context).Do(...) github.com/kataras/iris/v12@v12.2.0-beta2/context/context.go:532 github.com/kataras/iris/v12/core/router.(*Router).buildMainHandlerWithFilters.func3({0xfdee48?, 0xc0005ca1c0?}, 0x7139a4981c40?) github.com/kataras/iris/v12@v12.2.0-beta2/core/router/router.go:156 +0xed github.com/kataras/iris/v12/core/router.(*Router).ServeHTTP(0x0?, {0xfdee48?, 0xc0005ca1c0?}, 0x4645ce?) github.com/kataras/iris/v12@v12.2.0-beta2/core/router/router.go:339 +0x30 net/http.serverHandler.ServeHTTP({0xc00031c8d0?}, {0xfdee48, 0xc0005ca1c0}, 0xc0005c0100) net/http/server.go:2947 +0x30c net/http.(*conn).serve(0xc00065e5a0, {0xfdf6e0, 0xc000121bc0}) net/http/server.go:1991 +0x607 created by net/http.(*Server).Serve net/http/server.go:3102 +0x4db
volumes: ./md:/md ./cache:/cache
volumes:
./md 和 ./cache 改成绝对路径看看
./md
./cache
绝对路径也是不行
我可能确认了问题啦,会在下个版本优化,不过你可以测试下:在你的md目录中创建至少一个md文件,如果在md文件夹中有子目录,确保都有文件md文件