Comments (5)
Could you elaborate on a flow you’d use from the CLI with GoDev?
from godev.
Something like this: https://github.com/lukehoban/webapp-go/tree/debugging
In short: Having the ability to start docker-compose run debug
and the hook up VSCode Remote Debugging. It would be nice to set some commands and flags to debug, but this is handled in #17.
from godev.
@DanielHabenicht interesting, this will be useful- I’m relatively new to Go so let me play around with it for awhile first to get a hang of how to use it before I work on this!
from godev.
Me too. :)
I couldn't get it to work with the example repo, but have previously debugged successfully in your containers.
If I find out how I got it working in your go-container I will post an update.
from godev.
You can debug with delve with a docker/ docker-compose setup like this
I am still figuring out how to fix the breakpoint detection in the IDE (there is something related with file paths that makes debug listen but do not detect path mappings).. but shouldn't be far from this.
FROM golang:1.12-alpine AS build-env
WORKDIR /ms-skeleton-go
COPY . .
RUN apk add --no-cache git \
# Compile Delve for debug
&& go get -u github.com/go-delve/delve/cmd/dlv \
&& CGO_ENABLE=0 go install -tags netgo -v -gcflags "all=-N -l" -ldflags "-X main.version=unknown -X 'main.build=$(date)'" ./...
FROM alpine:3.9
COPY --from=build-env /go/bin/cmd /service
COPY --from=build-env /go/bin/dlv /debugger
# Allow delve to run on Alpine based containers.
RUN apk add --no-cache libc6-compat
# application 8080, delve 40000
EXPOSE 8080 40000
# Service
#ENTRYPOINT ["/service"]
# Run delve
CMD ["/debugger", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "/service"]
in docker-compose.yml
app:
env_file:
- .env
build: .
security_opt:
- apparmor:unconfined # for delve debugger
cap_add:
- SYS_PTRACE # needed to allow the containers to read /proc/$PID (delve debugger)
mem_limit: 64m
memswap_limit: 0
mem_swappiness: 0
depends_on:
mariadb:
condition: service_started
restart: on-failure
ports:
- 8080:8080
- 40000:40000
from godev.
Related Issues (20)
- Auto-Reload not working on Windows HOT 2
- As a User, I’d like to be able to pass in environment variables to my application under development so I can test related behaviour
- As a User, I’d like to be able to pass in parameters to my application under development so that I can test out related behaviour HOT 2
- As a MacOS User, I’d like to install GoDev via Brew so I can have managed automated updates
- As a Linux User, I’d like to be able to use a package manager to install GoDev so I can receive automatic updates
- As a Windows user, I’d like to use Chocolatey to use GoDev so I can have automated updates via the package manager
- As a User, I would like execution of execution groups to stop upon one of the previous groups failing so that I know the live changes are truly up to date
- unable to use the command line on windows HOT 5
- Terminal coloring not working on Windows
- Version information not generated correctly in released binary HOT 1
- As a User, I would like the run mode to be specified as a sub-command instead of a flag for clarity
- [PINNED] Tooling chores/improvements
- [PINNED] Documentation updates
- Getting `Runtime error: index out of range` on MacOS with VSCode HOT 1
- [PINNED] Releases
- Crazy CPU usage on Mac (edit: also inside Docker container) HOT 5
- Not killing process
- failed to initialize build cache at /.cache/go-build: mkdir /.cache: permission denied
- Unable to install with go get HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godev.