Skip to content

Commit cdf60af

Browse files
go dbg cmdline
1 parent d6cf526 commit cdf60af

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

go.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,53 @@ Open. From terminal:
5252
$ goland
5353
```
5454

55-
### Project Level Preferences
56-
57-
Create a new project (new folder or existing)
55+
Create a new project (new folder or existing):
5856

5957
Preferences (or wrench bottom right). Set GOPATH for project and uncheck from env. This means you can launch from anywhere
6058

6159
![pathprefs](res/goland-gopath.png)
6260

61+
## Debugging with Delve
62+
63+
[Delve from the cmdline](https://lincolnloop.com/blog/debugging-go-code/)
64+
65+
```bash
66+
[dev] ~/Study/go/src/helloworld$ dlv debug main.go -- arg1
67+
Type 'help' for list of commands.
68+
(dlv) break main.go:9
69+
Breakpoint 1 set at 0x10ae9e4 for main.main() ./main.go:9
70+
(dlv) break main.go:10
71+
Breakpoint 2 set at 0x10aeaa0 for main.main() ./main.go:10
72+
(dlv) continue
73+
> main.main() ./main.go:9 (hits goroutine(1):1 total:1) (PC: 0x10ae9e4)
74+
4: "fmt"
75+
5: )
76+
6:
77+
7: func main() {
78+
8: msg := "Hellow World!"
79+
=> 9: fmt.Println(msg)
80+
10: fmt.Println("")
81+
11: }
82+
(dlv) print msg
83+
"Hellow World!"
84+
(dlv) continue
85+
Hellow World!
86+
> main.main() ./main.go:10 (hits goroutine(1):1 total:1) (PC: 0x10aeaa0)
87+
5: )
88+
6:
89+
7: func main() {
90+
8: msg := "Hellow World!"
91+
9: fmt.Println(msg)
92+
=> 10: fmt.Println("")
93+
11: }
94+
(dlv) continue
95+
96+
Process 6739 has exited with status 0
97+
(dlv) exit
98+
Process 6739 has exited with status 0
99+
[dev] ~/Study/go/src/helloworld$
100+
```
101+
63102
### Debugging Stdin Issues
64103
65104
Version 2018.2 (use this):

0 commit comments

Comments
 (0)