One of the highlights of the Go programming language is its ability to handle concurrency with minimal effort using what are called goroutines and channels. The beauty here versus other programming languages is that you don’t end up in a callback mess or locking hell. In fact, you can even create far more goroutines in Go than you can in a language such as Java with the same hardware.
We’re going to see an example where we have an application that starts several worker goroutines and shares a channel for accessing data.
Read MoreWhen developing an application with the Go programming language, you might find yourself needing to save data locally. If you’ve been keeping up you’ll remember that I’ve written about storing data remotely with Golang in a Couchbase NoSQL database, but never anything locally. Probably the easiest way to store data locally is with a SQLite database as it is a solid technology that has been around for a while.
We’re going to see how to use a SQLite database in our Golang application to read and write local data.
Read MoreI personally think that Golang is a great development technology and one of the better that I’ve used. However, there is no such thing as a perfect development technology. That said, there are things to be desired in Golang out of the box. For example, I always find myself wishing that I could use type assertions to decode map values into a defined Go data structure.
Using a nifty package, this actually becomes a possibility and without much extra effort. We’re going to see how to take a map and convert it into a custom structure.
Read MoreHave you ever built an application and decided that you didn’t want to hardcode a bunch of values that might change frequently? The answer is, probably yes. When building a web application, it is common to separate configuration details into a separate file which might contain database information, hostnames, passwords, and anything else that probably shouldn’t exist in the application as hard-coded values.
We’re going to see how to open a JSON configuration file using the Go programming language and load it into a custom data structure to be used throughout the application.
Read MoreI am pleased to announce that the latest episode of The Polyglot Developer Podcast has been published to all the popular podcasting networks which include, but are not limited to, iTunes and Pocket Casts. In this episode titled, The Go Programming Language and Where it Fits in Modern Development, I am joined by Go advocate, Matt Holt, where we discuss Go as an option to modern development.
In this episode we discuss where Go excels and how it compares to other popular development technologies such as PHP and Node.js.
Read MoreEver found yourself working with comma separated value (CSV) data from a file or other source? This format is easy to generate if you’re working with spreadsheet applications like Google Sheets or Microsoft Excel, and RDBMS applications. So how do we load this data and work with it in an application? More specifically an application built with the Go programming language?
We’re going to see how to take a CSV file and load it into a custom data structure to eventually be printed as JSON within the application.
Read MoreSo I’ve been working on a project that uses the Go programming language. The application I’m building is a web application that I plan to distribute. The thing is, I don’t want to distribute hundreds of files to make it possible. The application has an API built with Go and the front-end that consumes the API is built with Angular. This lead me searching for a way to bundle all the files into the final binary.
There are several packages that exist for bundling assets into a Golang application. Popular packages include go-bindata, go-bindata-assetfs, and go.rice. I had the most success with go.rice, so we’re going to explore it in this article.
Read More