Closed douchen1 closed 12 months ago
👋 Thanks for reporting!
A maintainer will take a look at your issue shortly. 👀
In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.
⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9
📣 If you've already given us your feedback, you can still help by spreading the news, either by sharing the above link or telling people about this on Twitter:
https://twitter.com/sagikazarmark/status/1306904078967074816
Thank you! ❤️
My understanding is fsnotify does not work on FreeBSD. If that's not the case, we can probably adjust the build tags guarding against runtime errors: https://github.com/spf13/viper/blob/master/watch_unsupported.go
fmt.Errorf("fsnotify not supported on %s", runtime.GOOS)
Didn't see such error printout during testing. In fact, fsnotify do support FreeBSD https://github.com/fsnotify/fsnotify/blob/v1.6.0/backend_kqueue.go#L2
In early release of viper(v1.7.2-0.20201211163600-99da8b22a1c0), there's no issue running on FreeBSD10/FreeBSD11. The only difference of fsnotify.NewWatcher()
used by different versions of viper(v1.7.2 and v1.16.0) is that, in newer version, we have closepipe
as part of the watcher struct.
Okay, I took a closer look. I probably spoke too soon, looks like FreeBSD is indeed supported by fsnotify.
I've been trying to figure out where this part of the error message comes: "function not implemented", but it's not Viper and apparently not fsnotify either.
A quick Google search led me to the following issue: golang/go#58914
Looks like FreeBSD 10 is not supported in Go 1.19. 11 should still be supported though: https://github.com/golang/go/wiki/FreeBSD#go-on-freebsd
Sadly I don't have a FreeBSD setup, so I can't really test it myself, but it looks like FreeBSD 10 is not supported anymore anyway (or something in the new fsnotify version uses a feature unsupported on it), FreeBSD 11 support is dropped after Go 1.19.
Viper tries to follow the Go support policy (although not strictly) that we support the last two Go versions, so chances are support for anything before 1.20 will be dropped at some point.
I'm sorry I don't have a better answer at this time.
Yes, I also found the same issue and wiki. However, I did test on FreeBSD 11 and it didn't work. Not sure if the GO wiki is out-of date or sth. So seems like the only solution now is to use FreeBSD13 instead of the older versions. Anyway, thanks for all the assistances.
@douchen1 sure, sorry I couldn't be of more help. The above linked issue also mentions that the FreeBSD wiki might be out of date.
Preflight Checklist
Viper Version
1.16.0
Go Version
1.19.7
Config Source
Files
Format
TOML
Repl.it link
No response
Code reproducing the issue
Expected Behavior
2023/01/01 00:00:00 Using config file: //config.toml
2023/01/01 00:00:00 Done testing
Actual Behavior
2023/01/01 00:00:00 Using config file: //config.toml
ERROR 2023/01/01 00:00:00 failed to create watcher: function not implemented
Steps To Reproduce
env GOOS=freebsd GOARCH=amd64 go build -o <name>
config.toml
file in the same level of the compiled binary.Additional Information
viper.WatchConfig()
internally usesfsnotify
, which communicates with Kernel to create Kernel Queues. That's where we observe backward incompatibility. It works fine in FreeBSD13, but fail at FreeBSD10 and FreeBSD11.