Skip to content

Commit

Permalink
add the revive linter and fix findings
Browse files Browse the repository at this point in the history
  • Loading branch information
nunnatsa committed Jun 14, 2023
1 parent ce8afd3 commit f2ad9b7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20
go-version: "1.20"

- name: lint
uses: golangci/golangci-lint-action@v3

- name: ginkgo-lint
run: |-
go install github.com/nunnatsa/ginkgolinter/cmd/ginkgolinter@latest
ginkgolinter ./...
with:
version: v1.53.2
skip-pkg-cache: true
args: --timeout=5m --out-${NO_FUTURE}format line-number

- name: test
run: make test
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
linters:
enable:
- ginkgolinter
- revive
2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Controller) do() {
c.screenEvents <- msg

for {
var change *state.Change = nil
var change *state.Change

select {
case <-signals:
Expand Down
3 changes: 1 addition & 2 deletions hat/hat.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ func findJoystickDeviceFile() (string, error) {

if foundDevice && len(deviceName) > 0 {
return eventFilePrefix + deviceName, nil // found
} else {
return "", fmt.Errorf("can't find the joystick device")
}
return "", fmt.Errorf("can't find the joystick device")
}
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func main() {

if err := server.ListenAndServe(); err != http.ErrServerClosed {
log.Panic(err)
} else {
fmt.Println("\nGood Bye!")
}
fmt.Println("\nGood Bye!")
}
4 changes: 2 additions & 2 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type idProvider struct {
counter uint64
}

func newIdProvider() *idProvider {
func newIDProvider() *idProvider {
return &idProvider{
counter: 0,
}
Expand All @@ -29,7 +29,7 @@ type Notifier struct {
func NewNotifier() *Notifier {
return &Notifier{
clientMap: make(map[uint64]chan []byte),
idp: newIdProvider(),
idp: newIDProvider(),
lock: &sync.Mutex{},
}
}
Expand Down

0 comments on commit f2ad9b7

Please sign in to comment.