Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed May 1, 2024
1 parent 69514f1 commit 87232a6
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 116 deletions.
5 changes: 0 additions & 5 deletions .editorconfig

This file was deleted.

9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

70 changes: 26 additions & 44 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
name: test
on: [push]
name: 'test'
on: ['push', 'pull_request']
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
- macos-latest
go:
- '1.18.0-beta1'
- '1.17'
- '1.16'
os: ['macos-12', 'macos-latest']
go: ['1.17', '1.22']
runs-on: ${{ matrix.os }}
steps:
- name: setup Go
uses: actions/setup-go@v2
- uses: 'actions/checkout@v4'
- uses: 'actions/setup-go@v5'
with:
stable: 'false'
go-version: ${{ matrix.go }}
go-version: '${{ matrix.go }}'
- name: 'test'
run: 'go test --race ./...'

- name: checkout
uses: actions/checkout@v2

- name: test
run: |
go test --race ./...
lint:
runs-on: macos-latest
staticcheck:
name: 'staticcheck'
runs-on: 'macos-latest'
steps:
- name: setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'

- name: checkout
uses: actions/checkout@v2

- name: gofmt
run: |
test -z "$(gofmt -s -d . | tee /dev/stderr)"
- name: vet
run: |
go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
continue-on-error: true
- uses: 'actions/checkout@v4'
- uses: 'actions/setup-go@v5'
with:
version: latest
skip-go-installation: true

go-version: '1.22'
- uses: 'actions/cache@v4'
with:
key: '${{ runner.os }}-staticcheck'
path: |
${{ runner.temp }}/staticcheck
${{ steps.install_go.outputs.GOCACHE || '' }}
- run: |
export STATICCHECK_CACHE="${{ runner.temp }}/staticcheck"
go install honnef.co/go/tools/cmd/staticcheck@latest
$(go env GOPATH)/bin/staticcheck ./...
22 changes: 0 additions & 22 deletions AUTHORS

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 The fsevents Authors. All rights reserved.
Copyright © The fsevents Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
4 changes: 1 addition & 3 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//go:build darwin
// +build darwin

package main

