Go for Web Development
Go delivers speed, security, and developer-friendly tools for Web Applications
Go is designed to enable developers to rapidly develop scalable and secure web applications. Go ships with an easy to use, secure and performant web server and includes it own web templating library. Go has excellent support for all of the latest technologies from HTTP/2, to databases like MySQL, MongoDB and ElasticSearch, to the latest encryption standards including TLS 1.3. Go web applications run natively on Google App Engine and Google Cloud Run (for easy scaling) or on any environment, cloud, or operating system thanks to Go’s extreme portability.
For enterprises, Go is preferred for providing rapid cross-platform deployment. With its goroutines, native compilation, and the URI-based package namespacing, Go code compiles to a single, small binary—with zero dependencies—making it very fast.
“If you are looking for powerful tools for web programming, mobile development, microservices, and ERP systems,” writes Andrew Smith, marketing manager at QArea. “Go web development has proved to be faster than using Python for the same kind of tasks in many use cases.”
Bayburtsyan summarizes the five key reasons his company switched to Go:
Compiles into a single binary — “Using static linking, Go actually combining all dependency libraries and modules into one single binary file based on OS type and architecture.”
Static type system — “Type system is really important for large scale applications.”
Performance — “Go performed better because of its concurrency model and CPU scalability. Whenever we need to process some internal request, we are doing it with separate Goroutines which are 10x cheaper in resources than Python Threads.”
No need for a web framework — “In most of the cases you really don’t need any third-party library.”
Great IDE support and debugging — “After rewriting all projects to Go, we got 64 percent less code than we had earlier.”
Featured Go users & projects
Hugo is a fast and modern website engine written in Go, and designed to make website creation fun again. Websites built with Hugo are extremely fast and secure and can be hosted anywhere without any dependencies.
Caddy 2 is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go. Caddy offers greater memory safety than servers written in C. A hardened TLS stack powered by the Go standard library serves a significant portion of all Internet traffic.
Medium uses Go to power their social graph, their image server and several auxiliary services. “We’ve found Go very easy to build, package, and deploy. We like the type-safety without the verbosity and JVM tuning of Java.”
Cloudflare speeds up and protects millions of websites, APIs, SaaS services, and other properties connected to the Internet. “Go is at the heart of CloudFlare’s services including handling compression for high-latency HTTP connections, our entire DNS infrastructure, SSL, load testing and more.”
The Economist needed more flexibility to deliver content to increasingly diverse digital channels. Services written in Go were a key component of the new system that would enable The Economist to deliver scalable, high performing services and quickly iterate new products. “Overall, it was determined that Go was the language best designed for usability and efficiency in a distributed, cloud-based system.”
The simplicity and safety of the Go language were a good fit for the United Kingdom’s government’s HTTP infrastructure, and some brief experiments with the excellent net/http package convinced web developers they were on the right track. “In particular, Go’s concurrency model makes it absurdly easy to build performant I/O-bound applications,”.
Go books on web development
Web Development with Go
Go Web Programming
Web Development Cookbook: Build full-stack web applications with Go
Building RESTful Web services with Go
Mastering Go Web Services
- Echo, a high performance, extensible, and minimalist Go web framework providing optimized HTTP router, group APIs, data binding for JSON and XML, HTTP/2 support, and much more.
- Flamingo, a fast open-source framework based on Go with clean and scalable architecture designed to build custom, fast and flexible frontend interfaces. Includes Flamingo Core and Flamingo Commerce.
- Gin, a web framework written in Go. It features a martini-like API with much better performance, up to 40 times faster. If you need performance and good productivity, you will love Gin.
- Gorilla, a web toolkit for the Go programming language. Packages include a powerful URL router and dispatcher, context, RPC, schema, sessions, websocket, and more.
- julienschmidt/httprouter, a lightweight high performance HTTP request router
- gorilla/mux, a powerful HTTP router and URL matcher for building Go web servers with 🦍
- chi, a lightweight, idiomatic and composable router for building Go HTTP services.
- net/http, standard library HTTP package
- html/template, standard library HTML template engine
- flosch/pongo2, a Django-syntax like templating-language
Databases & Drivers
- database/sql, standard library interface with driver support for MySQL, Postgres, Oracle, MS SQL, BigQuery and most SQL databases
- mongo-driver/mongo, The MongoDB supported driver for Go
- olivere/elastic, an Elasticsearch client for Go
- GORM, an ORM library for Go
- Bleve, full-text search and indexing for Go
- CockroachDB, an evolution of the database—architected for the cloud to deliver resilient, consistent, distributed SQL at scale
- markbates/goth, authentication for web apps
- jinzhu/gorm, an ORM library for Go
- dgrijalva/jwt-go, a Go implementation of json web tokens
- Learn to Create Web Applications using Go, a paid online course
- Hugo, The world’s fastest framework for building websites
- Mattermost, a flexible, open source messaging platform that enables secure team collaboration
- Caddy, a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go