From fb0a13755dd7235ee67b4db3f01b8329cfb6f2e0 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Sat, 24 May 2025 17:26:22 +0000 Subject: [PATCH] address review comments & fixes Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- .devcontainer/Dockerfile | 11 +++++------ .devcontainer/devcontainer.json | 3 +-- .devcontainer/post-attach.sh | 2 +- CONTRIBUTING.md | 12 ++++++++++-- Makefile | 12 ++++++------ 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ae78b357..462aeb65 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,15 +1,14 @@ -ARG GO_VERSION=1.24.3 +FROM golang:1.24.3 + ARG GOLANGCI_LINT_VERSION=2.1.6 # renovate: depName=golangci/golangci-lint datasource=github-releases -FROM golang:${GO_VERSION} - -# install docker -RUN apt update && apt upgrade -y && apt-get install -y ca-certificates curl gnupg lsb-release jq zsh neovim && \ +RUN apt update && apt upgrade -y && \ + apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release jq zsh neovim && \ chsh -s $(which zsh) && \ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \ rm -rf /var/lib/apt/lists/* -RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v${GOLANGCI_LINT_VERSION} RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bab27384..65c2cce1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -50,8 +50,7 @@ // Set *default* container specific settings.json values on container create. "settings": { "go.toolsManagement.checkForUpdates": "local", - "go.useLanguageServer": true, - "go.gopath": "/go" + "go.useLanguageServer": true }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh index e34f8c4b..904db4eb 100644 --- a/.devcontainer/post-attach.sh +++ b/.devcontainer/post-attach.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # Display welcome banner echo -e "\033[1;36m" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e89c103b..e633f9b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,8 +54,16 @@ If you are using VS Code, feel free to copy `settings.json` from `.vscode/settin ## Devcontainer support -The project uses a devcontainer to provide a consistent development environment. -If you are using VS Code, you can use the devcontainer by opening the project in a container. +Prerequisites: + +- Docker (or Docker Desktop) installed on your machine +- [VS Code Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + +To launch the devcontainer: + +1. Open the project in VS Code. +2. Run **Remote-Containers: Open Folder in Container** from the Command Palette. + See [Developing inside a Container](https://code.visualstudio.com/docs/devcontainers/containers) for more details. ## Testing diff --git a/Makefile b/Makefile index 927c6b11..082398e2 100644 --- a/Makefile +++ b/Makefile @@ -116,12 +116,12 @@ lint: ensure-golangci-lint golangci-lint run --fix .PHONY: ensure-golangci-lint -ensure-golangci-lint: - @CURRENT_VERSION=$$(golangci-lint version --short 2>/dev/null || echo "not installed"); \ - if [ "$$CURRENT_VERSION" != "$(GOLANGCI_LINT_VERSION)" ]; then \ - echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION) (current: $$CURRENT_VERSION)"; \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION); \ - fi + ensure-golangci-lint: + @CURRENT_VERSION=$$(golangci-lint version --short 2>/dev/null | sed 's/^v//' || echo "not installed"); \ + if [ "$$CURRENT_VERSION" != "$(GOLANGCI_LINT_VERSION)" ]; then \ + echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION) (current: $$CURRENT_VERSION)"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v$(GOLANGCI_LINT_VERSION); \ + fi .PHONY: release-build release-build: