Documentation ¶
Overview ¶
Package docs exercises the documentation features of golang 1.19 and above at the package documentation level.
This is a heading ¶
This heading has a paragraph with a reference to the standard library math/rand as well as a function in the file Func, a type Type, a type's function Type.Func, a non-standard library package golang.org/x/crypto/bcrypt.Cost, an external link Outside Link and a [broken link].
It also has a numbered list:
- First
- Second
- Third
Plus one with blank lines:
First
Second
Third
Non-numbered lists
- First another line
- Second
- Third
Plus blank lines:
First
another paragraph
Second
Third
And a golang code block:
func GolangCode(t int) int { return t + 1 }
And a random code block:
something preformatted in a random way
There's also another file with a struct called AnotherStruct that has additional methods and fields.
We also have constants like Constant and Const1 plus variables like Var and and VarB.
Index ¶
Constants ¶
const ( Const1 = 1 Const2 = 2 Const3 = 3 )
This is a constant block
const Constant = 3
Constant is a constant.
Variables ¶
var ( VarA = 'a' VarB = 'b' VarC = 'c' )
This is a var block
var Var = 2
Var is a var.
Functions ¶
Types ¶
type AnotherStruct ¶
type AnotherStruct struct {
Field string
}
AnotherStruct has methods like *AnotherStruct.GetField and also has an initializer called NewAnotherStruct.
func NewAnotherStruct ¶
func NewAnotherStruct() *AnotherStruct
NewAnotherStruct() makes *AnotherStruct.
func (*AnotherStruct) GetField ¶
func (s *AnotherStruct) GetField() string
GetField gets [*AnotherStruct.Field].