This tutorial shows you how to make small Docker images when building Go programs.
Let’s take a look at the code:
As you can see, the code doesn’t do much, it listens on a port specified by the APP_PORT environment variable and returns a JSON response when GET requests are made to /.
The code for this post can be downloaded from this GitHub repository.
Even the small amount of code above can create large Docker images depending on how you build them. Let’s make the smallest image possible in the next step. …
This tutorial will show you how to setup a CI/CD pipeline using GitHub Actions. The pipeline will test, build and publish a Go app to Docker Hub when changes are pushed to a GitHub repository.
Here is an overview of what’s in this guide:
I’m sure you’ve read the stories of people that accidentally committed their AWS keys to a public Git repo and how costly this mistake can be.
Some random script kiddy scans GitHub for projects that contain API keys, steals the key and uses it to deploy instances that mine cryptocurrency, running up huge bills.
This problem can be avoided with this simple technique.
First of all, don’t store the API key or any other configuration information in your code. This is rule number three of creating Twelve Factor Apps which I encourage you to read about here.
If you’re following the Twelve Factor Apps guidelines, you should be loading the API key from an environment variable like shown in the following Go…
Learn how to make a simple command line program with Go.
I’ve just started learning Go and I put together a simple module called finnhub-go that lets you query the Finnhub Stock API for the current price of a company.
In this post, I’ll show you how to create a simple command line program that takes the company ticker symbol as an argument and outputs its stock price.
Make sure you have Go installed on your local machine. In the following example, I’m using version 1.14.4 on a MacBook Pro.
First of all, create a directory to contain your code.
We’ll call it stonks…