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

chore: Add aggressive linting with golangci-lint #129

Merged
merged 2 commits into from
Jan 11, 2023
Merged

Conversation

vitsalis
Copy link
Member

Add linting similar to the Babylon repository to the vigilante. There were some unused variables that were removed (or used), so please pay attention to those (especially for zmq).

Copy link
Member

@SebastianElvis SebastianElvis left a comment

Choose a reason for hiding this comment

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

Much cleaner 🚀

@@ -34,7 +34,7 @@ func (sc *SentCheckpoints) ShouldSend(epoch uint64) bool {
return true
}
// 2. should resend if some interval has passed since the last sent
durSeconds := uint(time.Now().Sub(*ckptInfo.ts).Seconds())
durSeconds := uint(time.Since(*ckptInfo.ts).Seconds())
Copy link
Member

Choose a reason for hiding this comment

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

Wow, the linter can even identify this optimisation! 👏

@@ -24,8 +24,6 @@ type subscriptions struct {
zfront *zmq.Socket
latestEvent time.Time
active bool

sequence []chan *SequenceMsg
Copy link
Member

Choose a reason for hiding this comment

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

Didn't realise that we are not using this field. 😢 What was it used for? @gusin13

Copy link
Collaborator

Choose a reason for hiding this comment

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

I realized this got left in refactoring, we were using it before but then started using another channel to publish messages blockEventChan.

Copy link
Collaborator

@gitferry gitferry left a comment

Choose a reason for hiding this comment

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

Cool!

)

func readCAFile(cfg *config.BTCConfig) []byte {
// Read certificate file if TLS is not disabled.
if !cfg.DisableClientTLS {
certs, err := ioutil.ReadFile(cfg.CAFile)
certs, err := os.ReadFile(cfg.CAFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious why this needs to be replaced

Copy link
Member

Choose a reason for hiding this comment

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

ioutil is deprecated https://pkg.go.dev/io/ioutil

Copy link
Collaborator

@gusin13 gusin13 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@vitsalis vitsalis merged commit 23b428c into dev Jan 11, 2023
@vitsalis vitsalis deleted the golangci-lint branch January 11, 2023 14:58
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.

4 participants