Documentation ¶
Overview ¶
The bundle command concatenates the source files of a package, renaming package-level names by adding a prefix and renaming identifiers as needed to preserve referential integrity.
Example:
$ bundle golang.org/x/net/http2 net/http http2
The command above prints a single file containing the code of golang.org/x/net/http2, suitable for inclusion in package net/http, in which toplevel names have been prefixed with "http2".
Assumptions:
- no file in the package imports "C", that is, uses cgo.
- no file in the package has GOOS or GOARCH build tags or file names.
- comments associated with the package or import declarations, may be discarded, as may comments associated with no top-level declaration at all.
- neither the original package nor the destination package contains any identifiers starting with the designated prefix. (This allows us to avoid various conflict checks.)
- there are no renaming imports.
- test files are ignored.
- none of the renamed identifiers is significant to reflection-based logic.
Only package-level var, func, const, and type objects are renamed, and embedded fields of renamed types. No methods are renamed, so we needn't worry about preserving interface satisfaction.
Click to show internal directories.
Click to hide internal directories.