Re: [go-nuts] How to create unique IDs when ranging over data in Golang and use in Javascript

2017-03-08 Thread Rejoy Nair
wrote: > On Tue, 7 Mar 2017 15:42:11 +0530 > Rejoy Nair wrote: > > > Thanks a lot!. Your answers have been helpful. I was also provided > > with a very good solution from another forum that I 'll post that > > here for the benefit for anybody who '

Re: [go-nuts] How to create unique IDs when ranging over data in Golang and use in Javascript

2017-03-07 Thread Rejoy Nair
function save_data(form, rowno) { var input = document.getElementById("pid"+rowno); localStorage.setItem("id", input.value); } On Tue, Mar 7, 2017 at 1:23 PM, Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > On Mon, 6 Mar 2017 23:30:20 -0800 (PST)

[go-nuts] How to create unique IDs when ranging over data in Golang and use in Javascript

2017-03-06 Thread Rejoy
I am getting data from the server and iterating over it to create a table and then I am using a form to store an id to local storage using javascript. Here is code snippet Product ID {{range .}} Update {{end}} function save_data() { var input = document.getElementByID("pid");

[go-nuts] Re: Godoc / Local Project/ Documentation

2017-03-05 Thread Rejoy
UTC+5:30, Rejoy wrote: > > In my local project folder (a web app) that has the go source files, I use > the go run command to get the output. Each of these files is called a > package main. I 'd like to create the documentation for the project. I run > godoc -http=:6060, but

[go-nuts] Godoc / Local Project/ Documentation

2017-03-05 Thread Rejoy
In my local project folder (a web app) that has the go source files, I use the go run command to get the output. Each of these files is called a package main. I 'd like to create the documentation for the project. I run godoc -http=:6060, but don't see any of the source files of my local projec

[go-nuts] Re: Issue with Goroutine and http.RedirectHandler

2017-02-20 Thread Rejoy
s the incorrect url. I then cleared the browser cache and subsequently the redirect worked. Didn't have to change a thing in the code. Thanks Rejoy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

[go-nuts] Issue with Goroutine and http.RedirectHandler

2017-02-20 Thread Rejoy
fter rectifying the mistake to the above, I am still being redirected to the incorrect url. When I type in the url ""https://127.0.0.1:8001";, the page is rendered correctly. Is there a need to explicitly stop go routines. Strangely even after restarting the m/c, the request is

Re: [go-nuts] Parse JSON in Template

2017-02-19 Thread Rejoy Nair
hanks for your reply though. Rejoy On Sun, Feb 19, 2017 at 10:04 PM, Hugh S. Myers wrote: > The devil sitting on my shoulder tempts me to say "Of course, there is" > and walk away. That said, by now there must exist code to read JSON (YAML, > Windows config files, etc.) fr

[go-nuts] Parse JSON in Template

2017-02-19 Thread Rejoy
hal the string into a map([string]interface{}) and then pass on the data to the templates. But was curious if there is a way to access the data using the JSON keys. Thanks Rejoy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Re: [go-nuts] Blabk values when trying to pass a slice to a struct field

2017-02-03 Thread Rejoy Nair
b 2017 17:48:18 +0530 > Rejoy Nair wrote: > > > > > I am trying to pass a slice of data to a struct field . The field > > > > has a type of another struct. I get blank values in the output. > > > > > > > > Here is the code: https://play.golang.

Re: [go-nuts] Blabk values when trying to pass a slice to a struct field

2017-02-03 Thread Rejoy Nair
:00 -0800 (PST) > Rejoy wrote: > > > I am trying to pass a slice of data to a struct field . The field has > > a type of another struct. I get blank values in the output. > > > > Here is the code: https://play.golang.org/p/-YZ7UUI--D > > > > I 'd like

[go-nuts] Blabk values when trying to pass a slice to a struct field

2017-02-03 Thread Rejoy
Hi, I am trying to pass a slice of data to a struct field . The field has a type of another struct. I get blank values in the output. Here is the code: https://play.golang.org/p/-YZ7UUI--D I 'd like to understand how to pass on the slice data to a struct field. -- You received this message b

[go-nuts] json: cannot unmarshal array into Go value of type main error

2017-02-02 Thread Rejoy
I 'd like to unmarshal database records into a struct type. I get the error "json: cannot unmarshal array into Go value of type main..". Working example https://play.golang.org/p/keY-3z7lyA I can unmarshal the data to []map[String]string, but cannot reference it using key value pairs in the