Skip to content

Commit

Permalink
feat: Simplify linter configuration and fix related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kianaza committed May 20, 2024
1 parent d342c79 commit 5832af1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
test:
name: test
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
linters:
disable-all: true
enable:
- gofmt
- govet
- revive
- staticcheck
- errcheck
4 changes: 2 additions & 2 deletions internal/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"syscall"

"github.com/snapp-incubator/nats-blackbox-exporter/internal/config"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsClient"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsclient"
"go.uber.org/zap"
)

func main(cfg config.Config, logger *zap.Logger) {
natsConfig := cfg.NATS

client := natsClient.New(natsClient.Connect(logger, natsConfig), logger, natsConfig)
client := natsclient.New(natsclient.Connect(logger, natsConfig), logger, natsConfig)

client.StartMessaging()

Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/knadh/koanf/providers/structs"
"github.com/knadh/koanf/v2"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/logger"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsClient"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsclient"

Check failure on line 14 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / test

no required module provides package github.com/snapp-incubator/nats-blackbox-exporter/internal/natsclient; to add it:
"github.com/tidwall/pretty"
)

Expand All @@ -24,7 +24,7 @@ type (
// Config holds all configurations.
Config struct {
Logger logger.Config `json:"logger,omitempty" koanf:"logger"`
NATS natsClient.Config `json:"nats,omitempty" koanf:"nats"`
NATS natsclient.Config `json:"nats,omitempty" koanf:"nats"`
}
)

Expand Down
4 changes: 2 additions & 2 deletions internal/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"time"

"github.com/snapp-incubator/nats-blackbox-exporter/internal/logger"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsClient"
"github.com/snapp-incubator/nats-blackbox-exporter/internal/natsclient"
)

// Default return default configuration.
Expand All @@ -14,7 +14,7 @@ func Default() Config {
Logger: logger.Config{
Level: "debug",
},
NATS: natsClient.Config{
NATS: natsclient.Config{
URL: "localhost:4222",
PublishInterval: 2 * time.Second,
RequestTimeout: 50 * time.Millisecond,
Expand Down
2 changes: 1 addition & 1 deletion internal/natsClient/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package natsClient
package natsclient

import (
"time"
Expand Down
2 changes: 1 addition & 1 deletion internal/natsClient/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package natsClient
package natsclient

import "time"

Expand Down

0 comments on commit 5832af1

Please sign in to comment.