Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joesonw/go-diff
a simple tool to check changes between git commits for go source files. it will resolve package dependencies. this is helpful in large projects ci, you will only need to run tests on changed/related files.
https://github.com/joesonw/go-diff
ci devop golang
Last synced: 6 days ago
JSON representation
a simple tool to check changes between git commits for go source files. it will resolve package dependencies. this is helpful in large projects ci, you will only need to run tests on changed/related files.
- Host: GitHub
- URL: https://github.com/joesonw/go-diff
- Owner: joesonw
- License: apache-2.0
- Created: 2020-04-26T05:33:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-27T15:08:27.000Z (11 months ago)
- Last Synced: 2024-05-21T13:57:51.146Z (6 months ago)
- Topics: ci, devop, golang
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 27
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-monorepo - go-diff - diff.svg?style=social&label=Star) (版本控制系统和附加组件 / Git)
README
# Install
`go get github.com/joesonw/go-diff`
# Why
This little handy tool helps to manage large mono repositories. You don't have to rebuild every single service upon each little update.
This will help you to find out which services should be updated.
# Important
Only works with `GO MODULES` ATM# Usage
`go-diff -repo github.com/user/repo -branch master -from -to `
> or use `-repo file:///path/to/your/local/repo` to avoid cloning
# What does it do
1. It clones your repo
2. It then checkouts into specified branch.
3. It then does a diff between two hashes.
4. It will add any changed `.go` files to the change list
5. It compares two `go.sum` files and compute changed libraries, then added to change list
6. It parses every `.go` file and find import dependencies.
7. It adds every file that imported any package from change list, and does over and over again, until nothing new isfound.
8. TADA! You have a list of packages that needed to be rebuilt.# Example
`https://github.com/dstreamcloud/diff-sample/tree/go`
## Example 1
> go-diff -repo https://github.com/dstreamcloud/diff-sample -branch go -from 1d748721adb49b79a529e446cca4b1a21bdd9b13 -to 4170f40939e939372e5c55beacd6a69ead53b976
This diff only changed `pkg/critical/critical.go`. But all packages are considered changed.
## Example 2
> go-diff -repo https://github.com/dstreamcloud/diff-sample -branch go -from 4170f40939e939372e5c55beacd6a69ead53b976 -to 6597f05c8b41f1182ad4fba09720728ada22a7faThis diff only updated dependency of logrus. Thus only `pkg/logrus` and root which depends on it are considered changed.