module

package
v0.0.0-...-947c368 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2022 License: MIT Imports: 11 Imported by: 0

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

func ImportPathFrom(path, moduleName, root string) string

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

func IsMainPkg(path string) bool

IsMainPkg returns true if the filepath given by path is a main Go package, otherwise false.

func IsRootPath

func IsRootPath(path string) bool

IsRootPath returns true if path is a module root filepath, otherwise false.

func NameFrom

func NameFrom(path string) (string, error)

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

func RootPathFromWorkingDir() (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL