https://github.com/brettbuddin/modtransplant
Merge a Go module dependency into the depending module.
https://github.com/brettbuddin/modtransplant
go golang modules
Last synced: about 2 months ago
JSON representation
Merge a Go module dependency into the depending module.
- Host: GitHub
- URL: https://github.com/brettbuddin/modtransplant
- Owner: brettbuddin
- Created: 2020-08-28T02:41:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-28T15:32:05.000Z (almost 6 years ago)
- Last Synced: 2025-01-01T23:30:12.795Z (over 1 year ago)
- Topics: go, golang, modules
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## modtransplant
We recently went through the process of merging a project dependency into the
main project (removing the dependency) at [InfluxData](https://influxdata.com).
After struggling to do the `go.mod` merging by hand, I wrote this tool to help
with the process. The goal of this program is keep changes the resulting
`go.mod` (after triggering the `go` tool) to a minimum, and yield a depeendecy
graph that's as close as possible to the original, but with the source module
no-longer being a dependency of the destination.
### Usage
```
$ go install github.com/brettbuddin/modtransplant
$ modtransplant -dest=project-a/go.mod -src=project-b/go.mod [-force-overwrite] > go-merged.mod
```
The `-dest` is a filepath to the `go.mod` file of your destination module.
The `-src` is a filepath to the `go.mod` file of the module you are merging into
the destination module.
The optional `-force-overwrite` flag forces overwriting of a module path's
version in the destination when the tool detects two versions that it cannot
compare (e.g. `v0.5.0` vs `v0.0.0-20190523213315-cbe66965904d`). Ideally this
shouldn't be necessary, but if you have a project with enough old dependencies,
it might be useful.