Go Modules Absolutizer is a Go library, used to search and replace relative paths in go.mod files to absolute paths. The library is used by both the JFrog Idea Plugin and the JFrog VS Code Extension.
The program expects two flags:
Flag | Description |
---|---|
goModPath |
Path to a go.mod. |
wd |
Path to the working directory, which will be concatenated to the relative path in the go.mod file. |
You may use it in multiple ways:
go run . -goModPath=/path/to/go.mod -wd=/path/to/wd
go build
./gomod-absolutizer -goModPath=/path/to/go.mod -wd=/path/to/wd
import (
absolutizer "github.com/jfrog/gomod-absolutizer"
)
func main() {
args := &absolutizer.AbsolutizeArgs{
GoModPath: "/path/to/go.mod",
WorkingDir: "/path/to/wd",
}
err := absolutizer.Absolutize(args)
// Handle error
}
Given the following go.mod before running this program:
replace github.com/jfrog/jfrog-client-go v1.2.3 => github.com/jfrog/jfrog-client-go v1.2.4
replace github.com/jfrog/jfrog-cli-core => ../jfrog-cli-core
Running the following command:
go run . -goModPath=/Users/frogger/code/jfrog-cli/go.mod -wd=/Users/frogger/code/jfrog-cli
Will modify the original go.mod to:
replace github.com/jfrog/jfrog-client-go v1.2.3 => github.com/jfrog/jfrog-client-go v1.2.4
replace github.com/jfrog/jfrog-cli-core => /Users/frogger/code/jfrog-cli-core
To run the tests, execute the following command from within the root directory of the project:
go test -v ./...
The release notes are available here.
We welcome community contribution through pull requests.