A Go library, used to search and replace relative paths in go.mod files to absolute paths.

gomod-absolutizer

gomod-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.

Table of Contents

Usage

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:

As script

go run . -goModPath=/path/to/go.mod -wd=/path/to/wd

As executable

go build
./gomod-absolutizer -goModPath=/path/to/go.mod -wd=/path/to/wd

As library

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
}

Example

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

Tests

To run the tests, execute the following command from within the root directory of the project:

go test -v ./...

Release Notes

The release notes are available here.

Code Contributions

We welcome community contribution through pull requests.

Similar Resources

Ddg - DuckDuckGo terminal search that plays nice with grep and fzf

Ddg - DuckDuckGo terminal search that plays nice with grep and fzf

ddg duckduckgo terminal search for use with fzf (or grep) What? With this tool y

Apr 1, 2022

:mag: Search the Go packages via command-line

GoSearch Search the Go packages for pkg.go.dev via command-line. It supports all search options in Search Help. Installation go get github.com/mingram

Jun 23, 2022

Twitter spaces search CLI client

Spacey A Twitter Spaces search client spacey career industry

May 12, 2022

Google search on your terminal

google-search Google search on your terminal installing

Jul 17, 2022

Simple command line Github Search

ghs is a simple command line tool which will open the corresponding url for your github search in your default web browser.

Nov 10, 2021

A command line interface for trying out Repustate's multilingual semantic search

A command line interface for trying out Repustate's multilingual semantic search

rcli A command line interface for trying out Repustate's multilingual semantic search. Install & Usage Download the binary for your OS. Make sure it's

Nov 26, 2020

Terminal interface to search the llvm C wrapper (llvm-c) API

Introduction This tool scrapes the LLVM-C API and (currently) prints all available API functions to stdout. It came to be from the lack of search opti

Dec 2, 2022

Nvim.sh - Neovim plugin search from the terminal

nvim.sh neovim plugin directory search from the terminal $ curl https://nvim.sh/

Dec 6, 2022
Comments
  • Update release automation

    Update release automation

    • [x] All tests passed. If this feature is not already covered by the tests, I added new tests.
    • [x] This pull request is on the dev branch.
    • [x] I used gofmt for formatting the code before submitting the pull request.

    • Update go to 1.17
    • Create release automation
    • Add static code analysis
  • Add Frogbot and update dependencies

    Add Frogbot and update dependencies

    • [x] All tests passed. If this feature is not already covered by the tests, I added new tests.
    • [x] This pull request is on the dev branch.
    • [x] I used gofmt for formatting the code before submitting the pull request.

    • Add Frogbot
    • Update dependencies
    • Update README
A CLI tool to find the absolute path of any folder in your local file system.

Table of Contents What is this? How to use this Examples of usage How to compile it What am I looking at It's a CLI tool that I made for finding the a

Jan 15, 2022
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

COMMIT CLI A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem. And yes, it is bui

Feb 9, 2022
tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

Feb 6, 2022
A wrapper around cd and xdg-open to use aliases to directory paths in terminal

CDD - Change directories Dynamically I am a lazy linux user and turns out that basic tab completion wasn't enough for me to navigate through my direct

Dec 15, 2022
This is a command line application to manage and fine-tune Time Machine exclude paths.

heptapod This is a command line application to manage and fine-tune Time Machine exclude paths. This repository is a WIP! The advertised functionality

Dec 28, 2022
mass-binding-target is a command line tool for generating binding target list by search plot files from disk.

mass-binding-target mass-binding-target is a command line tool for generating binding target list by search plot files from disk. Build Go 1.13 or new

Nov 5, 2021
Watcher - A simple command line app to watch files in a directory for changes and run a command when files change!

Watcher - Develop your programs easily Watcher watches all the files present in the directory it is run from of the directory that is specified while

Mar 27, 2022
lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files.

lls lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files. How? You allocate a buffer for

Dec 29, 2022
Related is a simple cli utility tool to create files or a group of files.

Related - Create files based on individual definitions or groups Related helps with common file-creation-based tasks. You can predefine single types a

Apr 16, 2022
simple cli app for search and watch anime

simple terminal app for search and watch movie or anime

Oct 30, 2021