modpath

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package modpath locates the nearest go.mod above a directory and extracts its module declaration. Shared by the generator (to build import paths in seed registries) and the CLI (to scaffold the user's cmd/peng/main.go with a correct seeds import).

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("go.mod not found")

Functions

func Find

func Find(startDir string) (root, modulePath string, err error)

Find walks up from startDir looking for go.mod. Returns the directory containing it and the module path declared inside.

func ReadPath

func ReadPath(goModPath string) (string, error)

ReadPath extracts the module declaration from a go.mod file. It returns the first non-blank, non-comment line's module value and requires that line to begin with `module `.

Types

This section is empty.

Jump to

Keyboard shortcuts

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