Skip to content

feat: add devcontainer for VS Code and GitHub Codespaces#692

Open
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
dlevy-msft-sql:feat/devcontainer
Open

feat: add devcontainer for VS Code and GitHub Codespaces#692
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
dlevy-msft-sql:feat/devcontainer

Conversation

@dlevy-msft-sql
Copy link
Contributor

@dlevy-msft-sql dlevy-msft-sql commented Feb 2, 2026

Summary

This PR adds a development container setup for easier onboarding and consistent development environments.

What's Included

Development Environment

  • Go 1.24 with all development tools:
    • gopls (language server)
    • delve (debugger)
    • staticcheck
    • golangci-lint
    • gotext (for translations)

SQL Server 2025

  • Developer Edition running as a sidecar container
  • Health checks ensure it's ready before dev container starts
  • Pre-configured SA password
  • Test database (SqlCmdTest) created on startup

VS Code Extensions (pre-installed)

  • Go (golang.go)
  • MSSQL (ms-mssql.mssql) - with pre-configured connection
  • Docker (ms-azuretools.vscode-docker)
  • GitHub Copilot
  • GitLens

Features

  • Docker-in-Docker for container operations (testing sqlcmd create mssql, etc.)
  • GitHub CLI pre-installed for PR management
  • Locally built sqlcmd added to PATH automatically

Environment Variables

Pre-configured so tests run immediately:

  • SQLCMDSERVER=localhost
  • SQLCMDUSER=sa
  • SQLCMDPASSWORD=SqlCmd@2025!
  • SQLCMDDATABASE=master

Helpful Aliases

Alias Command
gtest Run all tests
gbuild Build sqlcmd locally
ginstall Build and install sqlcmd to ~/bin
glint Run golangci-lint
sql Connect to SQL Server interactively
test-db Test database connection

Usage

VS Code

  1. Install the Dev Containers extension
  2. Open this repo in VS Code
  3. Click "Reopen in Container"
  4. Start developing!

GitHub Codespaces

  1. Click "Code" > "Codespaces" > "Create codespace"
  2. Wait for environment to start
  3. Run gtest to verify everything works

Relation to go-mssqldb

This follows the same pattern as go-mssqldb PR #317, making it easy for contributors to work on both projects with consistent environments.

@dlevy-msft-sql dlevy-msft-sql self-assigned this Feb 2, 2026
@dlevy-msft-sql dlevy-msft-sql added enhancement New feature or request Size: S Small issue (less than one week effort) needs-work labels Feb 2, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a VS Code / GitHub Codespaces devcontainer setup to make onboarding and running integration tests against a local SQL Server container easier and more consistent.

Changes:

  • Introduces a full .devcontainer/ configuration (Dockerfile, docker-compose, devcontainer.json, post-create provisioning, and SQL bootstrap script).
  • Documents devcontainer usage in both the root README and a dedicated .devcontainer/README.md.
  • Adds a root .dockerignore to reduce Docker build context noise.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
README.md Adds “Open in Dev Containers” badge and a Development section with quickstart/manual setup.
.dockerignore Defines ignore rules for Docker builds from the repo root.
.devcontainer/Dockerfile Dev image with Go toolchain + common Go dev tools and dependencies.
.devcontainer/docker-compose.yml Orchestrates devcontainer + SQL Server sidecar with healthcheck.
.devcontainer/devcontainer.json VS Code devcontainer configuration, extensions, forwarded ports, env vars, post-create command.
.devcontainer/post-create.sh Post-create setup: downloads deps, builds sqlcmd, validates build, waits for DB, runs setup.sql, adds aliases.
.devcontainer/mssql/setup.sql Creates a SqlCmdTest database and sample objects for quick testing.
.devcontainer/README.md Detailed documentation for devcontainer usage, troubleshooting, and customization.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

@dlevy-msft-sql dlevy-msft-sql added the Priority: 2 Medium priority/impact label Feb 3, 2026
- Go 1.24 with gopls, delve, staticcheck, golangci-lint
- SQL Server 2025 (Developer Edition) with health checks
- go-sqlcmd built and installed from source (dogfooding!)
- Pre-configured VS Code extensions (Go, MSSQL, Copilot, etc.)
- Environment variables pre-set for testing
- Add Development section to README with quick start guide
- Add 'Open in Dev Containers' badge to README
@dlevy-msft-sql dlevy-msft-sql force-pushed the feat/devcontainer branch 2 times, most recently from cd49443 to 0e4fea5 Compare February 5, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Priority: 2 Medium priority/impact Size: S Small issue (less than one week effort)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant