golangci-lint/CI: Bump versions and introduce new linters (#798)

* golangci-lint/CI: Bump versions

Fix remaining linter issues

* Specifically set AppVeyor version

* Fix the infamous typos 👀

* Add go env cmd to AppVeyor

* Add go version cmd to AppVeyor

* Specify AppVeyor image, adjust linters

* Update go get to go install due to deprecation

* Bump golangci-lint timeout time for AppVeyor

* Change NW contract to NQ

* Address nitters

* GetRandomPair -> Pair{}

* Address nits

* Address time nitterinos plus additional tweaks

* More time inception upgrades!

* Bending time and space
This commit is contained in:
Adrian Gallagher
2021-10-14 16:38:53 +11:00
committed by GitHub
parent 0a91af0f2e
commit f0d45aa1d2
194 changed files with 1506 additions and 1233 deletions

View File

@@ -8,8 +8,7 @@ import (
func TestNewComm(t *testing.T) {
var cfg base.CommunicationsConfig
_, err := NewComm(&cfg)
if err == nil {
if _, err := NewComm(&cfg); err == nil {
t.Error("NewComm should have failed on no enabled communication mediums")
}

View File

@@ -67,8 +67,7 @@ func (s *Slack) Setup(cfg *base.CommunicationsConfig) {
// Connect connects to the service
func (s *Slack) Connect() error {
err := s.NewConnection()
if err != nil {
if err := s.NewConnection(); err != nil {
return err
}

View File

@@ -25,8 +25,7 @@ func TestSetup(t *testing.T) {
func TestConnect(t *testing.T) {
t.Parallel()
var s Slack
err := s.Connect()
if err == nil {
if err := s.Connect(); err == nil {
t.Error("slack Connect() error cannot be nil")
}
}
@@ -43,8 +42,7 @@ func TestPushEvent(t *testing.T) {
func TestBuildURL(t *testing.T) {
t.Parallel()
var s Slack
v := s.BuildURL("lol123")
if v != "https://slack.com/api/rtm.start?token=lol123" {
if v := s.BuildURL("lol123"); v != "https://slack.com/api/rtm.start?token=lol123" {
t.Error("slack BuildURL() error")
}
}
@@ -183,8 +181,7 @@ func TestGetUsersInGroup(t *testing.T) {
func TestNewConnection(t *testing.T) {
t.Parallel()
var s Slack
err := s.NewConnection()
if err == nil {
if err := s.NewConnection(); err == nil {
t.Error("slack NewConnection() error")
}
}
@@ -192,8 +189,7 @@ func TestNewConnection(t *testing.T) {
func TestWebsocketConnect(t *testing.T) {
t.Parallel()
var s Slack
err := s.WebsocketConnect()
if err == nil {
if err := s.WebsocketConnect(); err == nil {
t.Error("slack WebsocketConnect() error")
}
}

View File

@@ -18,9 +18,8 @@ func TestSetup(t *testing.T) {
func TestConnect(t *testing.T) {
t.Parallel()
var s SMSGlobal
err := s.Connect()
if err != nil {
t.Error("SMSGlobal Connect() error", err)
if err := s.Connect(); err != nil {
t.Error(err)
}
}
@@ -43,9 +42,8 @@ func TestGetEnabledContacts(t *testing.T) {
},
},
}
v := s.GetEnabledContacts()
if v != 1 {
t.Error("SMSGlobal GetEnabledContacts() error")
if v := s.GetEnabledContacts(); v != 1 {
t.Error("expected one enabled contact")
}
}

View File

@@ -17,8 +17,7 @@ func TestSetup(t *testing.T) {
}
func TestConnect(t *testing.T) {
err := s.Connect()
if err != nil {
if err := s.Connect(); err != nil {
t.Error("smtpservice Connect() error", err)
}
}

View File

@@ -36,9 +36,8 @@ func TestSetup(t *testing.T) {
func TestConnect(t *testing.T) {
t.Parallel()
var T Telegram
err := T.Connect()
if err == nil {
t.Error("telegram Connect() error")
if err := T.Connect(); err == nil {
t.Error("expected error")
}
}
@@ -91,8 +90,7 @@ func TestHandleMessages(t *testing.T) {
func TestGetUpdates(t *testing.T) {
t.Parallel()
var T Telegram
_, err := T.GetUpdates()
if err != nil {
if _, err := T.GetUpdates(); err != nil {
t.Error("telegram GetUpdates() error", err)
}
}
@@ -100,10 +98,8 @@ func TestGetUpdates(t *testing.T) {
func TestTestConnection(t *testing.T) {
t.Parallel()
var T Telegram
err := T.TestConnection()
if err.Error() != testErrNotFound {
t.Errorf("telegram TestConnection() error, expected 'Not found' got '%s'",
err)
if err := T.TestConnection(); err.Error() != testErrNotFound {
t.Errorf("received %s, expected: %s", err, testErrNotFound)
}
}