Skip to content
David Honghao Shao edited this page Jul 20, 2018 · 21 revisions

IDE

We use GOLAND for coding.

Download and install GOLAND

Note: You can use your school email to get a free lisence

Install Docker plugin in GOLAND

  1. Open GOLAND (menu) -> Preferences.
  2. Press Plugins.
  3. Type Docker Integration in search field.
  4. Choose Docker Integration
  5. Press Install.
  6. When plugin is installed, press Restart GOLAND.

Enable Docker Support plugin in GOLAND

See To enable Docker support Part

Get the latest version of docker with Go set up

docker pull ventureum/dev

Create container from an existing image

See To run a container from an existing image Part

Using the setting below to set up container:

  • Command line options
--security-opt="apparmor=unconfined" --cap-add=SYS_PTRACE
  • Bind mounts ( use your own host path)

  • Port bindings

Result:

Debug (use Feed System Backend example)

  1. Check Environment Setting in Container
cat  ~/.profile

Make sure you have the following setting

export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
export GOPATH=/root/projects/Niagara/aws/go/
  1. Set up Feed System Backend

    The only difference is the step 5 in Start Feed Log Subscription Job, do:

go get -u github.com/derekparker/delve/cmd/dlv
go build -gcflags='-N -l'
dlv --listen=:40000 --headless=true --api-version=2 
  1. Set Remote Debug in GOLAND

go to GOLAND menu "Run | Edit Configurations…" and add a new Go Remote configuration, fill in the remote host IP (localhost) and port number (40000)

  1. Mark Breaking Points (click the side bar to label breaking points (Red Points))

More details about (breaking points)[https://www.jetbrains.com/help/idea/using-breakpoints.html]

  1. Run Remote Debug

Go to GOLAND menu "Run | Run …" and choose the configuration you have set in Step 3. Then You will see:

Container will show log:

Clone this wiki locally