Documentation ¶
Overview ¶
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Process ¶
Process implements github.com/system-pclub/GCatch/GFix/dispatcher/tools/imports.Process with explicit context in env.
func VendorlessPath ¶
VendorlessPath returns the devendorized version of the import path ipath. For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b".
Types ¶
type Options ¶
type Options struct { Env *ProcessEnv // The environment to use. Note: this contains the cached module and filesystem state. Fragment bool // Accept fragment of a source file (no package statement) AllErrors bool // Report all errors (not just the first 10 on different lines) Comments bool // Print comments (true if nil *Options provided) TabIndent bool // Use tabs for indent (true if nil *Options provided) TabWidth int // Tab width (8 if nil *Options provided) FormatOnly bool // Disable the insertion and deletion of imports }
Options is github.com/system-pclub/GCatch/GFix/dispatcher/tools/imports.Options with extra internal-only options.
type ProcessEnv ¶
type ProcessEnv struct { LocalPrefix string Debug bool // If non-empty, these will be used instead of the // process-wide values. GOPATH, GOROOT, GO111MODULE, GOPROXY, GOFLAGS, GOSUMDB string WorkingDir string // If true, use go/packages regardless of the environment. ForceGoPackages bool // contains filtered or unexported fields }
ProcessEnv contains environment variables and settings that affect the use of the go command, the go/build package, etc.
Click to show internal directories.
Click to hide internal directories.