Documentation ¶
Overview ¶
Package imports is a small package for dealing with import paths. imports picks unique names if needed and is able to determine the assumed name of the of an import path. It also orders the imports properly for `gofmt`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssumedName ¶
AssumedName returns the assumed package name of an import path. It does this using only string parsing of the import path. It picks the last element of the path that does not look like a major version, and then picks the valid identifier off the start of that element. It is used to determine if a local rename should be added to an import for clarity. This function could be moved to a standard package and exported if we want for use in other tools.
Types ¶
type Import ¶
type Import struct { // Package identifier name Name string `json:"name,omitempty"` // Path to the import Path string `json:"path,omitempty"` }
Import struct returned by list