/ mozey.co / blog

golang delve osx

March 1, 2016

🔗 Install Delve OSX

🔗 Prerequisites

xcode-select --install

> command line tools are already installed, 
use "Software Update" to install updates

🔗 Create a self-signed certificate

Keychain Access

Keychain Access > Certificate Assistant > Create a Certificate

name                        dlv-cert
Identity Type               Self Signed Root
Certificate Type            Code Signing
Let me override defaults    Yes
set 365 days                3650 days
Continue...
Specify a Location For The Certificate > Keychain: System

In keychains select System
Context menu > Get info
Trust > Code Signing > Always Trust

In category select Keys
dlv-cert > right click > GetInfo > Access Control
Allow all applications to access this item > Save

Quit Keychain Access

Kill the current running taskgated process (or restart)

 ps ax | grep taskgated
 
 sudo kill xxx

🔗 Install the binary

git clone https://github.com/derekparker/delve.git && cd delve

GO15VENDOREXPERIMENT=1 CERT=dlv-cert make install

🔗 Troubleshooting

Eliminating codesign authorization prompt during builds

Eliminating “Developer tools access” prompt running delve

See troubleshooting link above

process instantly killed

🔗 Tutorial

Start debugger

dlv debug example.go

Start debugger (multiple files)

dlv debug ./

Set breakpoint

break example.go:123

Continue to breakpoint

c

Next line

n

Show help

help

Passing flags to the process

dlv debug example.go -- -flag

🔗 Setup with go-lang-idea-plugin in PyCharm

Running debugger from IDE doesn’t work reliably as of 2016-04-11

🔗 Add content root in PyCharm

Name spacing is done using packages, packages can be added to the IDE project like this

Settings > Project > Project Structure > Add Content Root

🔗 Live reload utility

🔗 gin

Install

go get github.com/codegangsta/gin

Verify installation

gin -h

🔗 fresh

Install

go get github.com/pilu/fresh

Usage

cd /path/to/app

fresh

🔗 Cross compiling for Windows slow

Everything is being recompiled?

GOOS=windows GOARCH=386 go build -v example.go

This speeds things up

GOOS=windows GOARCH=386 go install std