Skip to content

Commit bf133d7

Browse files
authored
Merge pull request #27 from Cian911/cian911/updates-2024
chore: update dependencies and test latest version of fsnotify
2 parents c3e78bc + ba80ebe commit bf133d7

File tree

14 files changed

+109
-859
lines changed

14 files changed

+109
-859
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Go Setup
2828
uses: actions/setup-go@v2
2929
with:
30-
go-version: 1.17
30+
go-version: 1.23
3131
- name: Run Release
3232
uses: goreleaser/goreleaser-action@v2
3333
with:

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: '~1.17'
25+
go-version: '~1.23'
2626
- name: Install Dependencies
2727
run: |
2828
go install github.com/rakyll/gotest@latest

.goreleaser.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: 2
12
before:
23
hooks:
34
- go mod download
@@ -42,12 +43,6 @@ dockers:
4243
archives:
4344
-
4445
id: switchboard
45-
replacements:
46-
darwin: Darwin
47-
linux: Linux
48-
windows: Windows
49-
386: i386
50-
amd64: x86_64
5146
checksum:
5247
name_template: 'checksums.txt'
5348
snapshot:
@@ -78,11 +73,6 @@ changelog:
7873
order: 999
7974
nfpms:
8075
-
81-
replacements:
82-
amd64: 64-bit
83-
386: 32-bit
84-
darwin: macOS
85-
linux: linux
8676
vendor: Cian911
8777
formats:
8878
- deb
@@ -91,16 +81,16 @@ nfpms:
9181
brews:
9282
-
9383
goarm: 6
94-
tap:
84+
repository:
9585
owner: Cian911
9686
name: homebrew-switchboard
97-
folder: Formula
87+
directory: Formula
9888
commit_author:
9989
name: Cian911
10090
email: cian@ciangallagher.net
101-
homepage: https://github.com/Cian911/switchboard
91+
homepage: "https://github.com/Cian911/switchboard"
10292
description: |
103-
TBD
93+
Automated file organisation and routing for all your machines.
10494
10595
artifactories:
10696
- name: swb

event/event.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
)
1313

1414
var validOperations = map[string]bool{
15-
"CREATE": true,
16-
"WRITE": true,
17-
"CLOSEWRITE": true,
15+
"CREATE": true,
16+
"WRITE": true,
17+
"CLOSE_WRITE": true,
1818
}
1919

2020
// Event is a struct that holds the information for a file event

event/event_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package event
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"log"
87
"os"
98
"testing"
@@ -98,8 +97,7 @@ func TestEvent(t *testing.T) {
9897

9998
func eventSetup(t *testing.T) *Event {
10099
path := t.TempDir()
101-
_, err := ioutil.TempFile(path, file)
102-
100+
_, err := os.CreateTemp(path, file)
103101
if err != nil {
104102
t.Fatalf("Unable to create temp file: %v", err)
105103
}

go.mod

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
module github.com/cian911/switchboard
22

3-
go 1.17
3+
go 1.23
44

55
require (
6-
github.com/fsnotify/fsnotify v1.5.1
7-
github.com/spf13/cobra v0.0.5
8-
github.com/spf13/viper v1.10.0
6+
github.com/fsnotify/fsnotify v1.7.0
7+
github.com/spf13/cobra v1.8.1
8+
github.com/spf13/viper v1.19.0
99
)
1010

1111
require (
1212
github.com/hashicorp/hcl v1.0.0 // indirect
13-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
14-
github.com/magiconair/properties v1.8.5 // indirect
15-
github.com/mitchellh/mapstructure v1.4.3 // indirect
16-
github.com/pelletier/go-toml v1.9.4 // indirect
17-
github.com/spf13/afero v1.6.0 // indirect
18-
github.com/spf13/cast v1.4.1 // indirect
19-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
13+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
14+
github.com/magiconair/properties v1.8.7 // indirect
15+
github.com/mitchellh/mapstructure v1.5.0 // indirect
16+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
17+
github.com/sagikazarmark/locafero v0.6.0 // indirect
18+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
19+
github.com/sourcegraph/conc v0.3.0 // indirect
20+
github.com/spf13/afero v1.11.0 // indirect
21+
github.com/spf13/cast v1.7.0 // indirect
2022
github.com/spf13/pflag v1.0.5 // indirect
21-
github.com/subosito/gotenv v1.2.0 // indirect
22-
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
23-
golang.org/x/text v0.3.8 // indirect
24-
gopkg.in/ini.v1 v1.66.2 // indirect
25-
gopkg.in/yaml.v2 v2.4.0 // indirect
23+
github.com/subosito/gotenv v1.6.0 // indirect
24+
go.uber.org/multierr v1.11.0 // indirect
25+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
26+
golang.org/x/sys v0.24.0 // indirect
27+
golang.org/x/text v0.17.0 // indirect
28+
gopkg.in/ini.v1 v1.67.0 // indirect
29+
gopkg.in/yaml.v3 v3.0.1 // indirect
2630
)
2731

28-
replace github.com/fsnotify/fsnotify v1.5.1 => github.com/Cian911/fsnotify v1.5.2-0.20220220230351-4d6a6a3b3090
32+
replace github.com/fsnotify/fsnotify v1.7.0 => github.com/cian911/fsnotify v1.7.5

go.sum

Lines changed: 62 additions & 792 deletions
Large diffs are not rendered by default.

utils/utils.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package utils
22

33
import (
4-
"io/ioutil"
54
"log"
65
"os"
76
"path/filepath"
@@ -61,7 +60,7 @@ func ValidateFileExt(ext string) bool {
6160
// im_a_dir -> true
6261
// sample.txt -> false
6362
func ScanFilesInDir(path string) (map[string]bool, error) {
64-
files, err := ioutil.ReadDir(path)
63+
files, err := os.ReadDir(path)
6564
if err != nil {
6665
return nil, err
6766
}

utils/utils_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func TestUtils(t *testing.T) {
9898

9999
for _, tt := range tests {
100100
got, err := ScanFilesInDir(tempDir)
101-
102101
if err != nil {
103102
t.Fatalf("Could not scan files in dir: %v", err)
104103
}
@@ -165,8 +164,7 @@ func setupTempDir(name string, t *testing.T) string {
165164
}
166165

167166
func setupTempFile(name, dir string, t *testing.T) *os.File {
168-
file, err := ioutil.TempFile(dir, name)
169-
167+
file, err := os.CreateTemp(dir, name)
170168
if err != nil {
171169
t.Fatalf("Unable to create temp file: %v", err)
172170
}

watcher/helpers.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package watcher
22

33
import (
4-
"io/ioutil"
4+
"os"
55
"testing"
66
"time"
77

@@ -21,8 +21,7 @@ var (
2121
// TestEventSetup sets up a new event for testing purposes
2222
func TestEventSetup(t *testing.T) *event.Event {
2323
path := t.TempDir()
24-
_, err := ioutil.TempFile(path, HelperFile)
25-
24+
_, err := os.CreateTemp(path, HelperFile)
2625
if err != nil {
2726
t.Fatalf("Unable to create temp file: %v", err)
2827
}
@@ -38,7 +37,7 @@ func TestEventSetup(t *testing.T) *event.Event {
3837
}
3938

4039
// TestSimulateMultipleEvents takes a list of operations as args
41-
// ["CREATE", "WRITE", "CLOSEWRITE"]
40+
// ["CREATE", "WRITE", "CLOSE_WRITE"]
4241
// and returns them as a list of events
4342
func TestSimulateMultipleEvents(operationList []string, t *testing.T) []event.Event {
4443
eventList := []event.Event{}

0 commit comments

Comments
 (0)