gotools/gopls/internal/test/marker/testdata/definition/comment.txt

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"

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()
}