If ~/go/bin is in your PATH environment variable, then you can call Delve from everywhere as dlv. Otherwise, you will need to provide its full path. I am going to use the full path in this subsection.
The first Delve command that you should know is debug. This command will tell Delve to compile the main package in the current working directory and begin to debug it. If there is no main package in the current working directory, you will get the following error message:
$ ~/go/bin/dlv debug go: cannot find main module; see 'go help modules' exit status 1
So, let us go to the ./ch07/debug directory and debug a real program that is stored in main.go. The Go code of main.go is as follows:
package main import ( "fmt" "os" ) ...