We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
Program panic in when using template files from embed fs.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
CI should pass with HTTP 200.
Screenshots
If applicable, add screenshots to help explain your problem.
Hertz version:
0.6.7
Environment:
GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/runner/.cache/go-build" GOENV="/home/runner/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/runner/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/runner/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/hostedtoolcache/go/1.20.7/x64" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/hostedtoolcache/go/1.20.7/x64/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.20.7" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/runner/work/hertz-template-test-panic/hertz-template-test-panic/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4000659406=/tmp/go-build -gno-record-gcc-switches"
Additional context
Sample repo: https://github.com/ringsaturn/hertz-template-test-panic
package app import ( "context" "embed" "html/template" "net/http" "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/app/server" ) //go:embed template/* var f embed.FS func NewHertz() *server.Hertz { h := server.Default() h.SetHTMLTemplate(template.Must(template.New("").ParseFS(f, "template/*.html"))) h.GET("/hello", func(c context.Context, ctx *app.RequestContext) { ctx.HTML(http.StatusOK, "hello.html", nil) }) return h }
Test:
package app_test import ( "net/http" "testing" "github.com/cloudwego/hertz/pkg/common/test/assert" "github.com/cloudwego/hertz/pkg/common/ut" "github.com/ringsaturn/hertz-template-test-panic/app" ) func TestAppHello(t *testing.T) { h := app.NewHertz() w := ut.PerformRequest(h.Engine, "GET", "/hello", nil) resp := w.Result() t.Log(string(resp.BodyBytes())) assert.DeepEqual(t, http.StatusOK, resp.StatusCode()) }
The text was updated successfully, but these errors were encountered:
not support and refer to #630
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Program panic in when using template files from embed fs.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
CI should pass with HTTP 200.
Screenshots
If applicable, add screenshots to help explain your problem.
Hertz version:
0.6.7
Environment:
Additional context
Sample repo: https://github.com/ringsaturn/hertz-template-test-panic
Test:
The text was updated successfully, but these errors were encountered: