Sizeof prints the size of named Go types in a package.
sizeof [-c] [-f] [-p path] [-v] [name...]
Sizeof prints the size of Go types in a given package.
If the -p option is given, sizeof compiles the package named by the import path. Otherwise it compiles the package in the current directory.
If type names are given on the command line, sizeof prints the size of those types. Otherwise it prints the size of all named types in the package.
If the -f option is given, sizeof also prints field locations for each type.
If the -c option is given, sizeof ignores types and instead prints the values of integer constants.
If the -v option is given, sizeof prints information about its internal operations.
Sizeof builds the package using “go build,” so it uses the same operating system and architecture as “go build” does. To find the size on a different system, set GOOS and/or GOARCH.
To find the size of regexp's Regexp:
cd $GOROOT/src/regexp sizeof Regexp
To find the size of regexp/syntax's Regexp, without going into that directory:
sizeof -p regexp/syntax Regexp