File: testvariables2.go

package info (click to toggle)
delve 1.24.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,092 kB
  • sloc: ansic: 111,943; sh: 169; asm: 141; makefile: 43; python: 23
file content (437 lines) | stat: -rw-r--r-- 10,114 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
package main

import (
	"fmt"
	"go/constant"
	"math"
	"os"
	"reflect"
	"runtime"
	"time"
	"unsafe"
)

type (
	Byte    byte
	String  string
	Uint32  uint32
	Int64   int64
	Bool    bool
	Float64 float64
)

const (
	ByteConst   Byte    = 255
	StringConst String  = "hi"
	UintConst   Uint32  = 42
	IntConst    Int64   = 9001
	BoolConst   Bool    = true
	FloatConst  Float64 = 3.14
)

type astruct struct {
	A int
	B int
}

type largestruct struct {
	name string
	v    [256]byte
}

type astructName1 astruct
type astructName2 astruct

type bstruct struct {
	a astruct
}

type cstruct struct {
	pb *bstruct
	sa []*astruct
}

type a struct {
	aas []a
}

type A struct {
	val int
}

type C struct {
	s string
}

type B struct {
	A
	*C
	a   A
	ptr *A
}

type D struct {
	u1, u2, u3, u4, u5, u6 uint32
}

func afunc(x int) int {
	return x + 2
}

func afunc1(x int) {
}

func afunc2() int {
	return 0
}

type functype func(int) int

func (a *astruct) Error() string {
	return "not an error"
}

func (a astruct) NonPointerReceiverMethod() {
	return
}

func (b *bstruct) Error() string {
	return "not an error"
}

type dstruct struct {
	x interface{}
}

type maptype map[string]interface{}

type benchstruct struct {
	a [64]byte
	b [64]byte
}

type Item struct {
	Name   string
	Route  string
	Active int
}

type Menu []Item

type truncatedMap struct {
	v []map[string]astruct
}

type Cache struct {
	blocks [2000]Block
}

type Block struct {
	cache *Cache
}

type List struct {
	N    int
	Next *List
}

type T struct {
	F string
}

type W1 struct {
	T
}

func (*W1) M() {}

type I interface{ M() }

type W2 struct {
	W1
	T
}

type W3 struct {
	I
	T
}

type W4 struct {
	I
}

type W5 struct {
	*W5
}

type ThreeInts struct {
	a, b, c int
}

var _ I = (*W2)(nil)

type pptr *pptr

