Created
May 19, 2026 11:44
-
-
Save cyberkryption/113acca5b1fd21723ced239463a2fa75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # setup-dev-env.sh | |
| # Installs VS Code, Go 1.26.3, golangci-lint, Go dev tools, | |
| # Node.js 22 (Maintenance LTS), and npm on Debian 13 (Trixie) | |
| # Usage: chmod +x setup-dev-env.sh && ./setup-dev-env.sh | |
| set -euo pipefail | |
| GO_VERSION="1.26.3" | |
| GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz" | |
| GO_URL="https://go.dev/dl/${GO_TARBALL}" | |
| # ───────────────────────────────────────── | |
| # Helpers | |
| # ───────────────────────────────────────── | |
| info() { echo -e "\n\033[1;34m[INFO]\033[0m $*"; } | |
| success() { echo -e "\033[1;32m[OK]\033[0m $*"; } | |
| warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; } | |
| # ───────────────────────────────────────── | |
| # 1. System update | |
| # ───────────────────────────────────────── | |
| info "Updating system packages..." | |
| sudo apt update && sudo apt upgrade -y | |
| success "System updated" | |
| # ───────────────────────────────────────── | |
| # 2. Install dependencies | |
| # ───────────────────────────────────────── | |
| info "Installing dependencies..." | |
| sudo apt install -y curl gpg apt-transport-https wget | |
| success "Dependencies installed" | |
| # ───────────────────────────────────────── | |
| # 3. VS Code | |
| # ───────────────────────────────────────── | |
| info "Adding Microsoft GPG key and VS Code repository..." | |
| curl -sSL https://packages.microsoft.com/keys/microsoft.asc \ | |
| | gpg --dearmor \ | |
| | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null | |
| echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] \ | |
| https://packages.microsoft.com/repos/code stable main" \ | |
| | sudo tee /etc/apt/sources.list.d/vscode.list | |
| info "Installing VS Code..." | |
| sudo apt update && sudo apt install -y code | |
| success "VS Code installed: $(code --version | head -1)" | |
| # ───────────────────────────────────────── | |
| # 4. Go | |
| # ───────────────────────────────────────── | |
| info "Downloading Go ${GO_VERSION} from go.dev/dl/..." | |
| wget -q --show-progress "${GO_URL}" | |
| info "Verifying download..." | |
| sha256sum "${GO_TARBALL}" | |
| warn "Please cross-check the hash above against https://go.dev/dl/ before continuing." | |
| read -rp "Hash looks correct? (y/n): " confirm | |
| if [[ "${confirm}" != "y" ]]; then | |
| echo "Aborting. Please verify the download manually." | |
| rm -f "${GO_TARBALL}" | |
| exit 1 | |
| fi | |
| info "Installing Go to /usr/local/go..." | |
| sudo rm -rf /usr/local/go | |
| sudo tar -C /usr/local -xzf "${GO_TARBALL}" | |
| rm -f "${GO_TARBALL}" | |
| # ───────────────────────────────────────── | |
| # 5. Go environment variables | |
| # ───────────────────────────────────────── | |
| info "Configuring Go environment variables..." | |
| SHELL_RC="${HOME}/.bashrc" | |
| if [[ "${SHELL}" == */zsh ]]; then | |
| SHELL_RC="${HOME}/.zshrc" | |
| fi | |
| if ! grep -q '/usr/local/go/bin' "${SHELL_RC}"; then | |
| echo 'export PATH=$PATH:/usr/local/go/bin' >> "${SHELL_RC}" | |
| echo 'export PATH=$PATH:$HOME/go/bin' >> "${SHELL_RC}" | |
| success "PATH entries added to ${SHELL_RC}" | |
| else | |
| warn "Go PATH entries already present in ${SHELL_RC}, skipping" | |
| fi | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:$HOME/go/bin | |
| success "Go installed: $(go version)" | |
| # ───────────────────────────────────────── | |
| # 6. Go dev tools | |
| # ───────────────────────────────────────── | |
| info "Installing Go dev tools..." | |
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
| go install golang.org/x/tools/gopls@latest | |
| go install github.com/go-delve/delve/cmd/dlv@latest | |
| go install golang.org/x/tools/cmd/goimports@latest | |
| success "Go tools installed" | |
| # ───────────────────────────────────────── | |
| # 7. Node.js 22 (Maintenance LTS) + npm | |
| # ───────────────────────────────────────── | |
| info "Removing any existing Node.js installation..." | |
| sudo apt remove -y nodejs npm 2>/dev/null || true | |
| info "Adding NodeSource repository for Node.js 22..." | |
| curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - | |
| info "Installing Node.js 22 and npm..." | |
| sudo apt install -y nodejs | |
| success "Node.js installed: $(node --version)" | |
| success "npm installed: $(npm --version)" | |
| # ───────────────────────────────────────── | |
| # 8. VS Code extensions | |
| # ───────────────────────────────────────── | |
| info "Installing VS Code extensions..." | |
| code --install-extension golang.go | |
| code --install-extension anthropic.claude-code | |
| success "VS Code extensions installed" | |
| # ───────────────────────────────────────── | |
| # 9. Summary | |
| # ───────────────────────────────────────── | |
| echo "" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo " Installation complete — version summary" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo " VS Code: $(code --version | head -1)" | |
| echo " Go: $(go version)" | |
| echo " golangci-lint: $(golangci-lint --version)" | |
| echo " gopls: $(gopls version)" | |
| echo " dlv: $(dlv version | head -1)" | |
| echo " Node.js: $(node --version)" | |
| echo " npm: $(npm --version)" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo "" | |
| echo " Next steps:" | |
| echo " 1. Run: source ${SHELL_RC}" | |
| echo " 2. Clone your repo" | |
| echo " 3. Add CLAUDE.md to the repo root" | |
| echo " 4. Run: code ." | |
| echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment