gomod

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gomod locates the Go module root and computes import paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Root   string // directory containing go.mod
	Module string // module path declared in go.mod
}

Info holds the result of locating a Go module.

func Find

func Find(dir string) (Info, error)

Find walks up from dir searching for a go.mod file. It returns the module root and path for the first go.mod found.

func (Info) ImportPath

func (i Info) ImportPath(dir string) (string, error)

ImportPath returns the Go import path for dir within this module.

Jump to

Keyboard shortcuts

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