blob: 6f5c310010b0f7648cffb313c849a844975d3a25 [file]
This test executes definition requests over doc links.
-- go.mod --
module mod.com
go 1.19
-- path/path.go --
package path
func Join() //@loc(Join, "Join")
-- a.go --
package p
import "strconv" //@loc(strconv, `"strconv"`)
import pathpkg "mod.com/path"
import _ "unsafe"
const NumberBase = 10 //@loc(NumberBase, "NumberBase")
// [Conv] converts s to an int. //@def("Conv", Conv)
func Conv(s string) int { //@loc(Conv, "Conv")
// [strconv.ParseInt] parses s and returns the integer corresponding to it. //@def("strconv", strconv)
// [NumberBase] is the base to use for number parsing. //@def("NumberBase", NumberBase)
i, _ := strconv.ParseInt(s, NumberBase, 64)
return int(i)
}
// The declared and imported names of the package both work:
// [path.Join] //@ def("Join", Join)
// [pathpkg.Join] //@ def("Join", Join)
func _() {
pathpkg.Join()
}
// Built-in and unsafe symbols work too.
// [unsafe.Pointer] //@def("Pointer", UNSAFE)
// [unsafe.Slice] //@def("Slice", UNSAFE)
// [int] //@def("int", BUILTIN)
// [error] //@def("error", BUILTIN)
// [error.Error] //@def("Error", BUILTIN)
func _()