bundle

command
v0.0.0-...-2824937 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2020 License: MIT, BSD-3-Clause Imports: 15 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL