Type name format in dwarf

76 views
Skip to first unread message

Dmitry Neverov

unread,
Mar 4, 2021, 12:52:43 PM3/4/21
to golang-nuts
Please help me understand the type name format generated in debug info.

Mostly they seem to be in the <import-path>.<type-name> format, but sometimes _test is appended to import path. Also it seems like some parts of import path are url-encoded: type T defined in package pkg of the go module github.com/my/pkg.v2 gets name github.com/my/pkg%2ev2.T.

I wonder what are the rules for type names.

Thanks!

Ian Lance Taylor

unread,
Mar 4, 2021, 3:10:59 PM3/4/21
to Dmitry Neverov, golang-nuts
The _test appears in cases where the package name also ends in _test.

The %2e appears when the final element of an import path contains a
dot, to avoid getting it confused with the dot that separates the
package path from the name.

See https://go.googlesource.com/go/+/refs/heads/master/src/cmd/internal/objabi/path.go#9

Ian
Reply all
Reply to author
Forward
0 new messages