mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
build/ci: simplify doCheckTidy by using -diff flag
This commit is contained in:
parent
756310fa43
commit
5332db0634
1 changed files with 1 additions and 15 deletions
16
build/ci.go
16
build/ci.go
|
|
@ -352,21 +352,7 @@ func downloadSpecTestFixtures(csdb *build.ChecksumDB, cachedir string) string {
|
||||||
|
|
||||||
// doCheckTidy assets that the Go modules files are tidied already.
|
// doCheckTidy assets that the Go modules files are tidied already.
|
||||||
func doCheckTidy() {
|
func doCheckTidy() {
|
||||||
targets := []string{"go.mod", "go.sum"}
|
build.MustRun(new(build.GoToolchain).Go("mod", "tidy", "-diff"))
|
||||||
|
|
||||||
hashes, err := build.HashFiles(targets)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("failed to hash go.mod/go.sum: %v", err)
|
|
||||||
}
|
|
||||||
build.MustRun(new(build.GoToolchain).Go("mod", "tidy"))
|
|
||||||
|
|
||||||
tidied, err := build.HashFiles(targets)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("failed to rehash go.mod/go.sum: %v", err)
|
|
||||||
}
|
|
||||||
if updates := build.DiffHashes(hashes, tidied); len(updates) > 0 {
|
|
||||||
log.Fatalf("files changed on running 'go mod tidy': %v", updates)
|
|
||||||
}
|
|
||||||
fmt.Println("No untidy module files detected.")
|
fmt.Println("No untidy module files detected.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue