Skip to content

Commit

Permalink
build: use golangci-lint CLI to lint files (#80)
Browse files Browse the repository at this point in the history
This PR updates the linting process to use the `golangci-lint` CLI. This should guarantee major forward compatibility as the golangci-lint version is now tracked within the codebase along with other dependencies

Depends-On: #79

- [x] Targeted PR against correct branch.
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Wrote unit tests.
- [x] Re-reviewed `Files changed` in the Github PR explorer.
  • Loading branch information
RiccardoM committed Nov 25, 2022
1 parent 4c444c9 commit 93a8134
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions database/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ func (db *Database) GetLastBlockHeight() (int64, error) {
stmt := `SELECT height FROM block ORDER BY height DESC LIMIT 1;`

var height int64
if err := db.SQL.QueryRow(stmt).Scan(&height); err != nil {
err := db.SQL.QueryRow(stmt).Scan(&height)
if err != nil {
if strings.Contains(err.Error(), "no rows in result set") {
// If no rows stored in block table, return 0 as height
return 0, nil
}
return 0, fmt.Errorf("error while getting last block height, error: %s", err)
}

if height == 0 {
return 0, fmt.Errorf("cannot get block height, no blocks saved")
}

return height, nil
}

Expand Down

0 comments on commit 93a8134

Please sign in to comment.