Skip to content

marcodellorto/golang-devcontainer

Repository files navigation

Golang DevContainer

This repository serves as a skeleton for setting up Golang development environments using Visual Studio Code's DevContainers feature.

Overview

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.

Features

  • 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.

Development Environment Details

Docker

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.

AWS CLI and SAM

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:

  1. AWS CLI: The AWS CLI is configured and ready to use. If you did not yet set up your AWS credentials, run aws configure and start using the CLI for managing AWS services.

  2. AWS SAM: AWS SAM is installed to simplify the development of serverless applications. Use sam --version to confirm the installation and explore available commands for building and deploying serverless applications.

Claude Code

Claude Code is integrated into this development environment with the following configuration:

  • VS Code Extension: The anthropic.claude-code extension is automatically installed when the container starts.
  • Configuration Persistence: The ~/.claude directory from your host machine is bind-mounted to /root/.claude inside the container, so your Claude Code configuration and session data persist across container rebuilds.
  • Environment Variable: CLAUDE_CONFIG_DIR is set to /root/.claude automatically, pointing Claude Code to the mounted config directory.
  • Terminal Integration: claudeCode.useTerminal is 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:

Getting Started

To use this DevContainer for your Golang projects:

  1. Ensure you have Docker and Visual Studio Code installed.
  2. Clone (or fork) this repository:
    git clone git@github.com:marcodellorto/golang-devcontainer.git
  3. Create your docker-compose.override.yml file starting from the docker-compose.override.yml.dist file already present in the repository
    cp docker-compose.override.yml.dist docker-compose.override.yml
  4. Open the cloned folder in Visual Studio Code.
  5. VS Code should detect the DevContainer configuration. Click on the "Reopen in Container" prompt in the bottom-right corner.
  6. 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.

Contributing

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.

License

This project is licensed under the MIT License.

Acknowledgments

  • 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:

  • External Resources:

About

A skeleton for a Golang based VSCode devcontainer config

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors