aboutsummaryrefslogtreecommitdiff
path: root/internal/api/testdata/pkg.go
blob: 6d62abad5b91b6f4b0f20059be267e52d16a7547 (plain)
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
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package pkg has every form of declaration.
//
// # Heading
//
// Search [Google] for details.
//
// # Links
//
//   - pkgsite repo, https://go.googlesource.com/pkgsite
//   - Play with Go, https://play-with-go.dev
//
// [Google]: https://google.com
package pkg

// C is a shorthand for 1.
const C = 1

// No exported name; should not appear.
const (
	a = 1
	b = 2
	c = 3
)

// V is a variable.
var V = 2

// F is a function.
func F() {}

// Several constants.
const (
	X = 1
	Y = 2
)

// CT is a typed constant.
// They appear after their type.
const CT T = 3

// TF is a constructor for T.
func TF() T { return T(0) }

// M is a method of T.
// BUG(xxx): this verifies that notes are rendered.
func (T) M() {}

// T is a type.
type T int

// S1 is a struct.
type S1 struct {
	F int // field
}

// S2 is another struct.
type S2 struct {
	S1
	G int
}

// I1 is an interface.
type I1 interface {
	M1()
}

type I2 interface {
	I1
	M2()
}

type (
	A int
	B bool
)

// Add adds 1 to x.
func Add(x int) int {
	return x + 1
}