Skip to contentSkip to conversation

tun: make operateonfd.go build tags more specific

PATCH Applied Tobias Klauser 2 participants 3 messages Sep 23, 2021 – Sep 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun: make operateonfd.go build tags more specific

(*NativeTun).operateOnFd is only used on darwin and freebsd. Adjust the build tags accordingly.

---
 tun/operateonfd.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tun/operateonfd.go +2 -2
index aab71161f27c..bc804539169f 100644
@@ -1,5 +1,5 @@
-//go:build !windows
-// +build !windows
+//go:build darwin || freebsd
+// +build darwin freebsd
 
 /* SPDX-License-Identifier: MIT
  *
Signature · 1 line
2.33.0
#1 lore raw

I've applied this. Thanks for the patch. Though I do wonder: it's functionally the same as before, right? What instances lead to this being an issue? Or did this way just seem more correct?

#2 lore raw
Quoted 3 lines · Jason A. Donenfeld

I've applied this. Thanks for the patch. Though I do wonder: it's functionally the same as before, right? What instances lead to this being an issue? Or did this way just seem more correct?

Thanks. Functionally it's the same, yes. I noticed this when running staticcheck against wireguard-go on Linux and it reported (*NativeTun).operateOnFd as being defined but not used. So it just seemed more correct to only define it for platforms that actually use it.