Skip to content

Commit 646627b

Browse files
authored
Upgraded fsnotify to 1.8.0 (#6)
- upgraded fsnotify - converted the project to a Go module - removed irrelevant command
1 parent 9d1d9f7 commit 646627b

File tree

239 files changed

+45
-114337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+45
-114337
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/bin
22
/pkg
33
api-gateway-config-supervisor
4+
/vendor

Godeps/Godeps.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

Godeps/Readme

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ GOBIN ?= `pwd`/bin
33
GOOS ?= $(`uname -a | awk '{print tolower($1)}'`)
44
.PHONY: setup install test format static docker docker-ssh
55
6-
setup:
7-
go get github.com/tools/godep
8-
9-
install:
10-
@go version
11-
# export GO15VENDOREXPERIMENT=1
12-
# GOPATH=$(GOPATH) GOBIN=$(GOBIN) go install -v ./...
13-
GOPATH=$(GOPATH) GOBIN=$(GOBIN) $(GOPATH)/bin/godep go install -v ./...
14-
156
test:
167
go test
178

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,17 @@ api-gateway-config-supervisor \
5353
Dependencies
5454
============
5555

56-
* https://github.com/tools/godep
56+
* Golang
5757
* https://gowalker.org/github.com/ncw/rclone
58-
* gopkg.in/fsnotify.v1
59-
* TBD
6058

6159
Developer guide
6260
===============
6361

64-
Make sure you have go 1.5.1+ installed. On a Mac you can execute:
62+
Make sure you have go installed. On a Mac you can execute:
6563
```
6664
brew install go
6765
```
6866

69-
The go dependencies have been already added using `godeps` in the existing GitRepo in order to achieve repeatable builds and isolated envs.
70-
To build the project you can run:
71-
72-
```
73-
make install
74-
```
75-
7667
To run the unit tests run:
7768

7869
```

config-supervisor_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ func TestThatReloadCommandExecutesWhenNewFolderIsAdded(t *testing.T) {
150150
// wait for some time
151151
time.Sleep(500 * time.Millisecond)
152152

153+
startTime := time.Now()
154+
153155
//modifyFS: create a new directory and file
154156
dir, err := ioutil.TempDir(tmpDir, "new-folder-")
155157
if err != nil {
@@ -165,20 +167,20 @@ func TestThatReloadCommandExecutesWhenNewFolderIsAdded(t *testing.T) {
165167
time.Sleep(1000 * time.Millisecond)
166168

167169
status = sync.GetStatusInstance()
168-
// check that reload cmd has been executed
169-
if time.Since(status.LastSync).Seconds() > 1 {
170-
t.Fatal("sync should have executed earlier than 1.5 but was executed " + time.Since(status.LastSync).String())
170+
171+
if status.LastSync.Before(startTime) {
172+
t.Fatalf("sync has not been executed since FS changes triggered at %s. Last sync time: %s", startTime, status.LastSync)
171173
}
172-
if time.Since(status.LastReload).Seconds() > 1 {
173-
t.Fatal("reload should have executed earlier than 1.5s but was executed " + time.Since(status.LastReload).String())
174+
if status.LastReload.Before(startTime) {
175+
t.Fatalf("reload has not been executed since FS changes triggered at %s. Last reload time: %s", startTime, status.LastReload)
174176
}
175-
if time.Since(status.LastFSChangeDetected).Seconds() > 1 {
176-
t.Fatal("FS changes should have been detected earlier than 1.5s but was detected " + time.Since(status.LastFSChangeDetected).String())
177+
if status.LastFSChangeDetected.Before(startTime) {
178+
t.Fatalf("FS changes have not been detected since FS changes triggered at %s. Last FS change detected at %s", startTime, status.LastFSChangeDetected)
177179
}
178180

179181
// check that the reload_cmd.txt file was created when the reload command executed
180182
if _, err := os.Stat(tmpDir + "/reload_cmd.txt"); err != nil {
181-
t.Fatal("Expected to find the file created by the reload command " + tmpDir + "/reload_cmd.txt")
183+
t.Fatalf("Expected to find the file created by the reload command " + tmpDir + "/reload_cmd.txt")
182184
}
183185

184186
//delete the tmp file and the TempDir

go.mod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module github.com/adobe-apiplatform/api-gateway-config-supervisor
2+
3+
go 1.20
4+
5+
require (
6+
github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82
7+
github.com/fsnotify/fsnotify v1.8.0
8+
github.com/koyachi/go-term-ansicolor v0.0.0-20130114081603-6f81280f9360
9+
github.com/spf13/pflag v1.0.5
10+
)
11+
12+
require (
13+
github.com/stretchr/testify v1.10.0 // indirect
14+
golang.org/x/sys v0.13.0 // indirect
15+
)

go.sum

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 h1:9bAydALqAjBfPHd/eAiJBHnMZUYov8m2PkXVr+YGQeI=
2+
github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82/go.mod h1:tyA14J0sA3Hph4dt+AfCjPrYR13+vVodshQSM7km9qw=
3+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4+
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
5+
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
6+
github.com/koyachi/go-term-ansicolor v0.0.0-20130114081603-6f81280f9360 h1:RAav20p/CzLXPs8DxPry4eM4YuTooJ1d6ctCmXjpaA8=
7+
github.com/koyachi/go-term-ansicolor v0.0.0-20130114081603-6f81280f9360/go.mod h1:zUllqwUpvIS0pyapVJDiHwwEkmaV9qeCR9+sh5MPdRs=
8+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
9+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
10+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
11+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
12+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
13+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
14+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

sync/recursiveWatcher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"path/filepath"
99
"strings"
1010

11+
"github.com/fsnotify/fsnotify"
1112
"github.com/koyachi/go-term-ansicolor/ansicolor"
12-
"gopkg.in/fsnotify.v1"
1313
)
1414

1515
type RecursiveWatcher struct {
@@ -37,6 +37,7 @@ func NewRecursiveWatcher(path string) (*RecursiveWatcher, error) {
3737
if err != nil {
3838
return nil, err
3939
}
40+
4041
rw := &RecursiveWatcher{fsw: watcher}
4142

4243
rw.Files = make(chan string, 10)

vendor/github.com/carlescere/scheduler/.gitignore

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)