davecgh / go-spew

Implements a deep pretty printer for Go data structures to aid in debugging
ISC License
5.98k stars 361 forks source link

feature request: add indexes for array elements #88

Open JFixby opened 5 years ago

JFixby commented 5 years ago

Example array: [5]int{14234, 42, -1, 1000, 5})

Current output:

([5]int) (len=5 cap=5) {
 (int) 14234,
 (int) 42,
 (int) -1,
 (int) 1000,
 (int) 5
}

Suggested output with index aligments:

<[1000]int> len=1000 cap=2000 {
        (0) <int> 14234
        (1) <int> 42
        (2) <int> -1
        ...           
      (998) <int> 1000
      (999) <int> 5
}

or

<[1000]int> len=1000 cap=2000 {
  (0) <int> 14234
  (1) <int> 42
  (2) <int> -1
        ...           
(998) <int> 1000
(999) <int> 5
}

Or smth like this. Anything that helps to see element index.