From 289e560efdffcdbbb586493913a92a7688fe1d70 Mon Sep 17 00:00:00 2001 From: Yann Hodique Date: Fri, 28 Sep 2018 08:48:12 -0700 Subject: [PATCH] replace golang.org/x/exp/inotify with standalone library context: kubernetes/kubernetes#68478 The inotify code was removed from golang.org/x/exp several years ago. Therefore importing it from that path prevents downstream consumers from using any module that makes use of more recent features of golang.org/x/exp. Given that this code is by definition frozen and that the long term path should be to migrate to fsnotify, replacing the current code by an identical standalone copy doesn't have maintenance cost, and will unlock other activities for kubernetes for example. --- Godeps/Godeps.json | 8 ++++---- container/common/inotify_watcher.go | 2 +- manager/watcher/raw/raw.go | 2 +- utils/tail/tail.go | 2 +- vendor/github.com/sigma/go-inotify/README.md | 5 +++++ .../sigma/go-inotify}/inotify_linux.go | 0 6 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 vendor/github.com/sigma/go-inotify/README.md rename vendor/{golang.org/x/exp/inotify => github.com/sigma/go-inotify}/inotify_linux.go (100%) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index db507074..99babe97 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -763,6 +763,10 @@ "ImportPath": "github.com/seccomp/libseccomp-golang", "Rev": "1b506fc7c24eec5a3693cdcbed40d9c226cfc6a1" }, + { + "ImportPath": "github.com/sigma/go-inotify", + "Rev": "6e160422f7699ab1472cc86362da4f009a7efc60" + }, { "ImportPath": "github.com/sirupsen/logrus", "Comment": "v1.0.3-11-g89742ae", @@ -803,10 +807,6 @@ "ImportPath": "golang.org/x/crypto/ssh/terminal", "Rev": "eb71ad9bd329b5ac0fd0148dd99bd62e8be8e035" }, - { - "ImportPath": "golang.org/x/exp/inotify", - "Rev": "292a51b8d262487dab23a588950e8052d63d9113" - }, { "ImportPath": "golang.org/x/net/context", "Rev": "7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6" diff --git a/container/common/inotify_watcher.go b/container/common/inotify_watcher.go index 16e2f2c9..318c7881 100644 --- a/container/common/inotify_watcher.go +++ b/container/common/inotify_watcher.go @@ -17,7 +17,7 @@ package common import ( "sync" - "golang.org/x/exp/inotify" + inotify "github.com/sigma/go-inotify" ) // Watcher for container-related inotify events in the cgroup hierarchy. diff --git a/manager/watcher/raw/raw.go b/manager/watcher/raw/raw.go index 5bf12829..fa3e5477 100644 --- a/manager/watcher/raw/raw.go +++ b/manager/watcher/raw/raw.go @@ -26,9 +26,9 @@ import ( "github.com/google/cadvisor/container/common" "github.com/google/cadvisor/container/libcontainer" "github.com/google/cadvisor/manager/watcher" + inotify "github.com/sigma/go-inotify" "github.com/golang/glog" - "golang.org/x/exp/inotify" ) type rawContainerWatcher struct { diff --git a/utils/tail/tail.go b/utils/tail/tail.go index 88c7f72b..ca62fe69 100644 --- a/utils/tail/tail.go +++ b/utils/tail/tail.go @@ -25,7 +25,7 @@ import ( "time" "github.com/golang/glog" - "golang.org/x/exp/inotify" + inotify "github.com/sigma/go-inotify" ) type Tail struct { diff --git a/vendor/github.com/sigma/go-inotify/README.md b/vendor/github.com/sigma/go-inotify/README.md new file mode 100644 index 00000000..0c723a8d --- /dev/null +++ b/vendor/github.com/sigma/go-inotify/README.md @@ -0,0 +1,5 @@ +This is a fork of golang.org/x/exp/inotify before it was deleted. + +Please use gopkg.in/fsnotify.v0 instead. + +For updates, see: https://fsnotify.org/ diff --git a/vendor/golang.org/x/exp/inotify/inotify_linux.go b/vendor/github.com/sigma/go-inotify/inotify_linux.go similarity index 100% rename from vendor/golang.org/x/exp/inotify/inotify_linux.go rename to vendor/github.com/sigma/go-inotify/inotify_linux.go