Documentation ¶
Overview ¶
Package gosimports implements a Go pretty-printer that updates your Go import lines, adding missing ones, removing unreferenced ones, and removing redundant blank lines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debug = false
Debug controls verbose logging.
var LocalPrefix string
LocalPrefix is a comma-separated string of import path prefixes, which, if set, instructs Process to sort the import paths with the given prefixes into another group after 3rd-party packages.
Functions ¶
func Process ¶
Process formats and adjusts imports for the provided file. If opt is nil, the defaults are used. If src is nil, the source is read from the filesystem.
Note that filename's directory influences which imports can be chosen, so it is important that filename be accurate. To process data “as if” it were in filename, pass the data as a non-nil src.
Types ¶
type Options ¶
type Options struct { 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 specifies options for processing files.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
gosimports
Command gosimports updates your Go import lines, adding missing ones, removing unreferenced ones, and removing redundant blank lines.
|
Command gosimports updates your Go import lines, adding missing ones, removing unreferenced ones, and removing redundant blank lines. |
internal
|
|
event/core
Package core provides support for event based telemetry.
|
Package core provides support for event based telemetry. |
event/export/eventtest
Package eventtest supports logging events to a test.
|
Package eventtest supports logging events to a test. |
event/export/metric
Package metric aggregates events into metrics that can be exported.
|
Package metric aggregates events into metrics that can be exported. |
event/export/ocagent
Package ocagent adds the ability to export all telemetry to an ocagent.
|
Package ocagent adds the ability to export all telemetry to an ocagent. |
fastwalk
Package fastwalk provides a faster version of filepath.Walk for file system scanning tools.
|
Package fastwalk provides a faster version of filepath.Walk for file system scanning tools. |
gocommand
Package gocommand is a helper for calling the go command.
|
Package gocommand is a helper for calling the go command. |
gopathwalk
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
|
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT. |
imports
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
|
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary. |
proxydir
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>".
|
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>". |
testenv
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
|
Package testenv contains helper functions for skipping tests based on which tools are present in the environment. |