diff --git a/pkg/fileutil/dir_unix.go b/pkg/fileutil/dir_unix.go index 4ce15dc6b..ca82f765c 100644 --- a/pkg/fileutil/dir_unix.go +++ b/pkg/fileutil/dir_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package fileutil diff --git a/pkg/fileutil/dir_windows.go b/pkg/fileutil/dir_windows.go index a10a90583..849c63c87 100644 --- a/pkg/fileutil/dir_windows.go +++ b/pkg/fileutil/dir_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package fileutil diff --git a/pkg/fileutil/lock_flock.go b/pkg/fileutil/lock_flock.go index 542550bc8..dcdf226cd 100644 --- a/pkg/fileutil/lock_flock.go +++ b/pkg/fileutil/lock_flock.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows && !plan9 && !solaris // +build !windows,!plan9,!solaris package fileutil diff --git a/pkg/fileutil/lock_linux.go b/pkg/fileutil/lock_linux.go index 34722085d..d8952cc48 100644 --- a/pkg/fileutil/lock_linux.go +++ b/pkg/fileutil/lock_linux.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package fileutil diff --git a/pkg/fileutil/lock_linux_test.go b/pkg/fileutil/lock_linux_test.go index 0f57d57a6..c1101c59c 100644 --- a/pkg/fileutil/lock_linux_test.go +++ b/pkg/fileutil/lock_linux_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package fileutil diff --git a/pkg/fileutil/lock_solaris.go b/pkg/fileutil/lock_solaris.go index 352ca5590..683cc1db9 100644 --- a/pkg/fileutil/lock_solaris.go +++ b/pkg/fileutil/lock_solaris.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build solaris // +build solaris package fileutil diff --git a/pkg/fileutil/lock_unix.go b/pkg/fileutil/lock_unix.go index ed01164de..d89027e1f 100644 --- a/pkg/fileutil/lock_unix.go +++ b/pkg/fileutil/lock_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows && !plan9 && !solaris && !linux // +build !windows,!plan9,!solaris,!linux package fileutil diff --git a/pkg/fileutil/lock_windows.go b/pkg/fileutil/lock_windows.go index eb8c3df95..5cbf2bc3d 100644 --- a/pkg/fileutil/lock_windows.go +++ b/pkg/fileutil/lock_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package fileutil diff --git a/pkg/fileutil/preallocate_darwin.go b/pkg/fileutil/preallocate_darwin.go index 6e2e6e905..caab143dd 100644 --- a/pkg/fileutil/preallocate_darwin.go +++ b/pkg/fileutil/preallocate_darwin.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin // +build darwin package fileutil diff --git a/pkg/fileutil/preallocate_unix.go b/pkg/fileutil/preallocate_unix.go index 50bd84f02..ebb8207c3 100644 --- a/pkg/fileutil/preallocate_unix.go +++ b/pkg/fileutil/preallocate_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package fileutil diff --git a/pkg/fileutil/preallocate_unsupported.go b/pkg/fileutil/preallocate_unsupported.go index 162fbc5f7..2c46dd490 100644 --- a/pkg/fileutil/preallocate_unsupported.go +++ b/pkg/fileutil/preallocate_unsupported.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux && !darwin // +build !linux,!darwin package fileutil diff --git a/pkg/fileutil/sync.go b/pkg/fileutil/sync.go index 54dd41f4f..0a0855309 100644 --- a/pkg/fileutil/sync.go +++ b/pkg/fileutil/sync.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux && !darwin // +build !linux,!darwin package fileutil diff --git a/pkg/fileutil/sync_darwin.go b/pkg/fileutil/sync_darwin.go index 5d62fae8c..1923b276e 100644 --- a/pkg/fileutil/sync_darwin.go +++ b/pkg/fileutil/sync_darwin.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin // +build darwin package fileutil diff --git a/pkg/fileutil/sync_linux.go b/pkg/fileutil/sync_linux.go index 1bbced915..b9398c23f 100644 --- a/pkg/fileutil/sync_linux.go +++ b/pkg/fileutil/sync_linux.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package fileutil diff --git a/pkg/logutil/zap_journal.go b/pkg/logutil/zap_journal.go index 9ebf94bd7..76508a9ae 100644 --- a/pkg/logutil/zap_journal.go +++ b/pkg/logutil/zap_journal.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package logutil diff --git a/pkg/logutil/zap_journal_test.go b/pkg/logutil/zap_journal_test.go index 09e39cb6d..292c1440e 100644 --- a/pkg/logutil/zap_journal_test.go +++ b/pkg/logutil/zap_journal_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package logutil diff --git a/pkg/netutil/routes.go b/pkg/netutil/routes.go index 3eb6a19ec..f66719ea1 100644 --- a/pkg/netutil/routes.go +++ b/pkg/netutil/routes.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux // +build !linux package netutil diff --git a/pkg/netutil/routes_linux.go b/pkg/netutil/routes_linux.go index bca4f8a9e..5f8bd0c48 100644 --- a/pkg/netutil/routes_linux.go +++ b/pkg/netutil/routes_linux.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package netutil diff --git a/pkg/netutil/routes_linux_test.go b/pkg/netutil/routes_linux_test.go index 707fd2d88..2d0dade6a 100644 --- a/pkg/netutil/routes_linux_test.go +++ b/pkg/netutil/routes_linux_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package netutil diff --git a/pkg/osutil/interrupt_unix.go b/pkg/osutil/interrupt_unix.go index 4a8f907a8..78161d496 100644 --- a/pkg/osutil/interrupt_unix.go +++ b/pkg/osutil/interrupt_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows && !plan9 // +build !windows,!plan9 package osutil diff --git a/pkg/osutil/interrupt_windows.go b/pkg/osutil/interrupt_windows.go index ec67ba5d2..7572690d2 100644 --- a/pkg/osutil/interrupt_windows.go +++ b/pkg/osutil/interrupt_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package osutil diff --git a/pkg/osutil/signal.go b/pkg/osutil/signal.go index 687397fdd..c324ea16e 100644 --- a/pkg/osutil/signal.go +++ b/pkg/osutil/signal.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux || cov // +build !linux cov package osutil diff --git a/pkg/osutil/signal_linux.go b/pkg/osutil/signal_linux.go index b94d80c58..93e0f3508 100644 --- a/pkg/osutil/signal_linux.go +++ b/pkg/osutil/signal_linux.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux && !cov // +build linux,!cov package osutil diff --git a/pkg/runtime/fds_other.go b/pkg/runtime/fds_other.go index 0cbdb88c7..034f3d426 100644 --- a/pkg/runtime/fds_other.go +++ b/pkg/runtime/fds_other.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux // +build !linux package runtime diff --git a/scripts/fix.sh b/scripts/fix.sh index f880e91f7..44b4b4b77 100755 --- a/scripts/fix.sh +++ b/scripts/fix.sh @@ -5,9 +5,15 @@ set -e source ./scripts/test_lib.sh source ./scripts/updatebom.sh +# To fix according to newer version of go: +# go get golang.org/dl/gotip +# gotip download +# GO_CMD="gotip" +GO_CMD="go" + function mod_tidy_fix { run rm ./go.sum - run go mod tidy || return 2 + run ${GO_CMD} mod tidy || return 2 } function bash_ws_fix { @@ -23,7 +29,7 @@ function bash_ws_fix { log_callout -e "\\nFixing etcd code for you...\\n" run_for_modules mod_tidy_fix || exit 2 -run_for_modules run go fmt || exit 2 +run_for_modules run ${GO_CMD} fmt || exit 2 run_for_module tests bom_fix || exit 2 bash_ws_fix || exit 2 diff --git a/server/embed/config_logging_journal_unix.go b/server/embed/config_logging_journal_unix.go index 591b29ebd..338c0ebbe 100644 --- a/server/embed/config_logging_journal_unix.go +++ b/server/embed/config_logging_journal_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package embed diff --git a/server/embed/config_logging_journal_windows.go b/server/embed/config_logging_journal_windows.go index 5b7625648..58ed08631 100644 --- a/server/embed/config_logging_journal_windows.go +++ b/server/embed/config_logging_journal_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package embed diff --git a/server/mvcc/backend/config_default.go b/server/mvcc/backend/config_default.go index f15f030f8..847bd10fd 100644 --- a/server/mvcc/backend/config_default.go +++ b/server/mvcc/backend/config_default.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux && !windows // +build !linux,!windows package backend diff --git a/server/mvcc/backend/config_windows.go b/server/mvcc/backend/config_windows.go index c6500592c..ba6e5a128 100644 --- a/server/mvcc/backend/config_windows.go +++ b/server/mvcc/backend/config_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package backend diff --git a/tests/e2e/cluster_direct_test.go b/tests/e2e/cluster_direct_test.go index 15a16c925..e5b91270a 100644 --- a/tests/e2e/cluster_direct_test.go +++ b/tests/e2e/cluster_direct_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy package e2e diff --git a/tests/e2e/cluster_proxy_test.go b/tests/e2e/cluster_proxy_test.go index 163ef7490..953e68946 100644 --- a/tests/e2e/cluster_proxy_test.go +++ b/tests/e2e/cluster_proxy_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cluster_proxy // +build cluster_proxy package e2e diff --git a/tests/e2e/ctl_v3_auth_no_proxy_test.go b/tests/e2e/ctl_v3_auth_no_proxy_test.go index 3df65fdc5..0b4807c83 100644 --- a/tests/e2e/ctl_v3_auth_no_proxy_test.go +++ b/tests/e2e/ctl_v3_auth_no_proxy_test.go @@ -14,6 +14,7 @@ // These tests depends on certificate-based authentication that is NOT supported // by gRPC proxy. +//go:build !cluster_proxy // +build !cluster_proxy package e2e diff --git a/tests/e2e/ctl_v3_watch_cov_test.go b/tests/e2e/ctl_v3_watch_cov_test.go index 9793a9071..8d2fd04d6 100644 --- a/tests/e2e/ctl_v3_watch_cov_test.go +++ b/tests/e2e/ctl_v3_watch_cov_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cov // +build cov package e2e diff --git a/tests/e2e/ctl_v3_watch_no_cov_test.go b/tests/e2e/ctl_v3_watch_no_cov_test.go index 70d089ea4..a952aa4a4 100644 --- a/tests/e2e/ctl_v3_watch_no_cov_test.go +++ b/tests/e2e/ctl_v3_watch_no_cov_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cov // +build !cov package e2e diff --git a/tests/e2e/etcd_spawn_cov.go b/tests/e2e/etcd_spawn_cov.go index 0615ef09f..2df571361 100644 --- a/tests/e2e/etcd_spawn_cov.go +++ b/tests/e2e/etcd_spawn_cov.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cov // +build cov package e2e diff --git a/tests/e2e/etcd_spawn_nocov.go b/tests/e2e/etcd_spawn_nocov.go index 8a4dd81a1..b70240496 100644 --- a/tests/e2e/etcd_spawn_nocov.go +++ b/tests/e2e/etcd_spawn_nocov.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cov // +build !cov package e2e diff --git a/tests/e2e/v2_test.go b/tests/e2e/v2_test.go index ad59211ec..fe44b3f96 100644 --- a/tests/e2e/v2_test.go +++ b/tests/e2e/v2_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !v2v3 // +build !v2v3 package e2e diff --git a/tests/e2e/v2v3_test.go b/tests/e2e/v2v3_test.go index b9c69466a..75043b7df 100644 --- a/tests/e2e/v2v3_test.go +++ b/tests/e2e/v2v3_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build v2v3 // +build v2v3 package e2e diff --git a/tests/e2e/v3_cipher_suite_test.go b/tests/e2e/v3_cipher_suite_test.go index e34fb143e..694de13b4 100644 --- a/tests/e2e/v3_cipher_suite_test.go +++ b/tests/e2e/v3_cipher_suite_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cov && !cluster_proxy // +build !cov,!cluster_proxy package e2e diff --git a/tests/integration/clientv3/connectivity/black_hole_test.go b/tests/integration/clientv3/connectivity/black_hole_test.go index eebdc2e67..fc8795564 100644 --- a/tests/integration/clientv3/connectivity/black_hole_test.go +++ b/tests/integration/clientv3/connectivity/black_hole_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy package connectivity_test diff --git a/tests/integration/clientv3/connectivity/network_partition_test.go b/tests/integration/clientv3/connectivity/network_partition_test.go index 1860fe490..0cac68173 100644 --- a/tests/integration/clientv3/connectivity/network_partition_test.go +++ b/tests/integration/clientv3/connectivity/network_partition_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy package connectivity_test diff --git a/tests/integration/clientv3/watch_fragment_test.go b/tests/integration/clientv3/watch_fragment_test.go index 483a5d7cd..b554b6b5d 100644 --- a/tests/integration/clientv3/watch_fragment_test.go +++ b/tests/integration/clientv3/watch_fragment_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy package clientv3test diff --git a/tests/integration/cluster_direct.go b/tests/integration/cluster_direct.go index f452cd7fd..0334146d0 100644 --- a/tests/integration/cluster_direct.go +++ b/tests/integration/cluster_direct.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy package integration diff --git a/tests/integration/cluster_proxy.go b/tests/integration/cluster_proxy.go index 59a6cbc6a..4a9d26aba 100644 --- a/tests/integration/cluster_proxy.go +++ b/tests/integration/cluster_proxy.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cluster_proxy // +build cluster_proxy package integration diff --git a/tests/integration/embed/embed_proxy_test.go b/tests/integration/embed/embed_proxy_test.go index 8bff9662e..43a80dd1f 100644 --- a/tests/integration/embed/embed_proxy_test.go +++ b/tests/integration/embed/embed_proxy_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build cluster_proxy // +build cluster_proxy // The purpose of this (empty) package is too keep following test working: diff --git a/tests/integration/embed/embed_test.go b/tests/integration/embed/embed_test.go index 36d2fc7d8..4459a1e02 100644 --- a/tests/integration/embed/embed_test.go +++ b/tests/integration/embed/embed_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !cluster_proxy // +build !cluster_proxy // Keep the test in a separate package from other tests such that diff --git a/tests/integration/v2store/store_tag_not_v2v3_test.go b/tests/integration/v2store/store_tag_not_v2v3_test.go index 5d3183dfe..64ec2fbdb 100644 --- a/tests/integration/v2store/store_tag_not_v2v3_test.go +++ b/tests/integration/v2store/store_tag_not_v2v3_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !v2v3 // +build !v2v3 package v2store_test diff --git a/tests/integration/v2store/store_tag_v2v3_test.go b/tests/integration/v2store/store_tag_v2v3_test.go index d6bdfb6bc..a9dafe664 100644 --- a/tests/integration/v2store/store_tag_v2v3_test.go +++ b/tests/integration/v2store/store_tag_v2v3_test.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build v2v3 // +build v2v3 package v2store_test diff --git a/tools/etcd-dump-metrics/install_darwin.go b/tools/etcd-dump-metrics/install_darwin.go index 28327c2ec..ba70937b9 100644 --- a/tools/etcd-dump-metrics/install_darwin.go +++ b/tools/etcd-dump-metrics/install_darwin.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin // +build darwin package main diff --git a/tools/etcd-dump-metrics/install_linux.go b/tools/etcd-dump-metrics/install_linux.go index 58d446c87..01df780e9 100644 --- a/tools/etcd-dump-metrics/install_linux.go +++ b/tools/etcd-dump-metrics/install_linux.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package main diff --git a/tools/etcd-dump-metrics/install_windows.go b/tools/etcd-dump-metrics/install_windows.go index a7aa8563a..07eb15b32 100644 --- a/tools/etcd-dump-metrics/install_windows.go +++ b/tools/etcd-dump-metrics/install_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package main