From a5da4ed9812aaf3c0dabfbbb45a8dba14f7b347d Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 5 Aug 2021 15:42:39 -0700 Subject: [PATCH] all: gofmt with Go 1.17 This adds "//go:build" lines and tidies up existing "// +build" lines. Signed-off-by: Josh Bleecher Snyder --- cmd/tailscale/cli/diag.go | 1 + cmd/tailscale/cli/diag_other.go | 1 + cmd/tailscaled/tailscaled_notwindows.go | 1 + cmd/tsshd/tsshd.go | 1 + cmd/tsshd/tsshd_windows.go | 1 + control/controlclient/hostinfo_linux.go | 1 + control/controlclient/sign_supported.go | 1 + control/controlclient/sign_unsupported.go | 1 + disco/disco_fuzzer.go | 1 + ipn/ipnlocal/peerapi_macios_ext.go | 1 + logtail/filch/filch_unix.go | 3 ++- net/dns/debian_resolvconf.go | 1 + net/dns/ini.go | 1 + net/dns/ini_test.go | 1 + net/dns/manager_default.go | 1 + net/dns/nm.go | 1 + net/dns/openresolv.go | 1 + net/dns/resolvconf.go | 1 + net/dns/resolved.go | 1 + net/dns/resolver/macios_ext.go | 1 + net/dns/resolver/neterr_other.go | 1 + net/dnsfallback/update-dns-fallbacks.go | 1 + net/interfaces/interfaces_default_route_test.go | 1 + net/interfaces/interfaces_defaultrouteif_todo.go | 1 + net/netns/netns_android.go | 1 + net/netns/netns_darwin_tailscaled.go | 1 + net/netns/netns_default.go | 1 + net/netns/netns_linux.go | 1 + net/netns/netns_macios.go | 1 + net/netns/socks.go | 1 + net/netstat/netstat_noimpl.go | 1 + net/portmapper/disabled_stubs.go | 2 ++ net/portmapper/upnp.go | 2 ++ net/stun/stun_fuzzer.go | 1 + net/tshttpproxy/tshttpproxy_future.go | 1 + net/tstun/ifstatus_noop.go | 1 + net/tstun/tap_unsupported.go | 1 + net/tstun/tun_notwindows.go | 1 + paths/paths_unix.go | 1 + portlist/netstat.go | 1 + portlist/netstat_exec.go | 1 + portlist/portlist_ios.go | 1 + portlist/portlist_macos.go | 1 + portlist/portlist_other.go | 1 + safesocket/unixsocket.go | 1 + syncs/locked.go | 1 + syncs/locked_test.go | 1 + tempfork/wireguard-windows/firewall/blocker.go | 1 + tempfork/wireguard-windows/firewall/helpers.go | 1 + tempfork/wireguard-windows/firewall/rules.go | 1 + tempfork/wireguard-windows/firewall/types_windows.go | 1 + tempfork/wireguard-windows/firewall/types_windows_32.go | 1 + tempfork/wireguard-windows/firewall/types_windows_64.go | 1 + tempfork/wireguard-windows/firewall/types_windows_test.go | 1 + tstest/integration/gen_deps.go | 1 + tstest/integration/vms/derive_bindhost_test.go | 1 + tstest/integration/vms/distros_test.go | 1 + tstest/integration/vms/harness_test.go | 1 + tstest/integration/vms/nixos_test.go | 1 + tstest/integration/vms/opensuse_leap_15_1_test.go | 1 + tstest/integration/vms/top_level_test.go | 1 + tstest/integration/vms/udp_tester.go | 1 + tstest/integration/vms/vm_setup_test.go | 1 + tstest/integration/vms/vms_steps_test.go | 1 + tstest/integration/vms/vms_test.go | 1 + types/logger/rusage_nowindows.go | 1 + util/deephash/mapiter.go | 1 + util/deephash/mapiter_future.go | 1 + util/endian/big.go | 1 + util/endian/little.go | 1 + util/groupmember/groupmember_cgo.go | 1 + util/groupmember/groupmember_noimpl.go | 1 + util/groupmember/groupmember_notcgo.go | 1 + util/osshare/filesharingstatus_noop.go | 1 + util/osshare/filesharingstatus_windows.go | 1 + util/pidowner/pidowner_noimpl.go | 1 + util/racebuild/off.go | 1 + util/racebuild/on.go | 1 + util/systemd/systemd_linux.go | 1 + util/systemd/systemd_nonlinux.go | 1 + util/winutil/winutil.go | 1 + util/winutil/winutil_notwindows.go | 1 + version/cmdname.go | 1 + version/cmdname_ios.go | 1 + version/race.go | 1 + version/race_off.go | 1 + wgengine/monitor/monitor_linux.go | 1 + wgengine/monitor/monitor_polling.go | 1 + wgengine/monitor/polling.go | 3 ++- wgengine/router/router_default.go | 1 + wgengine/router/router_test.go | 1 + wgengine/router/router_userspace_bsd.go | 1 + wgengine/router/runner.go | 1 + 93 files changed, 97 insertions(+), 2 deletions(-) diff --git a/cmd/tailscale/cli/diag.go b/cmd/tailscale/cli/diag.go index 253c8e875..10b302c83 100644 --- a/cmd/tailscale/cli/diag.go +++ b/cmd/tailscale/cli/diag.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || windows || darwin // +build linux windows darwin package cli diff --git a/cmd/tailscale/cli/diag_other.go b/cmd/tailscale/cli/diag_other.go index bc67cbeee..a3e06564a 100644 --- a/cmd/tailscale/cli/diag_other.go +++ b/cmd/tailscale/cli/diag_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux && !windows && !darwin // +build !linux,!windows,!darwin package cli diff --git a/cmd/tailscaled/tailscaled_notwindows.go b/cmd/tailscaled/tailscaled_notwindows.go index 58221a2ea..3e5855d77 100644 --- a/cmd/tailscaled/tailscaled_notwindows.go +++ b/cmd/tailscaled/tailscaled_notwindows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package main // import "tailscale.com/cmd/tailscaled" diff --git a/cmd/tsshd/tsshd.go b/cmd/tsshd/tsshd.go index c2aa9e1af..9752dcabf 100644 --- a/cmd/tsshd/tsshd.go +++ b/cmd/tsshd/tsshd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows // The tsshd binary is an SSH server that accepts connections diff --git a/cmd/tsshd/tsshd_windows.go b/cmd/tsshd/tsshd_windows.go index 6ab8aac67..1a81ed085 100644 --- a/cmd/tsshd/tsshd_windows.go +++ b/cmd/tsshd/tsshd_windows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package main diff --git a/control/controlclient/hostinfo_linux.go b/control/controlclient/hostinfo_linux.go index 31f2d503e..9b1ceb4e2 100644 --- a/control/controlclient/hostinfo_linux.go +++ b/control/controlclient/hostinfo_linux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && !android // +build linux,!android package controlclient diff --git a/control/controlclient/sign_supported.go b/control/controlclient/sign_supported.go index 61a23bee4..bb6a38f25 100644 --- a/control/controlclient/sign_supported.go +++ b/control/controlclient/sign_supported.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows && cgo // +build windows,cgo // darwin,cgo is also supported by certstore but machineCertificateSubject will diff --git a/control/controlclient/sign_unsupported.go b/control/controlclient/sign_unsupported.go index e20ced316..af3397ccd 100644 --- a/control/controlclient/sign_unsupported.go +++ b/control/controlclient/sign_unsupported.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows || !cgo // +build !windows !cgo package controlclient diff --git a/disco/disco_fuzzer.go b/disco/disco_fuzzer.go index 38d57a2a4..62036bfc6 100644 --- a/disco/disco_fuzzer.go +++ b/disco/disco_fuzzer.go @@ -1,6 +1,7 @@ // Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gofuzz // +build gofuzz package disco diff --git a/ipn/ipnlocal/peerapi_macios_ext.go b/ipn/ipnlocal/peerapi_macios_ext.go index 24568aeba..497bebe71 100644 --- a/ipn/ipnlocal/peerapi_macios_ext.go +++ b/ipn/ipnlocal/peerapi_macios_ext.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin && ts_macext) || (ios && ts_macext) // +build darwin,ts_macext ios,ts_macext package ipnlocal diff --git a/logtail/filch/filch_unix.go b/logtail/filch/filch_unix.go index a1e081add..4bd6b2cd4 100644 --- a/logtail/filch/filch_unix.go +++ b/logtail/filch/filch_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//+build !windows +//go:build !windows +// +build !windows package filch diff --git a/net/dns/debian_resolvconf.go b/net/dns/debian_resolvconf.go index 78debd3cd..ab9a7cf79 100644 --- a/net/dns/debian_resolvconf.go +++ b/net/dns/debian_resolvconf.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || freebsd || openbsd // +build linux freebsd openbsd package dns diff --git a/net/dns/ini.go b/net/dns/ini.go index 4e270d4bd..af852f5a7 100644 --- a/net/dns/ini.go +++ b/net/dns/ini.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package dns diff --git a/net/dns/ini_test.go b/net/dns/ini_test.go index 8236f5f48..e14ffdad0 100644 --- a/net/dns/ini_test.go +++ b/net/dns/ini_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package dns diff --git a/net/dns/manager_default.go b/net/dns/manager_default.go index 4bc53ffd6..5c3eeac67 100644 --- a/net/dns/manager_default.go +++ b/net/dns/manager_default.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux && !freebsd && !openbsd && !windows // +build !linux,!freebsd,!openbsd,!windows package dns diff --git a/net/dns/nm.go b/net/dns/nm.go index 6130afaa1..5733098d2 100644 --- a/net/dns/nm.go +++ b/net/dns/nm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package dns diff --git a/net/dns/openresolv.go b/net/dns/openresolv.go index 602f20557..13b72438f 100644 --- a/net/dns/openresolv.go +++ b/net/dns/openresolv.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || freebsd || openbsd // +build linux freebsd openbsd package dns diff --git a/net/dns/resolvconf.go b/net/dns/resolvconf.go index 524385784..48cdb0b90 100644 --- a/net/dns/resolvconf.go +++ b/net/dns/resolvconf.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || freebsd || openbsd // +build linux freebsd openbsd package dns diff --git a/net/dns/resolved.go b/net/dns/resolved.go index 9719e825a..234258f4f 100644 --- a/net/dns/resolved.go +++ b/net/dns/resolved.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package dns diff --git a/net/dns/resolver/macios_ext.go b/net/dns/resolver/macios_ext.go index b19dcdeb8..9532d65b2 100644 --- a/net/dns/resolver/macios_ext.go +++ b/net/dns/resolver/macios_ext.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin && ts_macext) || (ios && ts_macext) // +build darwin,ts_macext ios,ts_macext package resolver diff --git a/net/dns/resolver/neterr_other.go b/net/dns/resolver/neterr_other.go index 6d8d17df6..e9d701711 100644 --- a/net/dns/resolver/neterr_other.go +++ b/net/dns/resolver/neterr_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !darwin && !windows // +build !darwin,!windows package resolver diff --git a/net/dnsfallback/update-dns-fallbacks.go b/net/dnsfallback/update-dns-fallbacks.go index c24d967bd..db50118aa 100644 --- a/net/dnsfallback/update-dns-fallbacks.go +++ b/net/dnsfallback/update-dns-fallbacks.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ignore // +build ignore package main diff --git a/net/interfaces/interfaces_default_route_test.go b/net/interfaces/interfaces_default_route_test.go index b8b2a3558..05be6373b 100644 --- a/net/interfaces/interfaces_default_route_test.go +++ b/net/interfaces/interfaces_default_route_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || (darwin && !ts_macext) // +build linux darwin,!ts_macext package interfaces diff --git a/net/interfaces/interfaces_defaultrouteif_todo.go b/net/interfaces/interfaces_defaultrouteif_todo.go index 7e1c33af4..0815e4f40 100644 --- a/net/interfaces/interfaces_defaultrouteif_todo.go +++ b/net/interfaces/interfaces_defaultrouteif_todo.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux && !windows && !darwin // +build !linux,!windows,!darwin package interfaces diff --git a/net/netns/netns_android.go b/net/netns/netns_android.go index 818c872e4..6fbc3e377 100644 --- a/net/netns/netns_android.go +++ b/net/netns/netns_android.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build android // +build android package netns diff --git a/net/netns/netns_darwin_tailscaled.go b/net/netns/netns_darwin_tailscaled.go index 268f19558..cc2b74c68 100644 --- a/net/netns/netns_darwin_tailscaled.go +++ b/net/netns/netns_darwin_tailscaled.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && !ts_macext // +build darwin,!ts_macext package netns diff --git a/net/netns/netns_default.go b/net/netns/netns_default.go index e0714d026..825027f2f 100644 --- a/net/netns/netns_default.go +++ b/net/netns/netns_default.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (!linux && !windows && !darwin) || (darwin && ts_macext) // +build !linux,!windows,!darwin darwin,ts_macext package netns diff --git a/net/netns/netns_linux.go b/net/netns/netns_linux.go index c12d000e8..05f9313d9 100644 --- a/net/netns/netns_linux.go +++ b/net/netns/netns_linux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && !android // +build linux,!android package netns diff --git a/net/netns/netns_macios.go b/net/netns/netns_macios.go index e1baf4a2d..8b40a6859 100644 --- a/net/netns/netns_macios.go +++ b/net/netns/netns_macios.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || ios // +build darwin ios package netns diff --git a/net/netns/socks.go b/net/netns/socks.go index f1c19f259..e2f7f19fd 100644 --- a/net/netns/socks.go +++ b/net/netns/socks.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !ios // +build !ios package netns diff --git a/net/netstat/netstat_noimpl.go b/net/netstat/netstat_noimpl.go index 65732f0d7..d8bbd6b2c 100644 --- a/net/netstat/netstat_noimpl.go +++ b/net/netstat/netstat_noimpl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package netstat diff --git a/net/portmapper/disabled_stubs.go b/net/portmapper/disabled_stubs.go index 438be0111..641422acc 100644 --- a/net/portmapper/disabled_stubs.go +++ b/net/portmapper/disabled_stubs.go @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ios // +build ios + // (https://github.com/tailscale/tailscale/issues/2495) package portmapper diff --git a/net/portmapper/upnp.go b/net/portmapper/upnp.go index 3e7aba4e1..e07f91f7b 100644 --- a/net/portmapper/upnp.go +++ b/net/portmapper/upnp.go @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !ios // +build !ios + // (https://github.com/tailscale/tailscale/issues/2495) package portmapper diff --git a/net/stun/stun_fuzzer.go b/net/stun/stun_fuzzer.go index 0c133df33..a12a03ad4 100644 --- a/net/stun/stun_fuzzer.go +++ b/net/stun/stun_fuzzer.go @@ -1,6 +1,7 @@ // Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gofuzz // +build gofuzz package stun diff --git a/net/tshttpproxy/tshttpproxy_future.go b/net/tshttpproxy/tshttpproxy_future.go index 2174f4f34..9d9b37cb9 100644 --- a/net/tshttpproxy/tshttpproxy_future.go +++ b/net/tshttpproxy/tshttpproxy_future.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build tailscale_go // +build tailscale_go // We want to use https://github.com/golang/go/issues/41048 but it's only in the diff --git a/net/tstun/ifstatus_noop.go b/net/tstun/ifstatus_noop.go index 43795abcb..e00f81098 100644 --- a/net/tstun/ifstatus_noop.go +++ b/net/tstun/ifstatus_noop.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package tstun diff --git a/net/tstun/tap_unsupported.go b/net/tstun/tap_unsupported.go index af50ad9d7..5c6da1310 100644 --- a/net/tstun/tap_unsupported.go +++ b/net/tstun/tap_unsupported.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package tstun diff --git a/net/tstun/tun_notwindows.go b/net/tstun/tun_notwindows.go index ab071cf64..90cc56007 100644 --- a/net/tstun/tun_notwindows.go +++ b/net/tstun/tun_notwindows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package tstun diff --git a/paths/paths_unix.go b/paths/paths_unix.go index 4012f79de..fb11437c2 100644 --- a/paths/paths_unix.go +++ b/paths/paths_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package paths diff --git a/portlist/netstat.go b/portlist/netstat.go index b4119087a..77f14ddcd 100644 --- a/portlist/netstat.go +++ b/portlist/netstat.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (go1.16 && !ios) || (!go1.16 && !darwin) || (!go1.16 && !arm64) // +build go1.16,!ios !go1.16,!darwin !go1.16,!arm64 package portlist diff --git a/portlist/netstat_exec.go b/portlist/netstat_exec.go index fb9d0e1ab..d4114a8e6 100644 --- a/portlist/netstat_exec.go +++ b/portlist/netstat_exec.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (windows || freebsd || openbsd || (darwin && go1.16) || (darwin && !go1.16 && !arm64)) && !ios // +build windows freebsd openbsd darwin,go1.16 darwin,!go1.16,!arm64 // +build !ios diff --git a/portlist/portlist_ios.go b/portlist/portlist_ios.go index 19bc2db39..a5a5253a9 100644 --- a/portlist/portlist_ios.go +++ b/portlist/portlist_ios.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (go1.16 && ios) || (!go1.16 && darwin && !amd64) // +build go1.16,ios !go1.16,darwin,!amd64 package portlist diff --git a/portlist/portlist_macos.go b/portlist/portlist_macos.go index 1f253a351..a99089db1 100644 --- a/portlist/portlist_macos.go +++ b/portlist/portlist_macos.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ((darwin && amd64 && !go1.16) || (darwin && go1.16)) && !ios // +build darwin,amd64,!go1.16 darwin,go1.16 // +build !ios diff --git a/portlist/portlist_other.go b/portlist/portlist_other.go index 2ac61f0df..84193f623 100644 --- a/portlist/portlist_other.go +++ b/portlist/portlist_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux && !windows && !darwin // +build !linux,!windows,!darwin package portlist diff --git a/safesocket/unixsocket.go b/safesocket/unixsocket.go index 14d62e3d1..824cf0960 100644 --- a/safesocket/unixsocket.go +++ b/safesocket/unixsocket.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package safesocket diff --git a/syncs/locked.go b/syncs/locked.go index 8e8999076..9d3f411b4 100644 --- a/syncs/locked.go +++ b/syncs/locked.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.13 && !go1.16 // +build go1.13,!go1.16 // This file makes assumptions about the inner workings of sync.Mutex and sync.RWMutex. diff --git a/syncs/locked_test.go b/syncs/locked_test.go index cb11f15f8..032c45a07 100644 --- a/syncs/locked_test.go +++ b/syncs/locked_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.13 && !go1.16 // +build go1.13,!go1.16 package syncs diff --git a/tempfork/wireguard-windows/firewall/blocker.go b/tempfork/wireguard-windows/firewall/blocker.go index e69d791cc..1614b42e8 100644 --- a/tempfork/wireguard-windows/firewall/blocker.go +++ b/tempfork/wireguard-windows/firewall/blocker.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/helpers.go b/tempfork/wireguard-windows/firewall/helpers.go index 1b578e1c4..ebc9f2fc1 100644 --- a/tempfork/wireguard-windows/firewall/helpers.go +++ b/tempfork/wireguard-windows/firewall/helpers.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/rules.go b/tempfork/wireguard-windows/firewall/rules.go index 72fa20aba..2320754f0 100644 --- a/tempfork/wireguard-windows/firewall/rules.go +++ b/tempfork/wireguard-windows/firewall/rules.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/types_windows.go b/tempfork/wireguard-windows/firewall/types_windows.go index b0dd1b114..a44df12f9 100644 --- a/tempfork/wireguard-windows/firewall/types_windows.go +++ b/tempfork/wireguard-windows/firewall/types_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/types_windows_32.go b/tempfork/wireguard-windows/firewall/types_windows_32.go index 11a7ab871..37bf44cbf 100644 --- a/tempfork/wireguard-windows/firewall/types_windows_32.go +++ b/tempfork/wireguard-windows/firewall/types_windows_32.go @@ -1,3 +1,4 @@ +//go:build (windows && 386) || (windows && arm) // +build windows,386 windows,arm /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/types_windows_64.go b/tempfork/wireguard-windows/firewall/types_windows_64.go index 0cf686e58..1606caf2b 100644 --- a/tempfork/wireguard-windows/firewall/types_windows_64.go +++ b/tempfork/wireguard-windows/firewall/types_windows_64.go @@ -1,3 +1,4 @@ +//go:build (windows && amd64) || (windows && arm64) // +build windows,amd64 windows,arm64 /* SPDX-License-Identifier: MIT diff --git a/tempfork/wireguard-windows/firewall/types_windows_test.go b/tempfork/wireguard-windows/firewall/types_windows_test.go index baf64a722..2f7a363e3 100644 --- a/tempfork/wireguard-windows/firewall/types_windows_test.go +++ b/tempfork/wireguard-windows/firewall/types_windows_test.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows /* SPDX-License-Identifier: MIT diff --git a/tstest/integration/gen_deps.go b/tstest/integration/gen_deps.go index cf5a034e6..640bff36b 100644 --- a/tstest/integration/gen_deps.go +++ b/tstest/integration/gen_deps.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ignore // +build ignore package main diff --git a/tstest/integration/vms/derive_bindhost_test.go b/tstest/integration/vms/derive_bindhost_test.go index 8722458db..bca3d0f27 100644 --- a/tstest/integration/vms/derive_bindhost_test.go +++ b/tstest/integration/vms/derive_bindhost_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/distros_test.go b/tstest/integration/vms/distros_test.go index c2a969d36..fc72e6ebf 100644 --- a/tstest/integration/vms/distros_test.go +++ b/tstest/integration/vms/distros_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/harness_test.go b/tstest/integration/vms/harness_test.go index ea5a7bba0..7b5eeddfa 100644 --- a/tstest/integration/vms/harness_test.go +++ b/tstest/integration/vms/harness_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/nixos_test.go b/tstest/integration/vms/nixos_test.go index 41c887efd..a7fc63850 100644 --- a/tstest/integration/vms/nixos_test.go +++ b/tstest/integration/vms/nixos_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/opensuse_leap_15_1_test.go b/tstest/integration/vms/opensuse_leap_15_1_test.go index e26440434..b8d4a265d 100644 --- a/tstest/integration/vms/opensuse_leap_15_1_test.go +++ b/tstest/integration/vms/opensuse_leap_15_1_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/top_level_test.go b/tstest/integration/vms/top_level_test.go index d69ed3378..d2307c8fc 100644 --- a/tstest/integration/vms/top_level_test.go +++ b/tstest/integration/vms/top_level_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/udp_tester.go b/tstest/integration/vms/udp_tester.go index 77b91873d..a00e614d6 100644 --- a/tstest/integration/vms/udp_tester.go +++ b/tstest/integration/vms/udp_tester.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ignore // +build ignore // Command udp_tester exists because all of these distros being tested don't diff --git a/tstest/integration/vms/vm_setup_test.go b/tstest/integration/vms/vm_setup_test.go index d5aa0f1a1..c7b292cee 100644 --- a/tstest/integration/vms/vm_setup_test.go +++ b/tstest/integration/vms/vm_setup_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/vms_steps_test.go b/tstest/integration/vms/vms_steps_test.go index 23c755aeb..a7068d188 100644 --- a/tstest/integration/vms/vms_steps_test.go +++ b/tstest/integration/vms/vms_steps_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/tstest/integration/vms/vms_test.go b/tstest/integration/vms/vms_test.go index 689cd5f8e..720620200 100644 --- a/tstest/integration/vms/vms_test.go +++ b/tstest/integration/vms/vms_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package vms diff --git a/types/logger/rusage_nowindows.go b/types/logger/rusage_nowindows.go index 48446717b..bb82bab88 100644 --- a/types/logger/rusage_nowindows.go +++ b/types/logger/rusage_nowindows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package logger diff --git a/util/deephash/mapiter.go b/util/deephash/mapiter.go index 01a3ed1e5..65f617885 100644 --- a/util/deephash/mapiter.go +++ b/util/deephash/mapiter.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !tailscale_go // +build !tailscale_go package deephash diff --git a/util/deephash/mapiter_future.go b/util/deephash/mapiter_future.go index d80221d11..d2906c5e1 100644 --- a/util/deephash/mapiter_future.go +++ b/util/deephash/mapiter_future.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build tailscale_go // +build tailscale_go package deephash diff --git a/util/endian/big.go b/util/endian/big.go index d0be83b81..3cfa2535d 100644 --- a/util/endian/big.go +++ b/util/endian/big.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build mips || mips64 || ppc64 || s390x // +build mips mips64 ppc64 s390x package endian diff --git a/util/endian/little.go b/util/endian/little.go index 78c85a427..22a77e25c 100644 --- a/util/endian/little.go +++ b/util/endian/little.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 || amd64 || arm || arm64 || mips64le || mipsle || ppc64le || riscv64 || wasm // +build 386 amd64 arm arm64 mips64le mipsle ppc64le riscv64 wasm package endian diff --git a/util/groupmember/groupmember_cgo.go b/util/groupmember/groupmember_cgo.go index 2226ebf6e..733146dfe 100644 --- a/util/groupmember/groupmember_cgo.go +++ b/util/groupmember/groupmember_cgo.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build cgo // +build cgo package groupmember diff --git a/util/groupmember/groupmember_noimpl.go b/util/groupmember/groupmember_noimpl.go index f6bf389b8..5a0d9a061 100644 --- a/util/groupmember/groupmember_noimpl.go +++ b/util/groupmember/groupmember_noimpl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !cgo && !linux && !darwin // +build !cgo,!linux,!darwin package groupmember diff --git a/util/groupmember/groupmember_notcgo.go b/util/groupmember/groupmember_notcgo.go index a8b8fcbe7..fa6f96f97 100644 --- a/util/groupmember/groupmember_notcgo.go +++ b/util/groupmember/groupmember_notcgo.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !cgo && (linux || darwin) // +build !cgo // +build linux darwin diff --git a/util/osshare/filesharingstatus_noop.go b/util/osshare/filesharingstatus_noop.go index d2fe1a377..eb038567b 100644 --- a/util/osshare/filesharingstatus_noop.go +++ b/util/osshare/filesharingstatus_noop.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package osshare diff --git a/util/osshare/filesharingstatus_windows.go b/util/osshare/filesharingstatus_windows.go index c3282994f..537889ff6 100644 --- a/util/osshare/filesharingstatus_windows.go +++ b/util/osshare/filesharingstatus_windows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package osshare diff --git a/util/pidowner/pidowner_noimpl.go b/util/pidowner/pidowner_noimpl.go index 9be1a28dc..77d1c973e 100644 --- a/util/pidowner/pidowner_noimpl.go +++ b/util/pidowner/pidowner_noimpl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows && !linux // +build !windows,!linux package pidowner diff --git a/util/racebuild/off.go b/util/racebuild/off.go index 37f0f7cf1..b474895c7 100644 --- a/util/racebuild/off.go +++ b/util/racebuild/off.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !race // +build !race package racebuild diff --git a/util/racebuild/on.go b/util/racebuild/on.go index b318aa1b3..eb88c5b19 100644 --- a/util/racebuild/on.go +++ b/util/racebuild/on.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build race // +build race package racebuild diff --git a/util/systemd/systemd_linux.go b/util/systemd/systemd_linux.go index 86ac65441..237f08434 100644 --- a/util/systemd/systemd_linux.go +++ b/util/systemd/systemd_linux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package systemd diff --git a/util/systemd/systemd_nonlinux.go b/util/systemd/systemd_nonlinux.go index b6dcd9dad..1a2411862 100644 --- a/util/systemd/systemd_nonlinux.go +++ b/util/systemd/systemd_nonlinux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package systemd diff --git a/util/winutil/winutil.go b/util/winutil/winutil.go index b5aca749d..eacbd4866 100644 --- a/util/winutil/winutil.go +++ b/util/winutil/winutil.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows // Package winuntil contains misc Windows/win32 helper functions. diff --git a/util/winutil/winutil_notwindows.go b/util/winutil/winutil_notwindows.go index 56857fc53..0256df360 100644 --- a/util/winutil/winutil_notwindows.go +++ b/util/winutil/winutil_notwindows.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows // +build !windows package winutil diff --git a/version/cmdname.go b/version/cmdname.go index 832563532..9bccece03 100644 --- a/version/cmdname.go +++ b/version/cmdname.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (go1.16 && !ios) || (!go1.16 && !darwin) || (!go1.16 && !arm64) // +build go1.16,!ios !go1.16,!darwin !go1.16,!arm64 package version diff --git a/version/cmdname_ios.go b/version/cmdname_ios.go index 514da5da0..3f5fda519 100644 --- a/version/cmdname_ios.go +++ b/version/cmdname_ios.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (go1.16 && ios) || (!go1.16 && darwin && arm64) // +build go1.16,ios !go1.16,darwin,arm64 package version diff --git a/version/race.go b/version/race.go index 21972fa9a..6d8d5552d 100644 --- a/version/race.go +++ b/version/race.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build race // +build race package version diff --git a/version/race_off.go b/version/race_off.go index 9876efc1b..355f48b65 100644 --- a/version/race_off.go +++ b/version/race_off.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !race // +build !race package version diff --git a/wgengine/monitor/monitor_linux.go b/wgengine/monitor/monitor_linux.go index c8c8b1ea8..5136254f2 100644 --- a/wgengine/monitor/monitor_linux.go +++ b/wgengine/monitor/monitor_linux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !android // +build !android package monitor diff --git a/wgengine/monitor/monitor_polling.go b/wgengine/monitor/monitor_polling.go index 1bbbe2d90..b4c1eb15d 100644 --- a/wgengine/monitor/monitor_polling.go +++ b/wgengine/monitor/monitor_polling.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (!linux && !freebsd && !windows && !darwin) || android // +build !linux,!freebsd,!windows,!darwin android package monitor diff --git a/wgengine/monitor/polling.go b/wgengine/monitor/polling.go index c2c4b6cf0..d68cba205 100644 --- a/wgengine/monitor/polling.go +++ b/wgengine/monitor/polling.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !freebsd,!windows,!darwin +//go:build !freebsd && !windows && !darwin +// +build !freebsd,!windows,!darwin package monitor diff --git a/wgengine/router/router_default.go b/wgengine/router/router_default.go index 99899c6e3..4e6a724ba 100644 --- a/wgengine/router/router_default.go +++ b/wgengine/router/router_default.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !windows && !linux && !darwin && !openbsd && !freebsd // +build !windows,!linux,!darwin,!openbsd,!freebsd package router diff --git a/wgengine/router/router_test.go b/wgengine/router/router_test.go index 91d82d88a..e493f1c48 100644 --- a/wgengine/router/router_test.go +++ b/wgengine/router/router_test.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux || windows // +build linux windows package router diff --git a/wgengine/router/router_userspace_bsd.go b/wgengine/router/router_userspace_bsd.go index faca19a81..93cbdadc7 100644 --- a/wgengine/router/router_userspace_bsd.go +++ b/wgengine/router/router_userspace_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || freebsd // +build darwin freebsd package router diff --git a/wgengine/router/runner.go b/wgengine/router/runner.go index b626eea23..d3be49070 100644 --- a/wgengine/router/runner.go +++ b/wgengine/router/runner.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package router