Skip to content

Commit

Permalink
experiment with //nolint for some structs which will prioritize reada…
Browse files Browse the repository at this point in the history
…bility
  • Loading branch information
ramin committed Nov 22, 2023
1 parent 6d3e8b1 commit 5137209
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
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

0 comments on commit 5137209

Please sign in to comment.