yes! Jetbrains GoLand helps quite a bit with the more annoying parts of the language (GOPATH, remembering commands for tools, managing go modules, etc)
There are some small things about the language that can feel a little cumbersome (lack of generics for example) but largely happy with the language and the trade offs so far seem worth it.
Have you managed to get GoLand's IDE tests to work properly? I found that it imports only the file for the test but nothing else which causes errors due to "undefined" things (things defined in the package are not accessible as it only imported a single file). Other than that I'm a happy GoLand user
We use it. Gorilla mux (https://github.com/gorilla/mux) to route requests plus some in-house handler chains that log, check JWT tokens, etc. We have a Go client library which accesses the web API, so we can do testing without having to involve the frontend team; a combination of tests in the client library and some judicious curl commands is usually enough.
Yes. Nothing fancy from workflow. I pay for and use Goland because I find it so good for refactoring... worth the expense over VSCode.
Generally I use standard library, with the exception being github.com/gorilla/mux Gorilla Mux for routing because it removes so much boilerplate.
I do however use Python for all HTTP integration tests. With requests + voluptuous its so much more productive than doing them in Go, which I had previously done.
How do you access your database?
How do you do migrations?
How do you do end to end testing?
How do you do fixtures?
How do you do user input validations and error reporting?
How do you do translations and 18n in general?
Do you have any kind of admin ui?
How do you handle assets?
How do you do ajax calls?
How do you send emails?
How do you handle general error reporting to sentry, or similar?
Go is great for systems programing, building kubernetes, CLIs, etc.
It is very far from being a good idea to use it for general web development. Right tool for the job and such.
All of that is already built via libraries. Talking about facebook, they released an ORM a a while ago[1] and it has support for all the things you mention.
I've created or inherited a few small web services (small, self-contained pieces shared by multiple apps or broken off for load management reasons). I would say Go is pretty good for this, some very nice performance wins were had easily.
I have very little temptation to use it for a whole application though. Unless you are already a Go shop I would advise anyone to just get better at making Ruby, Python, PHP, or JavaScript back ends that are more performant.
I enjoy Go for web development. I pretty much use the standard libary + Gorilla. I have few complaints, it's a little more verbose than Python but it feels more robust, easier to deploy and I like the performance. The code is easy to read.
IntelliJ Ultimate with the Go Plugin. Sometimes vim-go.
The api is defined with gRPC.io and offered as a gRPC api as well as a Rest api with JSON using grpc-gateway.
Database is PostgreSQL using pgx. Caching via Resis or memcached. Building testing via a Makefile with junit and cobertura reports
Difficulties: Nothing special actually. We switched from Node.js to Go in the beginning of 2020 and it's been a pleasure for our new projects (software agency). I thought it was going to be hard to onboard our staff / new hires to Go and our stack, but this really turned out to be a non issue.
Consultant using Go in a few client projects. Both use build-in-Docker for stability and less CI surprises. One uses GRPC with Profobuf, another is using an event sourcing toolkit I have authored [0]. Personally I use VSCode with gopls which has been working great for quiet some time now. Ordinary make files for combined documentation and usage of common operations.
- Pongo2 syntax is like Django/Jinja2, but not as easy as Jinja2. I use Python+Jinja2 for years in production, it's so easy to use and troubleshoot.
- No builtin i18n support. You can find some blog posts or articles introduce pongo2, but no one mentions i18n support/implementation like no one need it. We implemented our own i18n support, but still need a tool to extract strings from template files for translation.
- The macro syntax doesn't support specifying argument names while calling. e.g. `{{ my_macro("a", "b", "c") }}` is ok, but not `{{ my_macro(name1="a", name2="b", name3="c") }}`. It's hard to organize reusable HTML/CSS code snippets.
- Sometimes the custom macro is correct (syntax part), but it renders nothing in output html, but if i add the same pongo2 code in its own unittests files, it works. Didn't find a way to troubleshoot, no clue at all what the problem is.
Anyway, Go itself and the web framework are very good for web development now, just miss a Jinja2 for Go.
Yes, chose Go over Rust for a prototype API backend because Google Cloud docs offers code examples in Go :p Satisfied with Go performance, strongly prefer Goland over VS Code for better debugging. Considering switching to Java or .Net for the remaining logic development, I would (perhaps naively) like to explore functional programming patterns and the potential benefits of a "larger" ecosystem (Spring Data JDBC for example).
Go is a little low-level/obtuse for business logic and UI stuff. We use it for many of the gRPC services that our web apps consume. The more systems-y the service, the better the fit.
I used Go to create different web apps. One example would be https://namesmith.io (shameless plug), which I created with the Revel framework.
Revel is often seen as anti-idiomatic because it's a whole framework but it is nice to get a web app going pretty fast (with Go). These days I have a lot more experience and I probably would choose echo or something similar. Not because I think that Revel is bad but because I have a lot more freedom with those.
For editing I mostly use Vim.
Generally I would say if you create web apps maybe choose something different from Go. It certainly can be easier/more comfortable. For APIs it's still great and one of the best choices IMO.
I work on a personal project split into multiple packages totaling about 60k lines.
The end result are two web applications that work as a backend and frontend for an ActivityPub link aggregator (similar to HN and old redddit).
I mostly develop in Goland as I use the debugger extensively, and I didn't want to spend the time to learn to use delve in the command line.
I tried to keep as much as possible a handmade approach, so I'm making use of the standard library over more fancy packages or frameworks.
In my specific case the biggest issue I had was with the protocol itself (ActivityPub) which allows for a large degree of flexibility in the structure of the JSON objects it passes around, a lot more than the default encoder in go allows for. I had to implement my own functionality for encoding/decoding JSON objects, and I'm currently working on adding similar functionality for binary encoding.
I'm a Node guy and don't know anything about Go, what's the recommended route to get started on Go for the web? Any specific framework in mind? I need WebSockets and I'm guessing Go can provide some good performance improvement over Node there.
I start small: vim, makefile, bare Go with no dependencies. I add things only if they improve the end product from the consumer perspective (either FRs or NFRs).
I even used to deploy things as systemd services, unless containers make things easier to more scalable.
For the frontend I couldn't be happier since I discovered "esbuild", which is written in Go and has unbelievable performance.
> And 1 year later you've finally deployed a registration form.
This made me laugh. What's wrong with tailor-made software? It seems that all we care about nowadays is to "get shit done". I wish this kind of thinking vanishes soon.
Do custom software for personal projects. Not justifying your paycheck. I too have been the sorry sod that was handed a legacy project in a PHP self-rolled framework. I really did contemplate the consequences of my reaction after pouring weeks into the "Easy" solution. My options were to vent my frustration by throwing a brick at someone or drink myself to sleep for two months straight. I chose the latter.
The above user mentioned what‘s wrong with writing everything from scratch, but you chose to conveniently skip it.
Developers stay only for short amount of times compared to the lifetime of the product. New developers inherit all the tech debt, bugs and bad decisions in your custom framework.
It's extremely hard to justify the value it provides over something more out of the box. From an engineering perspective, it makes sense. From a business perspective, it often doesn't make sense to spend 10x as much money to make users 10% happier. It almost certainly won't cause you to make 10x as much money.
I was only speaking about one-man personal projects. In my case, I shipped 3 of them (nullitics, lalatabs and a brand new version of onthesamepage) in 3 months. Depends on the project type and on the person, I guess.
www.stackazam.com is a cloud application built with Go
I have started falling in love with coding/CS again with Go.
Our philosophy is to keep things close to the metal and not use layers as much as possible. Go enables you to follow with approach with the standard libraries that come with the language.
Problem with layers/frameworks is that while they seem to solve immediate problem quickly, layers will rear their ugly head down the road , making you feel helpless during debugging
We use standard libraries
database/sql for database
html/template for UI
Only external package used so far is gin-gonic/gin for middleware&routing
Yes, we use go-gin for HTTP servers and middleware (really fast and easy to use) and gRPC+Protobuf for backend services with database access. For the frontend, we have one project that renders HTML just with Go templates, but that’s kinda clumsy and awkward to maintain.
Our main webapp is built with Vue.js, and the gin server only checks auth and serves the index.html
42 comments
[ 3.0 ms ] story [ 74.7 ms ] threadThere are some small things about the language that can feel a little cumbersome (lack of generics for example) but largely happy with the language and the trade offs so far seem worth it.
Generally I use standard library, with the exception being github.com/gorilla/mux Gorilla Mux for routing because it removes so much boilerplate.
I do however use Python for all HTTP integration tests. With requests + voluptuous its so much more productive than doing them in Go, which I had previously done.
Go is great for systems programing, building kubernetes, CLIs, etc.
It is very far from being a good idea to use it for general web development. Right tool for the job and such.
I agree is not ideal if you want a full-blown monolith web app. In that case a typical MVC framework will save you weeks.
Even if it is just a rest api, you still need a database/ORM layer, a validation framework, a migrations system, a way to document it, etc.
So, from a developers life quality and company economics point of view, django or rails are way, way more performant, but not as cool I agree.
Sure, if you're building Facebook or google Go might be the best option.
[1] https://github.com/ent/ent
I have very little temptation to use it for a whole application though. Unless you are already a Go shop I would advise anyone to just get better at making Ruby, Python, PHP, or JavaScript back ends that are more performant.
https://pace.dev/blog/2018/05/09/how-I-write-http-services-a...
Use sqlx to extend the std lib.
Have dropped using an orm.
The api is defined with gRPC.io and offered as a gRPC api as well as a Rest api with JSON using grpc-gateway. Database is PostgreSQL using pgx. Caching via Resis or memcached. Building testing via a Makefile with junit and cobertura reports
Workflow: we use VSCode with devContainers (docker-compose local dev env), our tasks are simply defined in a Makefile. Our high-lvl dev workflow is documented here: https://github.com/allaboutapps/go-starter/wiki/FAQ#how-does...
Difficulties: Nothing special actually. We switched from Node.js to Go in the beginning of 2020 and it's been a pleasure for our new projects (software agency). I thought it was going to be hard to onboard our staff / new hires to Go and our stack, but this really turned out to be a non issue.
I write monoliths and render mostly HTML back to the client. I have a few json endpoints around for m2m APIs or to power search boxes here and there.
The main thing I’m hacking on at the moment is https://clubman.app other things are listed at https://notbad.software
A relatively up to date skeleton of my apps is at https://github.com/davidbanham/doubleboiler
[0] https://github.com/looplab/eventhorizon
We use Fiber (https://gofiber.io) as web framework and Pongo2 (https://github.com/flosch/pongo2) as template engine. The Go/Fiber parts are ok, the pain is template engine.
- Pongo2 syntax is like Django/Jinja2, but not as easy as Jinja2. I use Python+Jinja2 for years in production, it's so easy to use and troubleshoot.
- No builtin i18n support. You can find some blog posts or articles introduce pongo2, but no one mentions i18n support/implementation like no one need it. We implemented our own i18n support, but still need a tool to extract strings from template files for translation.
- The macro syntax doesn't support specifying argument names while calling. e.g. `{{ my_macro("a", "b", "c") }}` is ok, but not `{{ my_macro(name1="a", name2="b", name3="c") }}`. It's hard to organize reusable HTML/CSS code snippets.
- Sometimes the custom macro is correct (syntax part), but it renders nothing in output html, but if i add the same pongo2 code in its own unittests files, it works. Didn't find a way to troubleshoot, no clue at all what the problem is.
Anyway, Go itself and the web framework are very good for web development now, just miss a Jinja2 for Go.
Revel is often seen as anti-idiomatic because it's a whole framework but it is nice to get a web app going pretty fast (with Go). These days I have a lot more experience and I probably would choose echo or something similar. Not because I think that Revel is bad but because I have a lot more freedom with those.
For editing I mostly use Vim.
Generally I would say if you create web apps maybe choose something different from Go. It certainly can be easier/more comfortable. For APIs it's still great and one of the best choices IMO.
The end result are two web applications that work as a backend and frontend for an ActivityPub link aggregator (similar to HN and old redddit).
I mostly develop in Goland as I use the debugger extensively, and I didn't want to spend the time to learn to use delve in the command line.
I tried to keep as much as possible a handmade approach, so I'm making use of the standard library over more fancy packages or frameworks.
In my specific case the biggest issue I had was with the protocol itself (ActivityPub) which allows for a large degree of flexibility in the structure of the JSON objects it passes around, a lot more than the default encoder in go allows for. I had to implement my own functionality for encoding/decoding JSON objects, and I'm currently working on adding similar functionality for binary encoding.
Links to the projects you can find in my bio.
You start with a Makefile and a main.go and from there on you invent the universe, starting from (almost) writing an http server.
Welcome to the future.
I tried to describe my humble workflow here with a few code snippets: https://zserge.com/posts/go-web-services/
And 6 years laters you've invented an undocumented poor man's version of Flask.
And 16 years laters you invented your own ruby on rails, except with no community, no third party libraries, no support and no documentations.
At some point you've left the company and some poor soul is dealing with your simplicity.
This made me laugh. What's wrong with tailor-made software? It seems that all we care about nowadays is to "get shit done". I wish this kind of thinking vanishes soon.
This is not hyperbole.
Developers stay only for short amount of times compared to the lifetime of the product. New developers inherit all the tech debt, bugs and bad decisions in your custom framework.
Also I like your blog. Articles like re-implementing Vue and React and KVM are quite instructive.
I have started falling in love with coding/CS again with Go.
Our philosophy is to keep things close to the metal and not use layers as much as possible. Go enables you to follow with approach with the standard libraries that come with the language.
Problem with layers/frameworks is that while they seem to solve immediate problem quickly, layers will rear their ugly head down the road , making you feel helpless during debugging
We use standard libraries
database/sql for database html/template for UI
Only external package used so far is gin-gonic/gin for middleware&routing
Tools wise we use VSCode, have a good local Dev story and we migrated from sqlx to sqlc recently to speed things up.
We use gorilla mux and build API first with Vue for frontend. Really clean and simple stack with few moving parts.
My personal website was built using Go and Postgres. I did a lot of it from scratch using the standard library and very few dependencies.
I have my own deployment process using a makefile, git tags, and rsync. Migrations are just a set of sql files checked into the project.
This works pretty well for me since I'm the only developer on the project.
Here's my "tech" page with some information on the website: https://dwayne.xyz/tech
And the portfolio page for the website (on the website): https://dwayne.xyz/project/dwayne.xyz