github.com/neilgarb/delve@v1.9.2-nobreaks/_fixtures/testvariables.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"runtime"
     6  )
     7  
     8  type FooBar struct {
     9  	Baz int
    10  	Bur string
    11  }
    12  
    13  // same member names, different order / types
    14  type FooBar2 struct {
    15  	Bur int
    16  	Baz string
    17  }
    18  
    19  type Nest struct {
    20  	Level int
    21  	Nest  *Nest
    22  }
    23  
    24  func barfoo() {
    25  	a1 := "bur"
    26  	runtime.Breakpoint()
    27  	fmt.Println(a1)
    28  }
    29  
    30  func foobar(baz string, bar FooBar) {
    31  	var (
    32  		a1   = "foofoofoofoofoofoo"
    33  		a2   = 6
    34  		a3   = 7.23
    35  		a4   = [2]int{1, 2}
    36  		a5   = []int{1, 2, 3, 4, 5}
    37  		a6   = FooBar{Baz: 8, Bur: "word"}
    38  		a7   = &FooBar{Baz: 5, Bur: "strum"}
    39  		a8   = FooBar2{Bur: 10, Baz: "feh"}
    40  		a9   = (*FooBar)(nil)
    41  		a10  = a1[2:5]
    42  		a11  = [3]FooBar{{1, "a"}, {2, "b"}, {3, "c"}}
    43  		a12  = []FooBar{{4, "d"}, {5, "e"}}
    44  		a13  = []*FooBar{{6, "f"}, {7, "g"}, {8, "h"}}
    45  		b1   = true
    46  		b2   = false
    47  		neg  = -1
    48  		i8   = int8(1)
    49  		u8   = uint8(255)
    50  		u16  = uint16(65535)
    51  		u32  = uint32(4294967295)
    52  		u64  = uint64(18446744073709551615)
    53  		up   = uintptr(5)
    54  		f32  = float32(1.2)
    55  		c64  = complex(float32(1), float32(2))
    56  		c128 = complex(float64(2), float64(3))
    57  		i32  = [2]int32{1, 2}
    58  		f    = barfoo
    59  		ms   = Nest{0, &Nest{1, &Nest{2, &Nest{3, &Nest{4, nil}}}}} // Test recursion capping on structs
    60  		ni   = []interface{}([]interface{}{[]interface{}{123}})     // Test recursion capping on interfaces
    61  		ba   = make([]int, 200, 200)                                // Test array size capping
    62  		mp   = map[int]interface{}{1: 42, 2: 43}
    63  	)
    64  
    65  	runtime.Breakpoint()
    66  	barfoo()
    67  	fmt.Println(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b1, b2, baz, neg, i8, u8, u16, u32, u64, up, f32, c64, c128, i32, bar, f, ms, ni, ba, p1, mp)
    68  }
    69  
    70  var p1 = 10
    71  
    72  func main() {
    73  	foobar("bazburzum", FooBar{Baz: 10, Bur: "lorem"})
    74  }