How to set path for template html/template

Hello guys,
I try to connect my code to html view.
this is a way that I try to connect to html :
https://play.golang.org/p/PCv74Rxupj3

but I got this error :
panic: html/template: pattern matches no files: view/*.gohtml

goroutine 1 [running]:
html/template.Must(…)
/home/mehrdad/workspace/go/go/src/html/template/template.go:372
github.com/mehrdaddolatkhah/cafekala_server/pkg/business/web.init.0()
/home/mehrdad/workspace/go/projects/src/mehrdaddolatkhah/cafekala_back/pkg/business/web/AuthWebHandler.go:26 +0x96
exit status 2

and this is my layout structure:
-cmd
-pkg
– business
—web
----AuthWebHandler.go
–domain
–repository
–transport
–view
—login.gohtml

may please guide me to fix this?

I see no http.HandleFunc in your code. Any clue from this?:

1 Like

slightly off topic

but w.Write([]byte(fmt.Sprintf("enter phone and password")))

looks complicated to me.

Why not just do
fmt.Fprint(w, "enter phone and password")

1 Like

thank you for your response,
because I call this function from the route section in my architecture. now, I don’t know how I must give a path for login.gohtml.

I shared the package structure in the first post on this topic

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.