-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: fix ci / makefile #2320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: fix ci / makefile #2320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
Changes look good for the most part. Main comment pertains to keeping the grandfathered linter commit
.github/workflows/go.yml
Outdated
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Check out source | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Makefile
Outdated
|
||
LINT_COMMIT := v1.18.0 | ||
GOACC_COMMIT := 80342ae2e0fcf265e99e76bcc4efd022c7c3811b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is important, as it absolves any linter violations before that commit. Otherwise, we'll have to have a PR which fixes every linter violation.
In lnd
, we use golangci
which still supports this feature: https://github.com/lightningnetwork/lnd/pull/9382/files
scripts/tidy_modules.sh
Outdated
@@ -1,17 +0,0 @@ | |||
#!/bin/bash | |||
|
|||
SUBMODULES=$(find . -mindepth 2 -name "go.mod" | cut -d'/' -f2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove? Given that it's able to locate sub-modules automatically?
In the new diff, we need to enumerate them all by hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought it was simple approach. Other commands, such as unit / unit-cover, are still done entirely by hand. It works perfectly as long as nested go.mod is not added.
Makefile
Outdated
|
||
LINT = $(LINT_BIN) run -v $(LINT_WORKERS) | ||
LINT = $(LINT_BIN) run -v $(LINT_WORKERS) --timeout=$(LINT_TIMEOUT) --issues-exit-code=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's issues-exit-code
needed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just exits with code 0 when a lint error occurs. It's not needed, so better to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in bdf7318
@@ -14,8 +14,6 @@ GOTEST_DEV = go test -v -tags=$(DEV_TAGS) | |||
GOTEST := go test -v | |||
GOMODTIDY := go mod tidy | |||
|
|||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 it's been years since we vendor'd deps
Is this still under development? |
@yyforyongyu It is still in development, but it would be good to recreate the PR to follow Ideal Git Commit Structure. |
@rabbitprincess Cool thanks - I think it's better to do a force push on this PR once you fix the commit structure, it's easier that way as we won't lose the context/comments from this PR. |
Pull Request Test Coverage Report for Build 16746440587Details
💛 - Coveralls |
479ef5a
to
52363a8
Compare
@yyforyongyu this pr and #2307 are force-pushed. can you review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rabbitprincess, I tested your PR and ran into an issue during the lint step. It looks like the linter version used is very outdated (v1.18.0, released 6 years ago):
➜ btcd git:(feature/fix-ci) ✗ make lint
Fetching linter
go install -v github.com/golangci/golangci-lint/cmd/[email protected]
go: github.com/golangci/golangci-lint/cmd/[email protected]:
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
make: *** [Makefile:46: /home/head/go/bin/golangci-lint] Error 1
System info:
Linux 6.11.0-26-generic x86_64
Go version go1.24.2 linux/amd64
Other steps like make fmt
and make unit-cover
are working fine. I think we could consider bumping the linter version to something more recent.
52363a8
to
80b74d6
Compare
@GustavoStingelin Sure! It's been updated to v2.1.6. |
LGTM! @Roasbeef @yyforyongyu with the updated Breakdown of issues:
|
or maybe copy the |
@kcalvinalvin any thoughts? |
Usually what we do is set a commit hash that grandfathers in any violations. So then only new PRs that introduce new linting errors get triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rabbitprincess please, add the file .golangci.yml
to the root path with the value
version: "2"
issues:
# Only show newly introduced problems.
new-from-rev: 80b74d6c5a0088a66dc96df6777d21e15c04849c
Sure! It's been applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
I think you will need to rebase your first commit with the changes from the last |
3e1fbf3
to
770a77b
Compare
@GustavoStingelin Sure. It's been applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I run make lint
, I get this error:
⛰ make lint
Linting source.
/Users/roasbeef/gocode/bin/golangci-lint run -v
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.22()
/Users/roasbeef/gocode/pkg/mod/github.com/go-critic/[email protected]/checkers/embedded_rules.go:47 +0x494
make: *** [lint] Error 2
Can you check the output of |
FYI, |
Ah I'm on Go 1.23.6 locally. So seems that we'll need to update the top level Go 1.25 comes out in August, so that should line up with our policy to support the past two go versions. |
works well on version
|
Makefile
Outdated
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports | ||
|
||
GO_BIN := ${GOPATH}/bin | ||
GO_BIN := ${shell go env GOPATH}/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GO_BIN := ${shell go env GOPATH}/bin | |
GO_BIN := ${shell go env GOBIN} |
When testing with different Go versions, I found that go env GOBIN
is more reliable than assuming $GOPATH/bin
. In my case, using mise as a tool manager, GOBIN doesn't follow the traditional path structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I just commit this, or should I rebase it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase bc your previous commit modifies this line and is in this context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GustavoStingelin It's been applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, tACK in go1.24.5
and go1.23.1
linux/amd64
770a77b
to
106cde6
Compare
Overview
fix / cleanup makefile and correcting several commands.
Related to #2319 #2316