gomodreplacer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoModFile = "go.mod"
)

Variables

This section is empty.

Functions

func AddReplacesForGoMod

func AddReplacesForGoMod(modFilePath, pkgModDir string, descs []ModuleCacheDesc) error

AddReplacesForGoMod add necessary replaces for project go mod file

func CopyDeps

func CopyDeps(pkgModDir string, descs []ModuleCacheDesc) error

CopyDeps copy dep module dirs to pkgModDir

func CopyDir

func CopyDir(src, dst string) error

CopyDir copy files from src dir to dst dir

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func ParseModFile

func ParseModFile(filename string) (fi *modfile.File, err error)

ParseModFile parse mod file and return file info

Types

type ModuleCacheDesc

type ModuleCacheDesc struct {
	Path     string // module path
	Version  string // module version
	Error    string // error loading module
	Info     string // absolute path to cached .info file
	GoMod    string // absolute path to cached .mod file
	Zip      string // absolute path to cached .zip file
	Dir      string // absolute path to cached source root directory
	Sum      string // checksum for path, version (as in go.sum)
	GoModSum string // checksum for go.mod (as in go.sum)
}

ModuleCacheDesc result of go mod download

func GenModuleDepDesc

func GenModuleDepDesc(projectPath string) (descs []ModuleCacheDesc, err error)

GenModuleDepDesc return all module dependences for project

func SelectModuleDescs

func SelectModuleDescs(descs []ModuleCacheDesc, pathPat *regexp.Regexp) []ModuleCacheDesc

SelectModuleDescs select matched modules

Jump to

Keyboard shortcuts

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