Skip to content

Migrate lint to v2 and add exhaustive check#224

Open
RodriFS wants to merge 1 commit into
masterfrom
migrate-lint-and-add-exhaustive-check
Open

Migrate lint to v2 and add exhaustive check#224
RodriFS wants to merge 1 commit into
masterfrom
migrate-lint-and-add-exhaustive-check

Conversation

@RodriFS

@RodriFS RodriFS commented May 13, 2026

Copy link
Copy Markdown
Collaborator

This PR migrates to golint-v2, adds an exhaustive check for enums and fixes all linter errors.

Also, it updates the README files to be in line file movements and also added a bit of a guide to the daemon readme so a new user can easily create a swap.

Comment thread daemon/database/database.go
@RodriFS RodriFS force-pushed the migrate-lint-and-add-exhaustive-check branch from e63003a to e31bc6e Compare May 13, 2026 10:26
@RodriFS RodriFS requested a review from markettes June 10, 2026 06:13
@RodriFS RodriFS force-pushed the fix-new-outcomes-and-statuses branch from 09d90ef to bf281cd Compare June 18, 2026 12:04
@RodriFS RodriFS changed the base branch from fix-new-outcomes-and-statuses to master June 18, 2026 12:05
@RodriFS RodriFS force-pushed the migrate-lint-and-add-exhaustive-check branch from e31bc6e to c377310 Compare June 18, 2026 12:05
Copilot AI review requested due to automatic review settings June 18, 2026 12:06
@RodriFS RodriFS force-pushed the migrate-lint-and-add-exhaustive-check branch from c377310 to 117700d Compare June 18, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Go linting setup to golangci-lint v2 (including enabling exhaustive), adjusts code to satisfy new lint rules (notably around context usage), and updates project documentation to reflect directory/script changes and provide daemon usage guidance.

Changes:

  • Migrate daemon/.golangci.yml to the golangci-lint v2 configuration format and enable additional linters (including exhaustive).
  • Thread context.Context into RPC server and database startup/cleanup paths.
  • Update root and daemon READMEs plus .justfile defaults to match the current docker/dev workflow.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
README.md Updates local-dev docker workflow instructions and dev alias sourcing path.
daemon/rpc/server.go Adds context-aware listener creation via net.ListenConfig.
daemon/rpc/server_test.go Updates test to pass a context into ListenAndServe.
daemon/README.md Adds local dev guide for running the daemon and creating swaps.
daemon/lightning/lnd/lnd.go Lint-driven updates (ReplaceAll, exhaustive suppression, enum handling).
daemon/database/database.go Adds context to DB ctor and uses it for lsof/kill cleanup; normalizes error strings.
daemon/database/database_test.go Passes test context into DB constructor.
daemon/database/cli/main.go Threads CLI context into DB startup.
daemon/daemon/daemon.go Passes context into RPC server startup.
daemon/cmd/main.go Passes context into DB ctor; removes liquid flag definition.
daemon/bitcoin/helpers.go Normalizes error message casing.
daemon/.golangci.yml Migrates to golangci-lint v2 config and enables exhaustive.
.justfile Changes default docker compose profile to mempool-btc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines 67 to +70
By sourcing [`server-backend/dev/dev-aliases.sh`](server-backend/dev/dev-aliases.sh) you can get access to some useful commands, e.g.:

```bash
source server-backend/dev/dev-aliases.sh
source docker/dev-aliases.sh
Comment on lines 295 to 297
log.WithField("invoice", invoice).Debug("New TrackPaymentV2 event")
// nolint: exhaustive // lnrpc.Payment_UNKNOWN is deprecated, so we need to ignore either the exhaustive check or the deprecated check.
switch invoice.Status {
Comment on lines 73 to 77
if !keepAlive {
if err := postgres.Stop(); err != nil {
if errors.Is(err, embeddedpostgres.ErrServerNotStarted) && isPostgresRunning(port) {
killPostgres(port)
if errors.Is(err, embeddedpostgres.ErrServerNotStarted) && isPostgresRunning(ctx, port) {
killPostgres(ctx, port)

Comment on lines 161 to 165
func (d *Database) close() error {
db, err := d.orm.DB()
if err != nil {
return fmt.Errorf("Could not get database connection: %w", err)
return fmt.Errorf("could not get database connection: %w", err)
}
Comment on lines +218 to 222
out, err := exec.CommandContext(ctx, "lsof", "-i", fmt.Sprintf(":%d", port), "-t").Output()
if err == nil {
pid := strings.TrimSpace(string(out))
_ = exec.Command("kill", "-9", pid).Run()
_ = exec.CommandContext(ctx, "kill", "-9", pid).Run()
}
Comment thread README.md
cd server-backend/dev
docker compose up
cd docker
docker compose up <profile>
Comment thread README.md
```bash
server-backend/dev/nodes-setup.sh
cd docker
nodes-setup.sh
Comment thread daemon/README.md
2. Run the daemon

```bash
just run-daemon
Comment thread daemon/README.md

```bash
just user-lncli addinvoice 200000 # Copy the payreq
just run swap in --payreq <payreq>
Comment thread daemon/README.md
4. Create a swap out

```bash
just run swap out --address bcrt1q94gs370gfjut9d75ss3j7m8l7m3phs06nlqd8n --amt 200000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants