majodev / go-docker-vscode

Template for working with Go in Docker via VSCode remote containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-docker-vscode

Template for working with Go in Docker via VSCode remote containers.

License: MIT Build and Test

go starter overview

Extracted from allaboutapps/go-starter.

ToC:

Requirements

Requires the following local setup for development:

This project makes use of the Remote - Containers extension provided by Visual Studio Code. A local installation of the Go tool-chain is no longer required when using this setup.

Please refer to the official installation guide how this works for your host OS and head to our FAQ: How does our VSCode setup work? if you encounter issues.

Quickstart

Create a new git repository through the GitHub template repository feature (use this template). You will then start with a single initial commit in your own repository.

# Clone your new repository, cd into it, then easily start the docker-compose dev environment through our helper
./docker-helper.sh --up

You should be inside the 'service' docker container with a bash shell.

development@94242c61cf2b:/app$ # inside your container...

# Shortcut for make init, make build, make info and make test
make all

# Print all available make targets
make help

Visual Studio Code

If you are new to VSCode Remote - Containers feature, see our FAQ: How does our VSCode setup work?.

Run CMD+SHIFT+P Go: Install/Update Tools after attaching to the container with VSCode to auto-install all golang related vscode extensions.

Building and testing

Other useful commands while developing your service:

development@94242c61cf2b:/app$ # inside your container...

# Print all available make targets
make help

# Shortcut for make init, make build, make info and make test
make all

# Init install/cache dependencies and install tools to bin
make init

# Rebuild only after changes to files
make

# Execute all tests
make test

Full docker build:

docker build . -t go-docker-vscode

docker run go-docker-vscode
# Hello World

Uninstall

Simply run ./docker-helper --destroy in your working directory (on your host machine) to wipe all docker related traces of this project (and its volumes!).

Maintainers

License

MIT © Mario Ranftl

About

Template for working with Go in Docker via VSCode remote containers

License:MIT License


Languages

Language:Dockerfile 53.5%Language:Makefile 35.7%Language:Go 5.4%Language:Shell 5.3%