Git Product home page Git Product logo

Comments (4)

dengsgo avatar dengsgo commented on May 28, 2024

贴一下你的 filegirl.yaml 配置

from fileboy.

Jalins avatar Jalins commented on May 28, 2024

贴一下你的 filegirl.yaml 配置
就是使用默认生成的,只是将exec中的命令改为go run main.go,其他的没动
// 主配置
core:
# 配置版本号
version: 1

// 监控配置
monitor:
# 要监听的目录
# test1 监听当前目录下 test1 目录
# test1/test2 监听当前目录下 test1/test2 目录
# test1,* 监听当前目录下 test1 目录及其所有子目录(递归)
# .,* 监听当前目录及其所有子目录(递归)
includeDirs:
- .,*

// 不监听的目录
// .idea   忽略.idea目录及其所有子目录的监听
exceptDirs:
    - .idea
    - .git
    - .vscode
    - node_modules
    - vendor

# 监听文件的格式,此类文件更改会执行 command 中的命令
# .go   后缀为 .go 的文件更改,会执行 command 中的命令
# .*    所有的文件更改都会执行 command 中的命令
types:
    - .go

// 命令
command:
# 监听的文件有更改会执行的命令
# 可以有多条命令,会依次执行
# 如有多条命令,每条命令都会等待上一条命令执行完毕后才会执行
# 如遇交互式命令,允许外部获取输入
# 支持变量占位符,运行命令时会替换成实际值:
# {{file}} 文件名(如 a.txt 、test/test2/a.go)
# {{ext}} 文件后缀(如 .go)
# {{changed}} 文件更新的本地时间戳(纳秒,如 1537326690523046400)
# 变量占位符使用示例:cp {{file}} /root/sync -rf 、 myCommand --{{ext}} {{changed}}
exec:
- go run main.go
// - go env

# 文件变更后命令在xx毫秒后才会执行,单位为毫秒
# 一个变更事件(A)如果在定义的延迟时间(t)内,又有新的文件变更事件(B),那么A会取消执行。
# B及以后的事件均依次类推,直到事件Z在t内没有新事件产生,Z 会执行
# 合理设置延迟时间,将有效减少冗余和重复任务的执行
# 如果不需要该特性,设置为 0
delayMillSecond: 2000

// 通知器
notifier:
# 文件更改会向该 url 发送请求(POST 一段 json 文本数据)
# 触发请求的时机和执行 command 命令是一致的
# 请求超时 15 秒
# POST 格式:
# Content-Type: application/json;charset=UTF-8
# User-Agent: FileBoy Net Notifier v1.10
# Body: {"project_folder":"/watcher-dirs","file":"test.go","changed":1546421173070433800,"ext":".go"}
# 例: http://example.com/notifier/fileboy-listener
# 不启用通知,请留空 ""
callUrl: ""

from fileboy.

dengsgo avatar dengsgo commented on May 28, 2024

如果你是开发 gin 应用, go run main.go是会有你说的这个问题。原因是 go run 会自动编译和运行,你的gin 应用实际上是由 go run 运行的,当代码有更新再次运行 go run main.go 时,fileboy 只能感知到 go run 进程的存在,没办法 kill 掉实际的 gin 进程。
建议修改 command -> exec 如下:

- go build
- ./server 

./server 改成你实际编译出来的文件名就可以了。

from fileboy.

Jalins avatar Jalins commented on May 28, 2024

如果你是开发 gin 应用, go run main.go是会有你说的这个问题。原因是 go run 会自动编译和运行,你的gin 应用实际上是由 go run 运行的,当代码有更新再次运行 go run main.go 时,fileboy 只能感知到 go run 进程的存在,没办法 kill 掉实际的 gin 进程。
建议修改 command -> exec 如下:

- go build
- ./server 

./server 改成你实际编译出来的文件名就可以了。

好的,感谢

from fileboy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.