watchConfig

package
v1.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

利用读取文件的修改时间来处理变动事件

该变更利用了Linux系统下变更文件名为原子操作来保证了安全
n, _ := addWatch(configDir + "app.toml")
for {
    select {
    case <-n:
        fmt.Println("收到了变更通知")
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWatch

func AddWatch(filePath string) (chan struct{}, error)

AddWatch 添加监控文件 返回channel便于发送通知

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL