dependencies

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadGoModFile

func ReadGoModFile(rootPath string) string

ReadGoModFile reads the go.mod file at the project root to find the module name. Returns the module name or an empty string if not found or error occurred.

Types

type GoResolver

type GoResolver struct{}

GoResolver implements Resolver for Go files.

func (*GoResolver) Resolve

func (r *GoResolver) Resolve(fileContent []byte, filePath string, projectRoot string, projectModuleName string) ([]string, error)

Resolve finds Go dependencies.

type JSResolver

type JSResolver struct{}

JSResolver implements Resolver for TypeScript/JavaScript files.

func (*JSResolver) Resolve

func (r *JSResolver) Resolve(fileContent []byte, filePath string, projectRoot string, projectModuleName string) ([]string, error)

Resolve finds TS/JS dependencies.

type Resolver

type Resolver interface {
	// Resolve finds direct, project-local dependencies for the given file path.
	// fileContent is the content of the file to parse.
	// filePath is the path relative to the project root.
	// projectRoot is the absolute path to the project root.
	// projectModuleName is the go module name (if applicable, empty otherwise).
	// Returns a slice of dependency paths, also relative to the project root.
	Resolve(fileContent []byte, filePath string, projectRoot string, projectModuleName string) ([]string, error)
}

Resolver defines the interface for finding direct dependencies of a file.

func GetResolver

func GetResolver(filePath string) Resolver

GetResolver returns the appropriate resolver based on the file extension.

Jump to

Keyboard shortcuts

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