Documentation ¶
Overview ¶
Copyright 2022 tobbstr. All rights reserved. Use of this source code is governed by a MIT- license that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImportPathFrom ¶
ImportPathFrom returns the import path for path given the moduleName and module root path (root).
Ex.
path = /Users/john/repos/github.com/doe/example/a/b/c root = /Users/john/repos/github.com/doe/example moduleName = github.com/lolzor/example Returns = github.com/lolzor/example/a/b/c
func IsMainPkg ¶
IsMainPkg returns true if the filepath given by path is a main Go package, otherwise false.
func IsRootPath ¶
IsRootPath returns true if path is a module root filepath, otherwise false.
func NameFrom ¶
NameFrom returns the module name, otherwise it returns an error. The argument path has to be a valid module root path i.e. a path that contains a go.mod file.
func RootPathFromWorkingDir ¶
RootPathFromWorkingDir walks back up the file system until it finds a module root folder and returns its filepath, otherwise it returns an error.
Types ¶
This section is empty.