On Wed, Mar 9, 2016 at 11:02 PM, Pat Farrell wrote:
I'm just learning GO, after decades of using other languages. I like what
I see, but I'm sure I don't understand a lot of stuff.
We're all always learning. This is cool. :o)
I'm thinking of writing a simple web application as my first non-trivial
go program. Usual setup, user has browser, makes requests, system spits out
HTML, CSS, JS, etc. and talks to some suitable backend persistent store.
1) in a microservices model, how many "go compilation units" make up the
application? One per command?
Why do you jump to talking about microservices? How many individual
projects/repositories/binaries you have is pretty separate from the
language of choice for each microservice, or whether to even use
You can use one app with many endpoints, many servers listening on many
ports, and with millions of concurrent processes (goroutines). Or have many
individual binaries communicating by whatever means you like. It depends on
2) I assume that the microservices use a templated system to fill in
values for special values in the HTML, so the resulting page can say "Hi
Pat" appropriately. Is there a best-practices templating system?
The standard library includes text/template and html/template. Check those
out. There's also fmt.Sprintf for simpler things, but if you need to
sanitize user input look at html/template.
the main go program deliver them? is there some sort of switch that
dispatches to different processing units depending on the path or some
Whatever makes sense for you. Use an entirely separate CDN. Serve them with
nginx. Serve them with your Go application by reading them from disk. Embed
the bytes of those files directly into your Go binary. Whatever makes sense
for your needs.
4) supporting browsers and users who do things like use the Back and
Forward buttons on their browsers is usually done by some MVC framework.
Most (all?) of the frameworks I have used in Java are fat, dumb, ugly, and
verbose. What is the go solution?
This doesn't seem very Go-specific. If you accept input and process a form,
you should have your code do a redirect upon success, so that a refresh
doesn't cause a re-submit or carry any state. But references to browser
support, MVC frameworks, and Java don't seem to clarify your question.
5) how do i keep from writing programs that someone would look at and say
"nice professional java code, but not go"?
Every language has its own idioms. If you try to write Java (or Python, or
any other language) in Go it will not go very well for you. Nothing but
experience will get you there. The people on this list will help. A lot.
But don't worry about trying to be perfect, or please everyone, or master
the language all at once.
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.