Debug trong golang

Debug trong golang

Dockerfile FROM golang:1.23-alpine WORKDIR /app RUN go install github.com/air-verse/air@latest RUN go install github.com/go-delve/delve/cmd/dlv@latest COPY go.mod go.sum ./ RUN go mod download CMD ["air", "-c", ".air.toml"]   docker-compose services: app: build: context: . dockerfile: Dockerfile ports: - 2345:2345 volumes: - ./:/app .air.toml ... [build] args_bin = [] # bin = ";APP_ENV=development ./tmp/main" full_bin = "APP_ENV=development d...

Debug unit test trong golang

Debug unit test trong golang

1. In go project - Export port 41000 for debugging. - Install dlv: `go install github.com/go-delve/delve/cmd/dlv@latest` ...