Skip to content
New issue

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

WriteString missing #1006

Open
mathieupost opened this issue Nov 28, 2024 · 1 comment
Open

WriteString missing #1006

mathieupost opened this issue Nov 28, 2024 · 1 comment

Comments

@mathieupost
Copy link

I was trying templ for the first time, but unfortunately I didn't get very far. Following the guide at https://templ.guide/quick-start/creating-a-simple-templ-component I did the following:

  1. Setup
mkdir hello-world
cd hello-world
nix develop github:a-h/templ
go mod init github.com/mathieupost/hello-world
go get github.com/a-h/templ
  1. Created hello.templ
package main

templ hello(name string) {
	<div>Hello, { name }</div>
}
  1. Run templ. templ generate didn't work as my go bin is not in my path, so I did the following:
go get github.com/a-h/templ/cmd/templ
go run github.com/a-h/templ/cmd/templ generate
  1. Error. The generated file contains this:
image

changing that errored line to

		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(name)
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}

does the trick but of course the generator will overwrite that every time.

@a-h
Copy link
Owner

a-h commented Nov 29, 2024

I tried, but was unable to reproduce the issue.

You've provided some of the requested information in the issue template, but not all which may have affected my ability to reproduce it. The issue template asks for templ info output which includes templ versions - very useful for debugging and making sure you're using the program you think you are, or a sample repo which might point to the issue in another way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants