This repository serves as a skeleton for setting up Golang development environments using Visual Studio Code's DevContainers feature.
The Golang DevContainer provides a pre-configured environment for Golang development, leveraging Visual Studio Code's remote container capabilities. It includes essential configurations and extensions to streamline the Golang development workflow.
- Golang Environment: Configured with the latest stable version of Golang.
- Visual Studio Code Integration: Optimized settings and extensions for seamless integration with VS Code.
- Docker Configuration: Ready-to-use Dockerfile and docker-compose configuration for easy containerization.
- AWS and SAM Integration: AWS Command Line Interface (CLI) and AWS Serverless Application Model (SAM) are installed to facilitate AWS-related development tasks.
- Claude Code Integration: Pre-configured with the Claude Code VS Code extension, including automatic configuration persistence and terminal integration.
This development environment is containerized using Docker, ensuring consistency across different setups. To get started, ensure you have Docker installed on your system. If not, you can download and install Docker from here.
The AWS CLI and SAM tools are pre-installed in this environment to facilitate AWS-related tasks. Here's how to access them within the DevContainer:
-
AWS CLI: The AWS CLI is configured and ready to use. If you did not yet set up your AWS credentials, run
aws configureand start using the CLI for managing AWS services. -
AWS SAM: AWS SAM is installed to simplify the development of serverless applications. Use
sam --versionto confirm the installation and explore available commands for building and deploying serverless applications.
Claude Code is integrated into this development environment with the following configuration:
- VS Code Extension: The
anthropic.claude-codeextension is automatically installed when the container starts. - Configuration Persistence: The
~/.claudedirectory from your host machine is bind-mounted to/root/.claudeinside the container, so your Claude Code configuration and session data persist across container rebuilds. - Environment Variable:
CLAUDE_CONFIG_DIRis set to/root/.claudeautomatically, pointing Claude Code to the mounted config directory. - Terminal Integration:
claudeCode.useTerminalis enabled, allowing Claude Code to use the integrated VS Code terminal.
Prerequisite: Claude Code must be installed and configured on your host machine before the bind-mount will carry your credentials into the container.
For more information on using Docker, AWS CLI, and SAM, refer to their respective documentation:
To use this DevContainer for your Golang projects:
- Ensure you have Docker and Visual Studio Code installed.
- Clone (or fork) this repository:
git clone git@github.com:marcodellorto/golang-devcontainer.git
- Create your
docker-compose.override.ymlfile starting from thedocker-compose.override.yml.distfile already present in the repositorycp docker-compose.override.yml.dist docker-compose.override.yml
- Open the cloned folder in Visual Studio Code.
- VS Code should detect the DevContainer configuration. Click on the "Reopen in Container" prompt in the bottom-right corner.
- Voila! You're now set up with a Golang development environment with Docker, AWS CLI, SAM, and Claude Code configured.
For more detailed instructions, refer to the DevContainer documentation.
Contributions are welcome! Feel free to open issues or pull requests for any improvements or new features.
Before contributing, please review the contribution guidelines to maintain consistency and quality.
This project is licensed under the MIT License.
-
Contributors:
-
Libraries and Tools:
- Docker: Used for containerization of the development environment.
- AWS CLI: Facilitates interaction with AWS services.
- AWS SAM: Aiding in the development of serverless applications.
- VS Code DevContainers: Structure and setup inspiration.
- golangci-lint: Linting tool for checking Go code.
- Claude Code: AI coding assistant integrated into the development environment.
-
Docker Images:
- marcodellorto/golang: Docker images used as a base for the Golang development environment.
-
External Resources:
- Golang Documentation: Best practices and language features.
- Golang Project Layout: Basic layout for Go application projects, not an official standard but highly suggested.