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

Example, please #2

Open
oke11o opened this issue Jan 26, 2016 · 2 comments
Open

Example, please #2

oke11o opened this issue Jan 26, 2016 · 2 comments

Comments

@oke11o
Copy link

oke11o commented Jan 26, 2016

Can you show a sample template and an example of using tmpl?

@bruth
Copy link

bruth commented Jan 26, 2016

hello.go.tmpl

package main

import "fmt"

func main() {
    fmt.Println("Hello {{.firstName}} {{.lastName}}!")
}

Usage

$ tmpl -data '{"firstName": "Ben", "lastName": "Johnson"}' hello.go.tmpl
$ go run hello.go

@amouat
Copy link

amouat commented Dec 23, 2016

This would be great on the front page. I don't really understand the code on the front page, as how does the array get interpreted?

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

3 participants