Live data from Hacker News

Show HN: Gok – Webapps in Go the PHP way

github.com

1–4 of 4 posts

Re: Show HN: Gok – Webapps in Go the PHP way

#2
The fact that a modern language encourages developers to do something like

``` func (self Gok) SetCookie_4(name string, value string, duration int64, urlPath string){ ... } func (self Gok) SetCookie_5(name string, value string, duration int64, urlPath string, domain string) { ... } func (self *Gok) SetCookie_7(name string, value string, duration int64, urlPath string, domain string, secure bool, httpOnly bool) { ... } ```

is simply baffling to me.

Re: Show HN: Gok – Webapps in Go the PHP way

#3
post #2

The fact that a modern language encourages developers to do something like ``` func (self Gok) SetCookie_4(name string, value string, duration int64, urlPath string){ ... } func (self Gok) SetCookie_5(name string, value string, duration int64, urlPath string, domain string) { ... } func (self *Gok) SetCookie_7(name string, value string, duration int64, urlPath string, domain string, secure bool, httpOnly bool) { ...…

In this particular example, they don't. They encourage you to define a Cookie struct, construct it with all the fields you know, pass it to the method with gok.SetCookie(Cookie{name: "blub", duration: 5000}) and the method should decide what to do based on the fields available

Re: Show HN: Gok – Webapps in Go the PHP way

#4
No developer worth his salary is writing PHP this way anymore, so I just can't understand why one would consider to do that with Go. Inline script tags are most of the time a very bad code smell. Unless you are extremely disciplined and use them only as a templating mechanism, which your library does not restrict at all, then it's not so bad. You're way better off using a templating engine.