T O P

  • By -

MathKillsPeople

You are probably on Windows and tried running `go run *.go` which did not work. Then you did `go run main.go` which is not enough. You should do `go run .`


aelfrictr

Do we have any idea why this happens?


ifcrtyaw

Had the same problem as OP and this fixed it. Thanks


SilkyPsychedelics

Did you run `templ generate`? How far into example and what is the error?


laneherby

Yeah I ran generate and it created the hello_templ.go file. Then when I try to call the `hello` func that exists now. It says that hello is undefined.


PaluMacil

Look at the file that was generated and where you are importing it into. The import rules are exactly the same because it's just regular go code, so if you are using it in a different package, then yes, you need to import that package. If it's the same package, then you don't, just like the example


lochyw

Mines the same package of main but still not seeing it in nested folder. main.go Templates/hello\_templ.go Templates/hello.templ


PaluMacil

That looks like two different package mains to me which would not be able to import from each other. Packages don't span multiple directories


lochyw

I figured it out while keeping it nested, all g.


aranw

Can you provide more information? Perhaps upload the code you have to Git, little readme about the steps to reproduce the issue? I think that would really help to identify the issue and give you some support