]> go.fuhry.dev Git - fsnotify.git/commitdiff
Fix lint (#476)
authorMartin Tournoij <martin@arp242.net>
Sat, 30 Jul 2022 10:53:47 +0000 (12:53 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Jul 2022 10:53:47 +0000 (12:53 +0200)
Didn't run for some reasons; something with the actions cache:

/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/b9a1abd7-273e-449f-b255-5e8e947b3f97/cache.tzst -P -C /home/runner/work/fsnotify/fsnotify
Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20220412211240-33da011f77ad/windows/race0.go: Cannot open: File exists
Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20220412211240-33da011f77ad/windows/types_windows.go: Cannot open: File exists

Replace it with staticcheck; which is nicer anyway.

.github/workflows/build.yml
.github/workflows/lint.yml [deleted file]
.github/workflows/staticcheck.yml [new file with mode: 0644]
.github/workflows/test.yml
.github/workflows/vagrant.yml
inotify_test.go

index 0d004c1c3d5b4d4cea28aafb3811adfedea547aa..59ef7dc25b56f20112f5f2d8a54b7abc077af8ee 100644 (file)
@@ -1,15 +1,11 @@
-name: build
-on:
-  push:
-  pull_request:
+name: 'build'
+on:   ['push', 'pull_request']
 jobs:
-  cross-compile-supported:
+  cross-compile:
     strategy:
       fail-fast: false
       matrix:
-        go:
-          - '1.16'
-          - '1.18'
+        go: ['1.16', '1.18']
     runs-on: ubuntu-latest
     steps:
       - name: setup Go
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644 (file)
index 5df6527..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-name: test
-on:
-  push:
-  pull_request:
-jobs:
-  lint:
-    runs-on: ubuntu-latest
-    steps:
-      - name: setup Go
-        uses: actions/setup-go@v3
-        with:
-          go-version: '1.18'
-
-      - name: checkout
-        uses: actions/checkout@v3
-
-      - name: gofmt
-        run: |
-          test -z "$(gofmt -s -d . | tee /dev/stderr)"
-
-      - name: vet
-        run: |
-          go vet ./...
-
-      - name: golangci-lint
-        uses: golangci/golangci-lint-action@v3
-        continue-on-error: true
-        with:
-          version: latest
-          skip-go-installation: true
diff --git a/.github/workflows/staticcheck.yml b/.github/workflows/staticcheck.yml
new file mode 100644 (file)
index 0000000..22e222a
--- /dev/null
@@ -0,0 +1,13 @@
+name: 'staticcheck'
+on:   ['push', 'pull_request']
+jobs:
+  staticcheck:
+    name:    'staticcheck'
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v3
+      with:
+        fetch-depth: 1
+    - uses: dominikh/staticcheck-action@v1.2.0
+      with:
+        version: '2022.1'
index d6fa966106c8012ef73d3f546ede8117491296f9..5cd355adebcfdd3cd1f83a2735d34c59c2c005be 100644 (file)
@@ -1,7 +1,5 @@
-name: test
-on:
-  push:
-  pull_request:
+name: 'test'
+on:   ['push', 'pull_request']
 jobs:
   test:
     strategy:
index 1cb822f81d62fbcc340f9d3d96798756caa10ee5..76bce8a03c194e92aee271f77ec07cef373dac1e 100644 (file)
@@ -1,7 +1,5 @@
-name: vagrant
-on:
-  push:
-  pull_request:
+name: 'test'
+on:   ['push', 'pull_request']
 jobs:
   test:
     strategy:
index d9ee53ff0ce34f2031436e5129768fb4dc09aa6f..9aed1bec52525641dc1163a5ac1b5bf5b804bc6f 100644 (file)
@@ -132,7 +132,7 @@ func TestInotifyCloseCreate(t *testing.T) {
        }
        h.Close()
        select {
-       case _ = <-w.Events:
+       case <-w.Events:
        case err := <-w.Errors:
                t.Fatalf("Error from watcher: %v", err)
        case <-time.After(50 * time.Millisecond):
@@ -144,7 +144,7 @@ func TestInotifyCloseCreate(t *testing.T) {
        // Now we try to swap the file descriptor under its nose.
        w.Close()
        w, err = NewWatcher()
-       defer w.Close()
+       defer func() { _ = w.Close() }()
        if err != nil {
                t.Fatalf("Failed to create second watcher: %v", err)
        }
@@ -351,7 +351,7 @@ func TestInotifyInnerMapLength(t *testing.T) {
        if err != nil {
                t.Fatalf("Failed to remove testFile: %v", err)
        }
-       _ = <-w.Events                      // consume Remove event
+       <-w.Events                          // consume Remove event
        <-time.After(50 * time.Millisecond) // wait IN_IGNORE propagated
 
        func() {