module

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package module provides helper functions to handle GX modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the GX module.

func Current

func Current() (*Module, error)

Current returns the module of the current working directory.

func New

func New(osPath string) (*Module, error)

New returns a new module given a directory. If no go.mod can be find, returns a nil module with a nil error.

func (*Module) Belongs

func (mod *Module) Belongs(importPath string) bool

Belongs returns true if a package, given its path, belongs to the module.

func (*Module) FS

func (mod *Module) FS() fs.ReadDirFS

FS returns the filesystem for the current module.

func (*Module) ImportToOSPath

func (mod *Module) ImportToOSPath(importPath string) (string, error)

ImportToOSPath converts an import path to a path on the operating system.

func (*Module) Name

func (mod *Module) Name() string

Name of the module as specified in the go.mod file.

func (*Module) OSPath

func (mod *Module) OSPath(path string) string

OSPath converts a path within the module to a path on the operating system.

func (*Module) Split

func (mod *Module) Split(importPath string) (packagePath, packageName string, err error)

Split a full package into a module path, a package path, and a package name.

Jump to

Keyboard shortcuts

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