Open MK-Twinkle opened 6 years ago
You should use a separate html file and the package ".html/template". You will a nice example here, https://golang.org/doc/articles/wiki/
João Henrique Machado Silva +31 06 40868680 Skype joaoh82 TWITTER @joaoh82 INSTAGRAM @josh.bh ABOUT ME https://about.me/joaoh82
On Wed, Mar 14, 2018 at 8:34 AM, MK-Twinkle notifications@github.com wrote:
I want to design a webpage using Go using HTML script. But I am quite unsure whether to use the HTML script directly to the Go source code or whether create a index.html in the similar directory. Can someone help me out with this.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GoesToEleven/GolangTraining/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMuhTCMIoWfCmR3TsB-gHeLi9obvouzks5teMf4gaJpZM4Sp9Ln .
Check out my repository, I had this problem and solved it by using template.JS I think. http://gitHub.com/bubbajoe/netcode-golang
Look through the server.go file.
Joe Williams
On Mar 14, 2018, at 3:46 AM, João Henrique Machado Silva notifications@github.com<mailto:notifications@github.com> wrote:
You should use a separate html file and the package ".html/template". You will a nice example here, https://golang.org/doc/articles/wiki/
João Henrique Machado Silva +31 06 40868680 Skype joaoh82 TWITTER @joaoh82 INSTAGRAM @josh.bh ABOUT ME https://about.me/joaoh82
On Wed, Mar 14, 2018 at 8:34 AM, MK-Twinkle notifications@github.com<mailto:notifications@github.com> wrote:
I want to design a webpage using Go using HTML script. But I am quite unsure whether to use the HTML script directly to the Go source code or whether create a index.html in the similar directory. Can someone help me out with this.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GoesToEleven/GolangTraining/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMuhTCMIoWfCmR3TsB-gHeLi9obvouzks5teMf4gaJpZM4Sp9Ln .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/GoesToEleven/GolangTraining/issues/29#issuecomment-372932027, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHHhM3TJYCIQAJGtYqRmfbJP2EDou1U9ks5teMq-gaJpZM4Sp9Ln.
using HTML source on Go code is portable yet not practical in terms of maintenance. As suggested, you should create a separate html template file and parse it using html/template. There are some libraries that also try to pack static html files into a binary that requires a little additional work.
I want to design a webpage using Go using HTML script. But I am quite unsure whether to use the HTML script directly to the Go source code or whether create a index.html in the similar directory. Can someone help me out with this.