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 23, 2022
1 parent 4c857ee commit f8cb673
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
if: "!startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/cosmos')"

Unit-tests:
runs-on: ubuntu-latest
Expand All @@ -39,11 +39,10 @@ jobs:
- name: Build 🔨
if: "env.GIT_DIFF != ''"
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
run: make build

- name: Test & Coverage report creation 🧪
run: |
make install test-unit stop-docker-test
run: make test-unit stop-docker-test

- name: Upload coverage 📤
if: "env.GIT_DIFF != ''"
Expand Down
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 f8cb673

Please sign in to comment.