Please answer the following before submitting your issue:
dlv version)? (master branch)dlv versiongo version)?go version go1.12.7 darwin/amd64
What operating system and processor architecture are you using?
Mojave - 10.14..6
2.2 GHz Intel Core i7
What did you do?
$ make build
go build "-ldflags=-s -X main.Build=4779218a8354d2facdbf2c48263c4144be330ca0" github.com/go-delve/delve/cmd/dlv
$ make install
go install "-ldflags=-s -X main.Build=4779218a8354d2facdbf2c48263c4144be330ca0" github.com/go-delve/delve/cmd/dlv
$ dlv
-bash: dlv: command not found
dlv should be found and work
-bash: dlv: command not found
Following my go env.
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/camilamacedo/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/camilamacedo/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/r_/ym6yn3cd0q3fm5jcgcwvj4z00000gn/T/go-build684405042=/tmp/go-build -gno-record-gcc-switches -fno-common"
Following my env vars setup.
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$GOPATH/bin:$PATH
If I go to the GOPATH/bin it works
However, why it is not working from any place by running just dlv? Is it missing something in the setup?
$ ./dlv
Delve is a source level debugger for Go programs.
Delve enables you to interact with your program by controlling the execution of the process,
evaluating variables, and providing information of thread / goroutine state, CPU register state and more.
The goal of this tool is to provide a simple yet powerful interface for debugging Go programs.
Pass flags to the program you are debugging using `--`, for example:
`dlv exec ./hello -- server --config conf/config.toml`
Usage:
dlv [command]
Available Commands:
attach Attach to running process and begin debugging.
connect Connect to a headless debug server.
core Examine a core dump.
debug Compile and begin debugging main package in current directory, or the package specified.
exec Execute a precompiled binary, and begin a debug session.
help Help about any command
run Deprecated command. Use 'debug' instead.
test Compile test binary and begin debugging program.
trace Compile and begin tracing program.
version Prints version.
Flags:
--accept-multiclient Allows a headless server to accept multiple client connections.
--api-version int Selects API version when headless. (default 1)
--backend string Backend selection (see 'dlv help backend'). (default "default")
--build-flags string Build flags, to be passed to the compiler.
--check-go-version Checks that the version of Go in use is compatible with Delve. (default true)
--headless Run debug server only, in headless mode.
--init string Init file, executed by the terminal client.
-l, --listen string Debugging server listen address. (default "127.0.0.1:0")
--log Enable debugging server logging.
--log-dest string Writes logs to the specified file or file descriptor (see 'dlv help log').
--log-output string Comma separated list of components that should produce debug output (see 'dlv help log')
--wd string Working directory for running the program. (default ".")
Additional help topics:
dlv backend Help about the --backend flag.
dlv log Help about logging flags.
The error was in the env vars. Following the fix.
export GOPATH=$HOME/go
export GOROOT=/usr/local/Cellar/go/1.12.7/libexec
export PATH=$GOPATH/bin:$PATH
export PATH=$PATH:$GOROOT/bin
You can set your export (GOPATH and GOROOT)following the output of the command:
$ go env
Most helpful comment
The error was in the env vars. Following the fix.