I was able to get go package management work for my local environment with https. But in docker im doing same thing and it doesn’t work. Any help would be much appreciated.
Here is my docker file.
FROM golang:1.23.2 AS debug
# Set the working directory
WORKDIR /app
# Copy dependency files and application source code
COPY go.mod .
COPY go.sum .
COPY . /app
RUN echo "machine github.com login ${GIT_USER} password ${GIT_PAT}" > /root/.netrc &&
chmod 600 /root/.netrc &&
git config --global url."https://${GIT_USER}:${GIT_PAT}@github.com/${ORGANIZATION}/".insteadOf https://github.com/${ORGANIZATION}/"
# Set the Go private environment variable
RUN go env -w GOPRIVATE=github.com/${ORGANIZATION}/*
RUN go mod tidy
# Install Delve debugger
WORKDIR /app/cmd
RUN go install github.com/go-delve/delve/cmd/[email protected]
# Add the database schema to the container (if applicable)
COPY db/schema.sql /docker-entrypoint-initdb.d/schema.sql
# Expose necessary ports
EXPOSE 8082 40002
ENV PORT=8082
# Command to start the debugging process
CMD ["dlv", "debug", "--headless", "--listen=:40002", "--api-version=2", "--accept-multiclient", "--log", "--log-output=gdbwire", "--continue"]