func main() {
	i1 := 1
	i2 := 2
	f1 := 3.0
	i3 := 3
	p1 := &i1
	pp1 := &p1
	s1 := []string{"one", "two", "three", "four", "five"}
	s3 := make([]int, 0, 6)
	a0 := [0]int{}
	a1 := [5]string{"one", "two", "three", "four", "five"}
	c1 := cstruct{&bstruct{astruct{1, 2}}, []*astruct{&astruct{1, 2}, &astruct{2, 3}, &astruct{4, 5}}}
	s2 := []astruct{{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, 14}, {15, 16}}
	p2 := &(c1.sa[2].B)
	as1 := astruct{1, 1}
	var p3 *int
	str1 := "01234567890"
	var fn1 functype = afunc
	var fn2 functype = nil
	var nilslice []int = nil
	var nilptr *int = nil
	ch1 := make(chan int, 11)
	ch1 <- 1
	ch1 <- 4
	ch1 <- 3
	ch1 <- 2
	var chnil chan int = nil
	m1 := map[string]astruct{
		"Malone":          astruct{2, 3},
		"Adenauer":        astruct{},
		"squadrons":       astruct{},
		"quintuplets":     astruct{},
		"parasite":        astruct{},
		"wristwatches":    astruct{},
		"flashgun":        astruct{},
		"equivocally":     astruct{},
		"sweetbrier":      astruct{},
		"idealism":        astruct{},
		"tangos":          astruct{},
		"alterable":       astruct{},
		"quaffing":        astruct{},
		"arsenic":         astruct{},
		"coincidentally":  astruct{},
		"hindrances":      astruct{},
		"zoning":          astruct{},
		"egging":          astruct{},
		"inserts":         astruct{},
		"adaptive":        astruct{},
		"orientations":    astruct{},
		"periling":        astruct{},
		"lip":             astruct{},
		"chant":           astruct{},
		"availing":        astruct{},
		"fern":            astruct{},
		"flummoxes":       astruct{},
		"meanders":        astruct{},
		"ravenously":      astruct{},
		"reminisce":       astruct{},
		"snorkel":         astruct{},
		"gutters":         astruct{},
		"jibbed":          astruct{},
		"tiara":           astruct{},
		"takers":          astruct{},
		"animates":        astruct{},
		"Zubenelgenubi":   astruct{},
		"bantering":       astruct{},
		"tumblers":        astruct{},
		"horticulturists": astruct{},
		"thallium":        astruct{},
		"capital":         astruct{},
		"paramese":        astruct{},
		"vaccinationist":  astruct{},
		"shadrach":        astruct{},
		"unsincereness":   astruct{},
		"undazzled":       astruct{},
		"heautomorphism":  astruct{},
		"undermeasure":    astruct{},
		"intentionally":   astruct{},
		"glycine":         astruct{},
		"basiliscine":     astruct{},
		"preinvolvement":  astruct{},
		"adversaria":      astruct{},
		"capocchia":       astruct{},
		"annunciable":     astruct{},
		"unguidableness":  astruct{},
		"prankster":       astruct{},
		"jagless":         astruct{},
		"hormonal":        astruct{},
		"crenature":       astruct{},
		"unfluttering":    astruct{},
		"councilmanic":    astruct{},
		"Micraster":       astruct{},
		"raphidiferous":   astruct{},
		"groomer":         astruct{},
	}
	var mnil map[string]astruct = nil
	m2 := map[int]*astruct{1: &astruct{10, 11}}
	m3 := map[astruct]int{{1, 1}: 42, {2, 2}: 43}
	m4 := map[astruct]astruct{{1, 1}: {11, 11}, {2, 2}: {22, 22}}
	mlarge := map[largestruct]largestruct{largestruct{name: "one"}: largestruct{name: "oneval"}}
	upnil := unsafe.Pointer(nil)
	up1 := unsafe.Pointer(&i1)
	i4 := 800
	i5 := -3
	i6 := -500
	var err1 error = c1.sa[0]
	var err2 error = c1.pb
	var errnil error = nil
	var psa *astruct = nil
	var errtypednil error = psa
	var iface1 interface{} = c1.sa[0]
	var iface2 interface{} = "test"
	var iface3 interface{} = map[string]constant.Value{}
	var iface4 interface{} = []constant.Value{constant.MakeInt64(4)}
	var ifacenil interface{} = nil
	arr1 := [4]int{0, 1, 2, 3}
	parr := &arr1
	cpx1 := complex(1, 2)
	const1 := constant.MakeInt64(3)
	recursive1 := dstruct{}
	recursive1.x = &recursive1
	var iface5 interface{} = &recursive1
	var iface2fn1 interface{} = afunc1
	var iface2fn2 interface{} = afunc2
	var mapinf maptype = map[string]interface{}{}
	mapinf["inf"] = mapinf
	var bencharr [64]benchstruct
	var benchparr [64]*benchstruct
	var issue1578 Block
	mainMenu := Menu{
		{Name: "home", Route: "/", Active: 1},
		{Name: "About", Route: "/about", Active: 1},
		{Name: "Login", Route: "/login", Active: 1},
	}
	var aas = []a{{nil}}
	aas[0].aas = aas
	b := B{A: A{-314}, C: &C{"hello"}, a: A{42}, ptr: &A{1337}}
	b2 := B{A: A{42}, a: A{47}}
	var sd D

	ifacearr := []error{&astruct{}, nil}
	efacearr := []interface{}{&astruct{}, "test", nil}

	var mapanonstruct1 map[string]struct{}
	var anonstruct1 struct{ val constant.Value }
	var anonstruct2 struct{ i, j int }
	var anoniface1 interface {
		SomeFunction(struct{ val constant.Value })
		OtherFunction(i, j int)
	}
	var anonfunc func(a struct{ i int }, b interface{}, c struct{ val constant.Value })

	for i := range benchparr {
		benchparr[i] = &benchstruct{}
	}

	ni8 := int8(-5)
	ni16 := int16(-5)
	ni32 := int32(-5)
	ni64 := int64(-5)

	pinf := math.Inf(+1)
	ninf := math.Inf(-1)
	nan := math.NaN()

	var iface6 interface{}
	var ptrinf *interface{}
	iface6 = &ptrinf
	ptrinf = &iface6

	sliceinf := make([]interface{}, 1)
	sliceinf[0] = sliceinf

	zsvar := struct{}{}
	zsslice := make([]struct{}, 3)
	zsvmap := map[string]struct{}{"testkey": struct{}{}}
	var tm truncatedMap
	tm.v = []map[string]astruct{m1}
	var rettm = func() truncatedMap { return tm }

	emptyslice := []string{}
	emptymap := make(map[string]string)

	byteslice := []byte{116, 195, 168, 115, 116}
	bytestypeslice := []Byte{116, 195, 168, 115, 116}
	runeslice := []rune{116, 232, 115, 116}

	bytearray := [5]byte{116, 195, 168, 115, 116}
	bytetypearray := [5]Byte{116, 195, 168, 115, 116}
	runearray := [4]rune{116, 232, 115, 116}

	longstr := "very long string 0123456789a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g012345678h90123456789i0123456789j0123456789"
	longbyteslice := []byte(longstr)
	m5 := map[C]int{{longstr}: 1}
	m6 := map[string]int{longstr: 123}
	m7 := map[C]C{{longstr}: {"hello"}}
	cl := C{s: longstr}
	var nilstruct *astruct = nil

	val := A{val: 1} // val vs val.val
	var as2 astruct
	s4 := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}

	var iface2map interface{} = map[string]interface{}{
		"a": map[string]interface{}{
			"1": map[string]interface{}{
				"x": 1,
				"y": 2,
			},
		},
	}

	ll := &List{0, &List{1, &List{2, &List{3, &List{4, nil}}}}}
	unread := (*int)(unsafe.Pointer(uintptr(12345)))

	w2 := &W2{W1{T{"T-inside-W1"}}, T{"T-inside-W2"}}
	w3 := &W3{&W1{T{"T-inside-W1"}}, T{"T-inside-W3"}}
	w4 := &W4{&W1{T{"T-inside-W1"}}}
	w5 := &W5{nil}
	w5.W5 = w5

	os.Setenv("TZ", "UTC")
	tim1 := time.Unix(233431200, 0).UTC()
	loc, _ := time.LoadLocation("America/Mazatlan")
	tim2, _ := time.ParseInLocation("2006-01-02 15:04:05", "2022-06-07 02:03:04", loc)
	typedstringvar := String("blah")
	namedA1 := astructName1{12, 45}
	namedA2 := astructName2{13, 46}

	badslice := []int{1, 2, 3}
	h := (*reflect.SliceHeader)(unsafe.Pointer(&badslice))
	h.Data = 0
	tim3 := time.Date(300000, 1, 1, 0, 0, 0, 0, time.Local)

	int3chan := make(chan ThreeInts, 5)
	int3chan <- ThreeInts{a: 1}
	int3chan <- ThreeInts{a: 2}
	int3chan <- ThreeInts{a: 3}

	var ptrinf2 pptr
	ptrinf2 = &ptrinf2

	enum1 := ByteConst
	enum2 := StringConst
	enum3 := UintConst
	enum4 := IntConst
	enum5 := BoolConst
	enum6 := FloatConst
	var zeropoint4 float64 = 0.4

	var amb1 = 1
	runtime.Breakpoint()
	for amb1 := 0; amb1 < 10; amb1++ {
		fmt.Println(amb1)
	}

	longarr := [100]int{}
	longslice := make([]int, 100, 100)

	runtime.Breakpoint()
	fmt.Println(i1, i2, i3, p1, pp1, amb1, s1, s3, a0, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, m4, m5, upnil, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2, sd, anonstruct1, anonstruct2, anoniface1, anonfunc, mapanonstruct1, ifacearr, efacearr, ni8, ni16, ni32, ni64, pinf, ninf, nan, zsvmap, zsslice, zsvar, tm, rettm, errtypednil, emptyslice, emptymap, byteslice, bytestypeslice, runeslice, bytearray, bytetypearray, runearray, longstr, nilstruct, as2, as2.NonPointerReceiverMethod, s4, iface2map, issue1578, ll, unread, w2, w3, w4, w5, longarr, longslice, val, m6, m7, cl, tim1, tim2, typedstringvar, namedA1, namedA2, astructName1(namedA2), badslice, tim3, int3chan, longbyteslice, enum1, enum2, enum3, enum4, enum5, enum6, zeropoint4, mlarge)
}