Skip to content
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

ci(lint): golangci-lint and fieldalignment #132

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
experiment with //nolint for some structs which will prioritize reada…
…bility
  • Loading branch information
ramin committed Nov 22, 2023
commit 51372099352fff2f38d5c3075f65f7caec44b830
4 changes: 0 additions & 4 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- v*
branches:
- main
- chore/ramin/field-alignment
pull_request:

jobs:
Expand All @@ -19,9 +18,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: debug .go-version file
run: cat .go-version

- name: Read .go-version file
id: go-version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ linters-settings:
misspell:
locale: US
goimports:
local-prefixes: github.com/celestiaorg/celestia-node
local-prefixes: github.com/celestiaorg/go-header
dupl:
threshold: 200
govet:
Expand Down
12 changes: 7 additions & 5 deletions sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ var log = logging.Logger("header/sync")
// - Sets as the new Subjective Head, which
// - if there is a gap between the previous and the new Subjective Head
// - Triggers s.syncLoop and saves the Subjective Head in the pending so s.syncLoop can access it
//
//nolint:govet
type Syncer[H header.Header[H]] struct {
// stateLk protects state which represents the current or latest sync
stateLk sync.RWMutex
// incomingMu ensures only one incoming network head candidate is processed at the time
incomingMu sync.Mutex

store syncStore[H] // to store all the headers to
sub header.Subscriber[H] // to subscribe for new Network Heads

Expand All @@ -49,11 +56,6 @@ type Syncer[H header.Header[H]] struct {
pending ranges[H]

state State

// stateLk protects state which represents the current or latest sync
stateLk sync.RWMutex
// incomingMu ensures only one incoming network head candidate is processed at the time
incomingMu sync.Mutex
}

// NewSyncer creates a new instance of Syncer.
Expand Down