mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
update golangci lint using GIT_BRANCH_REF
This commit is contained in:
parent
56a2e89767
commit
8b5a222efd
2 changed files with 17 additions and 1 deletions
8
.github/workflows/go.yml
vendored
8
.github/workflows/go.yml
vendored
|
|
@ -15,6 +15,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
# Cache build tools to avoid downloading them each time
|
# Cache build tools to avoid downloading them each time
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
|
|
@ -28,6 +29,12 @@ jobs:
|
||||||
go-version: 1.24
|
go-version: 1.24
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
|
- name: Fetch base branch
|
||||||
|
run: |
|
||||||
|
if [ ! -z "$GITHUB_BASE_REF" ]; then
|
||||||
|
git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Run linters
|
- name: Run linters
|
||||||
run: |
|
run: |
|
||||||
go run build/ci.go lint
|
go run build/ci.go lint
|
||||||
|
|
@ -56,3 +63,4 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
||||||
|
|
|
||||||
10
build/ci.go
10
build/ci.go
|
|
@ -433,7 +433,14 @@ func doLint(cmdline []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
linter := downloadLinter(*cachedir)
|
linter := downloadLinter(*cachedir)
|
||||||
lflags := []string{"run", "--config", ".golangci.yml", "--new-from-rev=origin/master"}
|
baseRef := "master"
|
||||||
|
if ref := os.Getenv("GITHUB_BASE_REF"); ref != "" {
|
||||||
|
baseRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
lflags := []string{"run", "--config", ".golangci.yml",
|
||||||
|
fmt.Sprintf("--new-from-rev=origin/%s", baseRef),
|
||||||
|
}
|
||||||
build.MustRunCommandWithOutput(linter, append(lflags, packages...)...)
|
build.MustRunCommandWithOutput(linter, append(lflags, packages...)...)
|
||||||
fmt.Println("You have achieved perfection.")
|
fmt.Println("You have achieved perfection.")
|
||||||
}
|
}
|
||||||
|
|
@ -1172,3 +1179,4 @@ func doSanityCheck() {
|
||||||
csdb := download.MustLoadChecksums("build/checksums.txt")
|
csdb := download.MustLoadChecksums("build/checksums.txt")
|
||||||
csdb.DownloadAndVerifyAll()
|
csdb.DownloadAndVerifyAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue