File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1556 TILs and counting..._
13
+ _ 1557 TILs and counting..._
14
14
15
15
See some of the other learning resources I work on:
16
16
- [ Ruby Operator Lookup] ( https://www.visualmode.dev/ruby-operators )
@@ -411,6 +411,7 @@ See some of the other learning resources I work on:
411
411
- [ Build For A Specific OS And Architecture] ( go/build-for-a-specific-os-and-architecture.md )
412
412
- [ Check If Cobra Flag Was Set] ( go/check-if-cobra-flag-was-set.md )
413
413
- [ Combine Two Slices] ( go/combine-two-slices.md )
414
+ - [ Configure Max String Print Length For Delve] ( go/configure-max-string-print-length-for-delve.md )
414
415
- [ Connect To A SQLite Database] ( go/connect-to-a-sqlite-database.md )
415
416
- [ Create A Slice From An Array] ( go/create-a-slice-from-an-array.md )
416
417
- [ Detect If Stdin Comes From A Redirect] ( go/detect-if-stdin-comes-from-a-redirect.md )
Original file line number Diff line number Diff line change
1
+ # Configure Max String Print Length For Delve
2
+
3
+ During a [ Delve] ( https://github.com/go-delve/delve ) debugging session, we can
4
+ print out the value of a given variable with the ` print ` command. Similarly, we
5
+ can see the values of all local variables with the ` locals ` command.
6
+
7
+ Whenever Delve is printing out strings and slices, it will truncate what it
8
+ displays to 64 characters (or items) by default.
9
+
10
+ ``` go
11
+ (dlv) print diagnostics.Solutions [0 ]
12
+ " 295743861\n 431865972\n 876192543\n 387459216\n 612387495\n 549216738\n 7635...+25 more"
13
+ ```
14
+
15
+ This can be overridden by [ changing the ` config ` of
16
+ ` max-string-len ` ] ( https://github.com/derekparker/delve/blob/237c5026f40e38d2dd6f62a7362de7b25b00c1c7/Documentation/cli/expr.md?plain=1#L59 )
17
+ to something longer. In my case here, all I need are about 90 characters to
18
+ display my full string, so run ` config max-string-len 90 ` from the ` dlv `
19
+ session.
20
+
21
+ ``` go
22
+ (dlv) config max-string -len 90
23
+ (dlv) print diagnostics.Solutions [0 ]
24
+ " 295743861\n 431865972\n 876192543\n 387459216\n 612387495\n 549216738\n 763524189\n 928671354\n 154938627"
25
+ ```
26
+
27
+ Now I can see the entire string instead of the truncated version.
28
+
29
+ [ source] ( https://stackoverflow.com/a/52416264/535590 )
You can’t perform that action at this time.
0 commit comments