File: a.go

package info (click to toggle)
golang-golang-x-tools 1%3A0.5.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 16,592 kB
  • sloc: javascript: 2,011; asm: 1,635; sh: 192; yacc: 155; makefile: 52; ansic: 8
file content (111 lines) | stat: -rw-r--r-- 2,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
// Package a is a package for testing go to definition.
package a //@mark(aPackage, "a "),hoverdef("a ", aPackage)

import (
	"fmt"
	"go/types"
	"sync"
)

var (
	// x is a variable.
	x string //@x,hoverdef("x", x)
)

// Constant block. When I hover on h, I should see this comment.
const (
	// When I hover on g, I should see this comment.
	g = 1 //@g,hoverdef("g", g)

	h = 2 //@h,hoverdef("h", h)
)

// z is a variable too.
var z string //@z,hoverdef("z", z)

type A string //@mark(AString, "A")

func AStuff() { //@AStuff
	x := 5
	Random2(x) //@godef("dom2", Random2)
	Random()   //@godef("()", Random)

	var err error         //@err
	fmt.Printf("%v", err) //@godef("err", err)

	var y string       //@string,hoverdef("string", string)
	_ = make([]int, 0) //@make,hoverdef("make", make)

	var mu sync.Mutex
	mu.Lock() //@Lock,hoverdef("Lock", Lock)

	var typ *types.Named //@mark(typesImport, "types"),hoverdef("types", typesImport)
	typ.Obj().Name()     //@Name,hoverdef("Name", Name)
}

type A struct {
}

func (_ A) Hi() {} //@mark(AHi, "Hi")

type S struct {
	Field int //@mark(AField, "Field")
	R         // embed a struct
	H         // embed an interface
}

type R struct {
	Field2 int //@mark(AField2, "Field2")
}

func (_ R) Hey() {} //@mark(AHey, "Hey")

type H interface { //@H
	Goodbye() //@mark(AGoodbye, "Goodbye")
}

type I interface { //@I
	B() //@mark(AB, "B")
	J
}

type J interface { //@J
	Hello() //@mark(AHello, "Hello")
}

func _() {
	// 1st type declaration block
	type (
		a struct { //@mark(declBlockA, "a"),hoverdef("a", declBlockA)
			x string
		}
	)

	// 2nd type declaration block
	type (
		// b has a comment
		b struct{} //@mark(declBlockB, "b"),hoverdef("b", declBlockB)
	)

	// 3rd type declaration block
	type (
		// c is a struct
		c struct { //@mark(declBlockC, "c"),hoverdef("c", declBlockC)
			f string
		}

		d string //@mark(declBlockD, "d"),hoverdef("d", declBlockD)
	)

	type (
		e struct { //@mark(declBlockE, "e"),hoverdef("e", declBlockE)
			f float64
		} // e has a comment
	)
}

var (
	hh H //@hoverdef("H", H)
	ii I //@hoverdef("I", I)
	jj J //@hoverdef("J", J)
)