This is a gist for setting up a fresh learning environment to learn Go programming. Primary tools used:
- Docker
- VS Code
- VS Code extensions - Go, Remote Development, Docker
- Go runtime
Since Docker Desktop changed their license for usage there has been a surge in adopting alternatives such as Collima, Podman Desktop, Rancher Desktop, Finch etc.
brew install colima docker docker-compose docker-credential-helpercolima start --cpu 2 --memory 4Curently exploring devpod.sh with Colima
Beginning project directory can look like this:
<project name>
|- .devcontainer/
| |- devcontainer.json
|- .gitignore
|- hello-world.go
|- README.md
A structured Go project directory without modules should look like below:
<project name>
|- .devcontainer/
| |- Dockerfile
| |- devcontainer.json
|- cmd/ # subdirectories for each CLI command being built.
|- docs/
|- pkg/ # non-main packages
|- .gitignore
|- Makefile
|- README.md
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm"
// Or use the universal image from AWS used in codecatalyst. More info: https://docs.aws.amazon.com/codecatalyst/latest/userguide/devenvironment-universal-image.html
//"image": "public.ecr.aws/aws-mde/universal-image:3.0"
}