What happened to os/fsnotify?

agolangf · · 980 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>In the past, there was supposed to be an <code>os/fsnotify</code> package to watch the filesystem for changes. This was supposed to be introduced in Go 1.3 but got pushed back. Is it still supposed to be added at some point in the future? The <a href="https://github.com/go-fsnotify/fsnotify">GitHub page</a> for the candidate package hasn&#39;t seen a commit in 3 months and has 41 open issues.</p> <hr/>**评论:**<br/><br/>nyoungman: <pre><p>I apologize. As you can see, I haven&#39;t been doing a good job of maintaining the candidate package as of late.</p> <p>Right now it isn&#39;t in a state that could be included in the standard library. The code needs to cleaned up and brought up to standard, particularly the Windows code is a bit of a mess right now. There is also a bunch of research that needs to be done to determine how to best incorporate additional file watching adapters, such as fsevents on OS X (which has a separate repo under go-fsnotify).</p> <p>Anyone who wants to be involved in the project is welcome to come help out. See <a href="https://github.com/go-fsnotify/fsnotify/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a> to get started.</p></pre>ergotayours: <pre><p>I&#39;d love to look around and see if there&#39;s anything I can help with!</p></pre>maruwan: <pre><p>According to <a href="https://fsnotify.org/">https://fsnotify.org/</a> you are correct.</p> <p>For now I&#39;ve been using <a href="https://godoc.org/gopkg.in/fsnotify.v1">https://godoc.org/gopkg.in/fsnotify.v1</a></p></pre>jeffrallen: <pre><p><a href="https://godoc.org/golang.org/x/exp" rel="nofollow">https://godoc.org/golang.org/x/exp</a> has packages inotify and winfsnotify in it. Does that help you out?</p></pre>nyoungman: <pre><p>fsnotify is actually based on those libraries. If you are curious about the history of the project, there is an <a href="https://fsnotify.org/history/" rel="nofollow">article on the blog</a>.</p> <p>That said, splitting fsnotify back out into independent libraries with a thin cross-platform wrapper may make contribution easier. Something worth considering.</p></pre>ergotayours: <pre><p>That&#39;s cool, thanks. Unfortunately, I need a cross-platform library. Limiting support to Linux and Windows might be okay, but unless Go has some way of detecting the runtime OS programmatically, there&#39;s no way I could combine these two packages.</p></pre>ejayben: <pre><p>you could always write an interface to wrap two different implementations and use an environment variable to bootstrap the correct one at runtime (i.e. could GOOS work?).</p> <p>saying that there is simply &#34;no way&#34; is a bit of a cop out. implementing a generic solution that covers two wildly different FS implementations is hard enough, but you actually want 3? then get to work!</p></pre>ergotayours: <pre><p>I actually realized I could use conditional compilation and have a file with the OS-specific code for Linux, and one for Windows. A further problem is that winfsnotify hasn&#39;t seen commits for 8 months. I think I&#39;m going to try to contribute to fsnotify.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

980 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传