import (
"bufio"
"io/ioutil"
"log"
"os"
"runtime"
Expand All @@ -15,7 +13,7 @@ import (
)

func main() {
path, err := ioutil.TempDir("", "fsexample")
path, err := os.TempDir("", "fsexample")

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / staticcheck

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / staticcheck

too many arguments in call to os.TempDir

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

too many arguments in call to os.TempDir

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 16 in example/main.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

too many arguments in call to os.TempDir
if err != nil {
log.Fatalf("Failed to create TempDir: %v", err)
}
Expand Down
21 changes: 10 additions & 11 deletions fsevents.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build darwin
// +build darwin

// Package fsevents provides file system notifications on macOS.
package fsevents
Expand All @@ -16,7 +15,7 @@ type Event struct {
// to its device's root.
// Use DeviceForPath to determine the absolute path that's
// being referred to.
Path string
Path string

// Flags holds details what has happened.
Flags EventFlags
Expand All @@ -33,7 +32,7 @@ type Event struct {
// and resume processing them later from a newly-created
// EventStream, this is the value you would pass for the
// EventStream.EventID along with Resume=true.
ID uint64
ID uint64
}

// DeviceForPath returns the device ID for the specified volume.
Expand All @@ -49,10 +48,10 @@ func DeviceForPath(path string) (int32, error) {
// You can provide your own event channel if you wish (or one will be
// created on Start).
//
// es := &EventStream{Paths: []string{"/tmp"}, Flags: 0}
// es.Start()
// es.Stop()
// ...
// es := &EventStream{Paths: []string{"/tmp"}, Flags: 0}
// es.Start()
// es.Stop()
// ...
type EventStream struct {
stream fsEventStreamRef
rlref cfRunLoopRef
Expand All @@ -62,19 +61,19 @@ type EventStream struct {

// Events holds the channel on which events will be sent.
// It's initialized by EventStream.Start if nil.
Events chan []Event
Events chan []Event

// Paths holds the set of paths to watch, each
// specifying the root of a filesystem hierarchy to be
// watched for modifications.
Paths []string
Paths []string

// Flags specifies what events to receive on the stream.
Flags CreateFlags
Flags CreateFlags

// Resume specifies that watching should resume from the event
// specified by EventID.
Resume bool
Resume bool

// EventID holds the most recent event ID.
//
Expand Down
20 changes: 9 additions & 11 deletions fsevents_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
//go:build darwin
// +build darwin

package fsevents

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
)

func TestBasicExample(t *testing.T) {
path, err := ioutil.TempDir("", "fsexample")
path, err := os.TempDir("", "fsexample")

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / staticcheck

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / staticcheck

too many arguments in call to os.TempDir

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.17)

too many arguments in call to os.TempDir

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

too many arguments in call to os.TempDir

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.17)

too many arguments in call to os.TempDir

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 14 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

too many arguments in call to os.TempDir
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -52,7 +50,7 @@ func TestBasicExample(t *testing.T) {
}
}()

err = ioutil.WriteFile(filepath.Join(path, "example.txt"), []byte("example"), 0700)
err = os.WriteFile(filepath.Join(path, "example.txt"), []byte("example"), 0700)
if err != nil {
t.Fatal(err)
}
Expand All @@ -67,7 +65,7 @@ func TestIssue48(t *testing.T) {
// FSEvents fails to start when watching >4096 paths
// This test validates that limit and checks that the error is propagated

path, err := ioutil.TempDir("", "fsmanyfiles")
path, err := os.TempDir("", "fsmanyfiles")

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / staticcheck

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / staticcheck

too many arguments in call to os.TempDir

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.17)

too many arguments in call to os.TempDir

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-12, 1.22)

too many arguments in call to os.TempDir

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.17)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.17)

too many arguments in call to os.TempDir

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

assignment mismatch: 2 variables but os.TempDir returns 1 value

Check failure on line 68 in fsevents_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest, 1.22)

too many arguments in call to os.TempDir
if err != nil {
t.Fatal(err)
}
Expand All @@ -86,7 +84,7 @@ func TestIssue48(t *testing.T) {
var filenames []string
for i := 0; i < 4096; i++ {
newFilename := filepath.Join(path, fmt.Sprint("test", i))
err = ioutil.WriteFile(newFilename, []byte("test"), 0700)
err = os.WriteFile(newFilename, []byte("test"), 0700)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -118,7 +116,7 @@ func TestIssue48(t *testing.T) {
}()

// write some new contents to test42 in the watchlist
err = ioutil.WriteFile(filenames[42], []byte("special"), 0700)
err = os.WriteFile(filenames[42], []byte("special"), 0700)
if err != nil {
t.Fatal(err)
}
Expand All @@ -129,23 +127,23 @@ func TestIssue48(t *testing.T) {
/////
// create one more file that puts it over the edge
newFilename := filepath.Join(path, fmt.Sprint("test", 4096))
err = ioutil.WriteFile(newFilename, []byte("test"), 0700)
err = os.WriteFile(newFilename, []byte("test"), 0700)
if err != nil {
t.Fatal(err)
}
filenames = append(filenames, newFilename)

// create an all-new instances to avoid problems
es = &EventStream{
es2 := &EventStream{
Paths: filenames,
Latency: 500 * time.Millisecond,
Device: 0, //dev,
Flags: FileEvents,
}

err = es.Start()
err = es2.Start()
if err == nil {
es.Stop()
es2.Stop()
t.Fatal("eventstream error was not detected on >4096 files in watchlist")
}
}
Expand Down
1 change: 0 additions & 1 deletion wrap.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build darwin
// +build darwin

package fsevents

Expand Down
1 change: 0 additions & 1 deletion wrap_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build darwin
// +build darwin

package fsevents

Expand Down

0 comments on commit 87232a6

Please sign in to comment.