Skip to main content

All Questions

Tagged with
5 votes
1 answer
9k views

How to render HTML Template In Gin Gonic (Golang)?

I am trying to create an HTML template on Golang using Gin Gonic. but there are problems when rendering the template that I made to produce a web view (the result is blank). Is there something wrong ...
Tammam's user avatar
  • 428
1 vote
1 answer
157 views

Use the same template with different param/variables in 1 page

I am using Go gin gonic for my web app. How do I use the same template file multiple times in 1 page with different variables passed to the template. segment.tmpl {{ define "segment" }} <div&...
Charas's user avatar
  • 1,725
1 vote
1 answer
2k views

How to set a variable for an external HTML template in Go?

I've two Go templates. top.html: <html> <head> <title>{{ .title }}</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta ...
danny's user avatar
  • 11
1 vote
0 answers
3k views

pattern matches no files

My webapp structure: - gin-cource - src - templates - tmpl1 file.html *.html - tmpl2 file.html *.html When I run it I get the panik html/...
rozerro's user avatar
  • 6,693
-1 votes
2 answers
1k views

Golang templates won't load

I started to write a Gin application and my project tree looks like -assets --css ---{bootstrap} -templates --layouts ---footer.html ---head.html ---header.html --book.html -main.go In main.go I ...
Anton Motin's user avatar
1 vote
1 answer
2k views

How to include go templates when unit testing

I'm trying to test an implementation of a simple web server in Go using the Gin. The service has a single endpoint rendering HTML. server.go // Serve triggers the server initialization func Serve(...
Alessandro Resta's user avatar
3 votes
1 answer
4k views

How to send an array of maps and iterate over it using gin-templating

Following is the snippet of a working code. I am using gin templating engine. c.HTML(200, "index", gin.H{ "title": "Welcome", "students": map[int]map[string]string{1: {"PID"...
codec's user avatar
  • 8,546
5 votes
4 answers
7k views

How to make templates work with gin framework?

I am newbie to golang. To learn it I have started with a simple web app using gin framework. I have followed the gin doc & configured template file but not able to make it work. I am getting an ...
ameykpatil's user avatar
8 votes
1 answer
10k views

How to use templates in Go Gin for dynamic content

I have a simple Go / Gin web app. I need to put some dynamic content in html template. For e.g. I have a few tables (the number is dynamic) with a few rows (the number is dynamic). I need to put them ...
kikulikov's user avatar
  • 2,552
10 votes
1 answer
1k views

same code but different results using gin + go-template

Basic information Go version: go1.4.2 darwin/amd64 Operating System: Mac OS X 10.10.5 I'm working on a small Web project written based on go and gin. Here is my golang code. After running go run ...
Miaonster's user avatar
  • 1,512