mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +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.
|
||||
func doCheckTidy() {
|
||||
targets := []string{"go.mod", "go.sum"}
|
||||
|
||||
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)
|
||||
}
|
||||
build.MustRun(new(build.GoToolchain).Go("mod", "tidy", "-diff"))
|
||||
fmt.Println("No untidy module files detected.")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue