gomodlocal

command module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 10 Imported by: 0

README

replace go.mod by guessed local path

Go Report Card MIT License

It replaces a module to point to your local path.

Usage

If your local directory structure is like here (you are building your-tool):

Replace

github.com/
  - YOU/
    - your-tool/
      - main.go  (uses github.com/YOU/your-lib1)
      - go.mod
      - go.sum
    - your-lib1/
      - ...
  - ANOTHER/
    - ano-libZ/
      - ...

You may have a go.mod like:

module github.com/YOU/your-tool

go 1.15

require (
	github.com/YOU/your-lib1 v0.0.0-20201126235959-0ab12c34def5
	github.com/ANOTHER/ano-libZ v0.1.0-20201126235959-1bc23d45efg6
)

⬇⬇⬇

gomodlocal replace your-lib1

⬇⬇⬇

module github.com/YOU/your-tool

go 1.15

require (
	github.com/YOU/your-lib1 v0.0.0-20201126235959-0ab12c34def5
	github.com/ANOTHER/ano-libZ v0.1.0-20201126235959-1bc23d45efg6
)

replace github.com/YOU/your-lib1 => ..\your-lib1

Now you can debug your-lib1 freely.

⬇⬇⬇And more...⬇⬇⬇

gomodlocal replace ano-libZ

⬇⬇⬇

module github.com/YOU/your-tool

go 1.15

require (
	github.com/YOU/your-lib1 v0.0.0-20201126235959-0ab12c34def5
	github.com/ANOTHER/ano-libZ v0.1.0-20201126235959-1bc23d45efg6
)

replace github.com/YOU/your-lib1 => ..\your-lib1

replace github.com/ANOTHER/ano-libZ => ..\..\ano-libZ

Drop

⬇⬇⬇

gomodlocal drop --all
(gomodlocal drop your-lib1 && gomodlocal drop ano-libZ)

⬇⬇⬇

module github.com/YOU/your-tool

go 1.15

require (
	github.com/YOU/your-lib1 v0.0.0-20201126235959-0ab12c34def5
	github.com/ANOTHER/ano-libZ v0.1.0-20201126235959-1bc23d45efg6
)

It's back.

More help

gomodlocal help
gomodlocal help subcommand

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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