Documentation ¶
Overview ¶
Package gomod includes methods and structures to resolve relative path based on where the nearest go.mod is.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectCallerFunctionName ¶
func DirectCallerFunctionName() string
DirectCallerFunctionName determines the function name of the caller and returns it.
func DirectCallerFunctionNameWithPackageName ¶
func DirectCallerFunctionNameWithPackageName() string
DirectCallerFunctionNameWithPackageName returns the caller pkg.function name.
func DirectCallerPackageE ¶
DirectCallerPackageE is same as DirectCallerPackagePanic but returns an error instead of panicing once an error occurs.
func DirectCallerPackagePanic ¶
func DirectCallerPackagePanic() string
DirectCallerPackagePanic returns the package name the working directory currently points to. The function panics if working directory is not inside a workspace.
func DirectCallerPackagePath ¶
func DirectCallerPackagePath() string
DirectCallerPackagePath determines the path to the directory the caller function resides in and returns it.
Types ¶
type Workspace ¶
Workspace holds the path to the go.mod file and the module namespace.
func GetWorkspace ¶
GetWorkspace returns the workspace fromPath is part of.
func GetWorkspaceFromWD ¶
GetWorkspaceFromWD returns the workspace from the working directory.
func (*Workspace) ExpandPackage ¶
ExpandPackage expands the partial package path and expands it with the path located in the go.mod file.
func (*Workspace) ExpandPath ¶
ExpandPath expands paths with leading //-prefix with the folder the nearest go.mod resides in.
func (*Workspace) GomodPathDirectory ¶
GomodPathDirectory returns the directory where the nearest go.mod resides..
func (*Workspace) IsExpandable ¶
IsExpandable checks whether expanding the given path with the given Workspace would result in an error.