Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live rebuild when manifest/config/config.yaml changed #2822

Closed
windvalley opened this issue Aug 1, 2023 · 2 comments · Fixed by #3009
Closed

Live rebuild when manifest/config/config.yaml changed #2822

windvalley opened this issue Aug 1, 2023 · 2 comments · Fixed by #3009

Comments

@windvalley
Copy link
Contributor

windvalley commented Aug 1, 2023

1. What version of Go and system type/arch are you using?

go version go1.20.4 darwin/amd64

2. What version of GoFrame are you using?

GoFrame CLI Tool v2.5.1, https://goframe.org
GoFrame Version: v2.5.1 in current go.mod

3. Can this issue be re-produced with the latest release?

yes

4. What did you do?

$ gf run main.go

然后修改manifest/config/config.yaml文件.

5. What did you expect to see?

希望 gf run main.go 能自动rebuild

6. What did you see instead?

gf run main.go 没有自动rebuild.

看源码, 目前只是针对go文件的变动才会自动rebuild, 不过在实际开发中, 开发环境配置文件可能会是要频繁变动的, 这样每次都需要重新运行 gf run main.go, 比较麻烦, 是否考虑增加配置文件变动的场景也能自动rebuild的功能. 如果可以的话, 我提个pr, 感谢~

ps: 后续又测了一下, 配置文件有热更新功能, 不过貌似仅对自定义的配置生效, 对框架原生相关的配置项调整没有效果, 所以考虑到gf run main.go仅是在开发环境使用, 加一个配置文件变化自动rebuild的特性, 应该可以接受.

@gqcn
Copy link
Member

gqcn commented Oct 7, 2023

@windvalley 可以给gf run命令增加一个参数,控制额外监听的文件路径下的对应类型文件变化。例如,输入参数比如manifest/config/*.yaml, 欢迎pr
image

@github-actions
Copy link

github-actions bot commented Oct 7, 2023

Hello @windvalley. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @windvalley。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

windvalley added a commit to windvalley/gf that referenced this issue Oct 10, 2023
Live reload supports files specified using the "-w" parameter in addition to Go files.

Usage Example:

1) Watch one file
$ gf run main.go -w manifest/config/config.yaml

2) Watch multiple files, seprated by commas
$ gf run main.go -w manifest/config/config.yaml,otherpath/otherfile

Fixes gogf#2822
windvalley added a commit to windvalley/gf that referenced this issue Oct 10, 2023
Live reload supports files specified using the "-w/--watchPaths" parameter in addition to Go files.

Help message for `gf run -w`:

```text
    -w, --watchPaths   watch additional paths for live reload, separated by ",". i.e. "manifest/config/*.yaml"
```

Usage Example:

1) Watch one file
$ gf run main.go -w manifest/config/config.yaml

2) Watch multiple files, seprated by commas
$ gf run main.go -w manifest/config/config.yaml,otherpath/otherfile

3) Watch wildcard file
$ gf run main.go -w "manifest/config/*.yaml"

Fixes gogf#2822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants