# Go development image extending base ralphex
ARG BASE_TAG=latest
FROM ghcr.io/umputun/ralphex:${BASE_TAG}

LABEL org.opencontainers.image.description="Autonomous plan execution with Claude Code - Go development"

# install latest go from official distribution
ARG GO_VERSION=1.26.1
RUN ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \
    wget -qO- "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" | tar -xz -C /usr/local

# set go environment
ENV GOROOT=/usr/local/go
ENV GOPATH=/home/app/go
ENV PATH="${PATH}:${GOROOT}/bin:${GOPATH}/bin"

# install go development tools (golangci-lint, moq, goimports)
RUN wget -qO- https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b /usr/local/bin && \
    GOBIN=/usr/local/bin go install github.com/matryer/moq@latest && \
    GOBIN=/usr/local/bin go install golang.org/x/tools/cmd/goimports@latest
