Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: apply gofmt from golang 1.17

Ivan Andreev24de896df2ce
diff --git a/backend/amazonclouddrive/amazonclouddrive_test.go b/backend/amazonclouddrive/amazonclouddrive_test.go
index 5a0eccc7c..821a6f1ed 100644
--- a/backend/amazonclouddrive/amazonclouddrive_test.go
+++ b/backend/amazonclouddrive/amazonclouddrive_test.go
@@ -1,5 +1,6 @@
// Test AmazonCloudDrive filesystem interface
+//go:build acd
// +build acd
package amazonclouddrive_test
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index c9d731ec9..b1f657c71 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1,5 +1,6 @@
// Package azureblob provides an interface to the Microsoft Azure blob object storage system
+//go:build !plan9 && !solaris && !js
// +build !plan9,!solaris,!js
package azureblob
diff --git a/backend/azureblob/azureblob_internal_test.go b/backend/azureblob/azureblob_internal_test.go
index b7639106c..827653a80 100644
--- a/backend/azureblob/azureblob_internal_test.go
+++ b/backend/azureblob/azureblob_internal_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !solaris && !js
// +build !plan9,!solaris,!js
package azureblob
diff --git a/backend/azureblob/azureblob_test.go b/backend/azureblob/azureblob_test.go
index 31a236f16..ede8317d7 100644
--- a/backend/azureblob/azureblob_test.go
+++ b/backend/azureblob/azureblob_test.go
@@ -1,5 +1,6 @@
// Test AzureBlob filesystem interface
+//go:build !plan9 && !solaris && !js
// +build !plan9,!solaris,!js
package azureblob
diff --git a/backend/azureblob/azureblob_unsupported.go b/backend/azureblob/azureblob_unsupported.go
index d393e1e9f..369d6e367 100644
--- a/backend/azureblob/azureblob_unsupported.go
+++ b/backend/azureblob/azureblob_unsupported.go
@@ -1,6 +1,7 @@
// Build for azureblob for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9 || solaris || js
// +build plan9 solaris js
package azureblob
diff --git a/backend/azureblob/imds.go b/backend/azureblob/imds.go
index 7494c4fd6..779e0b118 100644
--- a/backend/azureblob/imds.go
+++ b/backend/azureblob/imds.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !solaris && !js
// +build !plan9,!solaris,!js
package azureblob
diff --git a/backend/azureblob/imds_test.go b/backend/azureblob/imds_test.go
index 308d2957a..c449b545c 100644
--- a/backend/azureblob/imds_test.go
+++ b/backend/azureblob/imds_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !solaris && !js
// +build !plan9,!solaris,!js
package azureblob
diff --git a/backend/cache/cache.go b/backend/cache/cache.go
index b5a16f9d6..a20193db5 100644
--- a/backend/cache/cache.go
+++ b/backend/cache/cache.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/cache_internal_test.go b/backend/cache/cache_internal_test.go
index c6ebaca8a..87300ec05 100644
--- a/backend/cache/cache_internal_test.go
+++ b/backend/cache/cache_internal_test.go
@@ -1,5 +1,5 @@
-// +build !plan9,!js
-// +build !race
+//go:build !plan9 && !js && !race
+// +build !plan9,!js,!race
package cache_test
diff --git a/backend/cache/cache_test.go b/backend/cache/cache_test.go
index 009cd347e..44307ea6d 100644
--- a/backend/cache/cache_test.go
+++ b/backend/cache/cache_test.go
@@ -1,7 +1,7 @@
// Test Cache filesystem interface
-// +build !plan9,!js
-// +build !race
+//go:build !plan9 && !js && !race
+// +build !plan9,!js,!race
package cache_test
diff --git a/backend/cache/cache_unsupported.go b/backend/cache/cache_unsupported.go
index 7a242035d..a14a7beaa 100644
--- a/backend/cache/cache_unsupported.go
+++ b/backend/cache/cache_unsupported.go
@@ -1,6 +1,7 @@
// Build for cache for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9 || js
// +build plan9 js
package cache
diff --git a/backend/cache/cache_upload_test.go b/backend/cache/cache_upload_test.go
index 7e66c0a44..3356613bd 100644
--- a/backend/cache/cache_upload_test.go
+++ b/backend/cache/cache_upload_test.go
@@ -1,5 +1,5 @@
-// +build !plan9,!js
-// +build !race
+//go:build !plan9 && !js && !race
+// +build !plan9,!js,!race
package cache_test
diff --git a/backend/cache/directory.go b/backend/cache/directory.go
index ab009738d..ab4ea9112 100644
--- a/backend/cache/directory.go
+++ b/backend/cache/directory.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/handle.go b/backend/cache/handle.go
index efab3ee49..f39f5f633 100644
--- a/backend/cache/handle.go
+++ b/backend/cache/handle.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/object.go b/backend/cache/object.go
index f0b148ff1..adae08970 100644
--- a/backend/cache/object.go
+++ b/backend/cache/object.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/plex.go b/backend/cache/plex.go
index 0ce76b724..e3a333c73 100644
--- a/backend/cache/plex.go
+++ b/backend/cache/plex.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/storage_memory.go b/backend/cache/storage_memory.go
index 6faf0472a..8705e9125 100644
--- a/backend/cache/storage_memory.go
+++ b/backend/cache/storage_memory.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/cache/storage_persistent.go b/backend/cache/storage_persistent.go
index 6f5d2b4f6..b6d292989 100644
--- a/backend/cache/storage_persistent.go
+++ b/backend/cache/storage_persistent.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cache
diff --git a/backend/hdfs/fs.go b/backend/hdfs/fs.go
index bdae0b12c..1fbd44b1e 100644
--- a/backend/hdfs/fs.go
+++ b/backend/hdfs/fs.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package hdfs
diff --git a/backend/hdfs/hdfs.go b/backend/hdfs/hdfs.go
index 49d009899..878217c65 100644
--- a/backend/hdfs/hdfs.go
+++ b/backend/hdfs/hdfs.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package hdfs
diff --git a/backend/hdfs/hdfs_test.go b/backend/hdfs/hdfs_test.go
index fe53dfc52..cb2ff6c22 100644
--- a/backend/hdfs/hdfs_test.go
+++ b/backend/hdfs/hdfs_test.go
@@ -1,5 +1,6 @@
// Test HDFS filesystem interface
+//go:build !plan9
// +build !plan9
package hdfs_test
diff --git a/backend/hdfs/hdfs_unsupported.go b/backend/hdfs/hdfs_unsupported.go
index 70cf26aff..afa686adb 100644
--- a/backend/hdfs/hdfs_unsupported.go
+++ b/backend/hdfs/hdfs_unsupported.go
@@ -1,6 +1,7 @@
// Build for hdfs for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9
// +build plan9
package hdfs
diff --git a/backend/hdfs/object.go b/backend/hdfs/object.go
index 304b8b27a..d7b94afbd 100644
--- a/backend/hdfs/object.go
+++ b/backend/hdfs/object.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package hdfs
diff --git a/backend/local/about_unix.go b/backend/local/about_unix.go
index 3c31d17a1..427c62872 100644
--- a/backend/local/about_unix.go
+++ b/backend/local/about_unix.go
@@ -1,3 +1,4 @@
+//go:build darwin || dragonfly || freebsd || linux
// +build darwin dragonfly freebsd linux
package local
diff --git a/backend/local/about_windows.go b/backend/local/about_windows.go
index 32793e719..cc8332534 100644
--- a/backend/local/about_windows.go
+++ b/backend/local/about_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package local
diff --git a/backend/local/fadvise_other.go b/backend/local/fadvise_other.go
index 18ac0d750..9bf2f6260 100644
--- a/backend/local/fadvise_other.go
+++ b/backend/local/fadvise_other.go
@@ -1,4 +1,5 @@
-//+build !linux
+//go:build !linux
+// +build !linux
package local
diff --git a/backend/local/fadvise_unix.go b/backend/local/fadvise_unix.go
index fce828971..14bbb6b04 100644
--- a/backend/local/fadvise_unix.go
+++ b/backend/local/fadvise_unix.go
@@ -1,4 +1,5 @@
-//+build linux
+//go:build linux
+// +build linux
package local
diff --git a/backend/local/lchtimes.go b/backend/local/lchtimes.go
index a845e3a40..97f3b1be1 100644
--- a/backend/local/lchtimes.go
+++ b/backend/local/lchtimes.go
@@ -1,3 +1,4 @@
+//go:build windows || plan9 || js
// +build windows plan9 js
package local
diff --git a/backend/local/lchtimes_unix.go b/backend/local/lchtimes_unix.go
index 9aec5c431..478829159 100644
--- a/backend/local/lchtimes_unix.go
+++ b/backend/local/lchtimes_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package local
diff --git a/backend/local/read_device_other.go b/backend/local/read_device_other.go
index c3fc4f408..a5a455d0c 100644
--- a/backend/local/read_device_other.go
+++ b/backend/local/read_device_other.go
@@ -1,5 +1,6 @@
// Device reading functions
+//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package local
diff --git a/backend/local/read_device_unix.go b/backend/local/read_device_unix.go
index 7a1b91b24..3297194b3 100644
--- a/backend/local/read_device_unix.go
+++ b/backend/local/read_device_unix.go
@@ -1,5 +1,6 @@
// Device reading functions
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package local
diff --git a/backend/local/remove_other.go b/backend/local/remove_other.go
index 760e2cf3b..b0deeeec8 100644
--- a/backend/local/remove_other.go
+++ b/backend/local/remove_other.go
@@ -1,4 +1,5 @@
-//+build !windows
+//go:build !windows
+// +build !windows
package local
diff --git a/backend/local/remove_windows.go b/backend/local/remove_windows.go
index 65acb5428..989c75805 100644
--- a/backend/local/remove_windows.go
+++ b/backend/local/remove_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package local
diff --git a/backend/local/symlink.go b/backend/local/symlink.go
index cf49c7282..c55fb50a2 100644
--- a/backend/local/symlink.go
+++ b/backend/local/symlink.go
@@ -1,3 +1,4 @@
+//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package local
diff --git a/backend/local/symlink_other.go b/backend/local/symlink_other.go
index 36e012768..2b942c6fc 100644
--- a/backend/local/symlink_other.go
+++ b/backend/local/symlink_other.go
@@ -1,3 +1,4 @@
+//go:build windows || plan9 || js
// +build windows plan9 js
package local
diff --git a/backend/qingstor/qingstor.go b/backend/qingstor/qingstor.go
index 1588a3629..7e06c036a 100644
--- a/backend/qingstor/qingstor.go
+++ b/backend/qingstor/qingstor.go
@@ -1,6 +1,7 @@
// Package qingstor provides an interface to QingStor object storage
// Home: https://www.qingcloud.com/
+//go:build !plan9 && !js
// +build !plan9,!js
package qingstor
diff --git a/backend/qingstor/qingstor_test.go b/backend/qingstor/qingstor_test.go
index 8910744b6..f7e211134 100644
--- a/backend/qingstor/qingstor_test.go
+++ b/backend/qingstor/qingstor_test.go
@@ -1,5 +1,6 @@
// Test QingStor filesystem interface
+//go:build !plan9 && !js
// +build !plan9,!js
package qingstor
diff --git a/backend/qingstor/qingstor_unsupported.go b/backend/qingstor/qingstor_unsupported.go
index 8406b8346..4f453acef 100644
--- a/backend/qingstor/qingstor_unsupported.go
+++ b/backend/qingstor/qingstor_unsupported.go
@@ -1,6 +1,7 @@
// Build for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9 || js
// +build plan9 js
package qingstor
diff --git a/backend/qingstor/upload.go b/backend/qingstor/upload.go
index 7fa0e3321..200ef3554 100644
--- a/backend/qingstor/upload.go
+++ b/backend/qingstor/upload.go
@@ -1,5 +1,6 @@
// Upload object to QingStor
+//go:build !plan9 && !js
// +build !plan9,!js
package qingstor
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index 3167a8c65..d1141e8e6 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -1,5 +1,6 @@
// Package sftp provides a filesystem interface using github.com/pkg/sftp
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/backend/sftp/sftp_internal_test.go b/backend/sftp/sftp_internal_test.go
index e23ae8db9..e73cc417e 100644
--- a/backend/sftp/sftp_internal_test.go
+++ b/backend/sftp/sftp_internal_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/backend/sftp/sftp_test.go b/backend/sftp/sftp_test.go
index cab7d0339..89a267922 100644
--- a/backend/sftp/sftp_test.go
+++ b/backend/sftp/sftp_test.go
@@ -1,5 +1,6 @@
// Test Sftp filesystem interface
+//go:build !plan9
// +build !plan9
package sftp_test
diff --git a/backend/sftp/sftp_unsupported.go b/backend/sftp/sftp_unsupported.go
index daddf483b..27f4cc9f5 100644
--- a/backend/sftp/sftp_unsupported.go
+++ b/backend/sftp/sftp_unsupported.go
@@ -1,6 +1,7 @@
// Build for sftp for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9
// +build plan9
package sftp
diff --git a/backend/sftp/stringlock.go b/backend/sftp/stringlock.go
index 93c490edf..a5167a7da 100644
--- a/backend/sftp/stringlock.go
+++ b/backend/sftp/stringlock.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/backend/sftp/stringlock_test.go b/backend/sftp/stringlock_test.go
index 0c1941bb7..41b46a441 100644
--- a/backend/sftp/stringlock_test.go
+++ b/backend/sftp/stringlock_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/backend/sharefile/generate_tzdata.go b/backend/sharefile/generate_tzdata.go
index 4f86911c5..1e01a720a 100644
--- a/backend/sharefile/generate_tzdata.go
+++ b/backend/sharefile/generate_tzdata.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
package main
diff --git a/backend/sharefile/tzdata_vfsdata.go b/backend/sharefile/tzdata_vfsdata.go
index b016f14a5..601d82d45 100644
--- a/backend/sharefile/tzdata_vfsdata.go
+++ b/backend/sharefile/tzdata_vfsdata.go
@@ -1,5 +1,6 @@
// Code generated by vfsgen; DO NOT EDIT.
+//go:build !dev
// +build !dev
package sharefile
diff --git a/backend/tardigrade/fs.go b/backend/tardigrade/fs.go
index a067094ba..3c981737c 100644
--- a/backend/tardigrade/fs.go
+++ b/backend/tardigrade/fs.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
// Package tardigrade provides an interface to Tardigrade decentralized object storage.
diff --git a/backend/tardigrade/object.go b/backend/tardigrade/object.go
index 40e29b37d..d8369e841 100644
--- a/backend/tardigrade/object.go
+++ b/backend/tardigrade/object.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package tardigrade
diff --git a/backend/tardigrade/tardigrade_test.go b/backend/tardigrade/tardigrade_test.go
index 90e966cff..7159db075 100644
--- a/backend/tardigrade/tardigrade_test.go
+++ b/backend/tardigrade/tardigrade_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
// Test Tardigrade filesystem interface
diff --git a/backend/tardigrade/tardigrade_unsupported.go b/backend/tardigrade/tardigrade_unsupported.go
index 4b4f12137..17f24c32a 100644
--- a/backend/tardigrade/tardigrade_unsupported.go
+++ b/backend/tardigrade/tardigrade_unsupported.go
@@ -1,3 +1,4 @@
+//go:build plan9
// +build plan9
package tardigrade
diff --git a/bin/check-merged.go b/bin/check-merged.go
index 555976cbb..986a60ec1 100644
--- a/bin/check-merged.go
+++ b/bin/check-merged.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Attempt to work out if branches have already been merged
diff --git a/bin/cross-compile.go b/bin/cross-compile.go
index 536327723..d77250b2a 100644
--- a/bin/cross-compile.go
+++ b/bin/cross-compile.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Cross compile rclone - in go because I hate bash ;-)
diff --git a/bin/get-github-release.go b/bin/get-github-release.go
index 2d024f41d..1aa98f16a 100644
--- a/bin/get-github-release.go
+++ b/bin/get-github-release.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Get the latest release from a github project
diff --git a/bin/test_independence.go b/bin/test_independence.go
index c6201d289..12aab97be 100644
--- a/bin/test_independence.go
+++ b/bin/test_independence.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Test that the tests in the suite passed in are independent
diff --git a/cmd/cachestats/cachestats.go b/cmd/cachestats/cachestats.go
index 0e7ea6119..1daaed37b 100644
--- a/cmd/cachestats/cachestats.go
+++ b/cmd/cachestats/cachestats.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package cachestats
diff --git a/cmd/cachestats/cachestats_unsupported.go b/cmd/cachestats/cachestats_unsupported.go
index 9a53d1a9e..6e2987722 100644
--- a/cmd/cachestats/cachestats_unsupported.go
+++ b/cmd/cachestats/cachestats_unsupported.go
@@ -1,6 +1,7 @@
// Build for cache for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9 || js
// +build plan9 js
package cachestats
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go
index 32a6b8c21..6545c058d 100644
--- a/cmd/cmount/fs.go
+++ b/cmd/cmount/fs.go
@@ -1,3 +1,4 @@
+//go:build cmount && cgo && (linux || darwin || freebsd || windows)
// +build cmount
// +build cgo
// +build linux darwin freebsd windows
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index dd30f35ea..3070763ba 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -2,6 +2,7 @@
//
// This uses the cgo based cgofuse library
+//go:build cmount && cgo && (linux || darwin || freebsd || windows)
// +build cmount
// +build cgo
// +build linux darwin freebsd windows
diff --git a/cmd/cmount/mount_brew.go b/cmd/cmount/mount_brew.go
index df553487a..e30f4dab6 100644
--- a/cmd/cmount/mount_brew.go
+++ b/cmd/cmount/mount_brew.go
@@ -1,8 +1,8 @@
// Build for macos with the brew tag to handle the absence
// of fuse and print an appropriate error message
-// +build brew
-// +build darwin
+//go:build brew && darwin
+// +build brew,darwin
package cmount
diff --git a/cmd/cmount/mount_test.go b/cmd/cmount/mount_test.go
index bb8b507b8..f57119410 100644
--- a/cmd/cmount/mount_test.go
+++ b/cmd/cmount/mount_test.go
@@ -1,3 +1,4 @@
+//go:build cmount && cgo && (linux || darwin || freebsd || windows) && (!race || !windows)
// +build cmount
// +build cgo
// +build linux darwin freebsd windows
diff --git a/cmd/cmount/mount_unsupported.go b/cmd/cmount/mount_unsupported.go
index dbd73618f..74e441804 100644
--- a/cmd/cmount/mount_unsupported.go
+++ b/cmd/cmount/mount_unsupported.go
@@ -1,6 +1,7 @@
// Build for cmount for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build (!linux && !darwin && !freebsd && !windows) || !brew || !cgo || !cmount
// +build !linux,!darwin,!freebsd,!windows !brew !cgo !cmount
package cmount
diff --git a/cmd/cmount/mountpoint_other.go b/cmd/cmount/mountpoint_other.go
index 8a0ae2140..aa1f46336 100644
--- a/cmd/cmount/mountpoint_other.go
+++ b/cmd/cmount/mountpoint_other.go
@@ -1,6 +1,5 @@
-// +build cmount
-// +build cgo
-// +build !windows
+//go:build cmount && cgo && !windows
+// +build cmount,cgo,!windows
package cmount
diff --git a/cmd/cmount/mountpoint_windows.go b/cmd/cmount/mountpoint_windows.go
index c5c3223c9..d70bc30af 100644
--- a/cmd/cmount/mountpoint_windows.go
+++ b/cmd/cmount/mountpoint_windows.go
@@ -1,6 +1,5 @@
-// +build cmount
-// +build cgo
-// +build windows
+//go:build cmount && cgo && windows
+// +build cmount,cgo,windows
package cmount
diff --git a/cmd/mount/dir.go b/cmd/mount/dir.go
index f03e3baf6..9da7a1a64 100644
--- a/cmd/mount/dir.go
+++ b/cmd/mount/dir.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/file.go b/cmd/mount/file.go
index 315ce7dff..9e8b977db 100644
--- a/cmd/mount/file.go
+++ b/cmd/mount/file.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/fs.go b/cmd/mount/fs.go
index 5dbd74efe..0ecd4aaa4 100644
--- a/cmd/mount/fs.go
+++ b/cmd/mount/fs.go
@@ -1,5 +1,6 @@
// FUSE main Fs
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/handle.go b/cmd/mount/handle.go
index 85bccba34..7b7b6c010 100644
--- a/cmd/mount/handle.go
+++ b/cmd/mount/handle.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/mount.go b/cmd/mount/mount.go
index 2b42af472..73fcbf550 100644
--- a/cmd/mount/mount.go
+++ b/cmd/mount/mount.go
@@ -1,5 +1,6 @@
// Package mount implements a FUSE mounting system for rclone remotes.
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/mount_test.go b/cmd/mount/mount_test.go
index 3a92fe076..2c1e027f1 100644
--- a/cmd/mount/mount_test.go
+++ b/cmd/mount/mount_test.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd
// +build linux freebsd
package mount
diff --git a/cmd/mount/mount_unsupported.go b/cmd/mount/mount_unsupported.go
index a5a2c700e..cc5ccb628 100644
--- a/cmd/mount/mount_unsupported.go
+++ b/cmd/mount/mount_unsupported.go
@@ -3,7 +3,7 @@
// Invert the build constraint: linux freebsd
-// +build !linux
-// +build !freebsd
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package mount
diff --git a/cmd/mount/test/seek_speed.go b/cmd/mount/test/seek_speed.go
index daf502828..55d5bfa59 100644
--- a/cmd/mount/test/seek_speed.go
+++ b/cmd/mount/test/seek_speed.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Read blocks out of a single file to time the seeking code
diff --git a/cmd/mount/test/seeker.go b/cmd/mount/test/seeker.go
index f35f2a1a0..bcc9bb323 100644
--- a/cmd/mount/test/seeker.go
+++ b/cmd/mount/test/seeker.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Read two files with lots of seeking to stress test the seek code
diff --git a/cmd/mount/test/seekers.go b/cmd/mount/test/seekers.go
index ae5eba5c3..571ecf87b 100644
--- a/cmd/mount/test/seekers.go
+++ b/cmd/mount/test/seekers.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Read lots files with lots of simultaneous seeking to stress test the seek code
diff --git a/cmd/mount2/file.go b/cmd/mount2/file.go
index e40114c10..8d6b9b968 100644
--- a/cmd/mount2/file.go
+++ b/cmd/mount2/file.go
@@ -1,3 +1,4 @@
+//go:build linux || (darwin && amd64)
// +build linux darwin,amd64
package mount2
diff --git a/cmd/mount2/fs.go b/cmd/mount2/fs.go
index 0fdd0c811..94e70a60c 100644
--- a/cmd/mount2/fs.go
+++ b/cmd/mount2/fs.go
@@ -1,5 +1,6 @@
// FUSE main Fs
+//go:build linux || (darwin && amd64)
// +build linux darwin,amd64
package mount2
diff --git a/cmd/mount2/mount.go b/cmd/mount2/mount.go
index 4acd7b3ea..fabf38b86 100644
--- a/cmd/mount2/mount.go
+++ b/cmd/mount2/mount.go
@@ -1,5 +1,6 @@
// Package mount implements a FUSE mounting system for rclone remotes.
+//go:build linux || (darwin && amd64)
// +build linux darwin,amd64
package mount2
diff --git a/cmd/mount2/mount_test.go b/cmd/mount2/mount_test.go
index 2017d4daf..c6572a983 100644
--- a/cmd/mount2/mount_test.go
+++ b/cmd/mount2/mount_test.go
@@ -1,3 +1,4 @@
+//go:build linux || (darwin && amd64)
// +build linux darwin,amd64
package mount2
diff --git a/cmd/mount2/mount_unsupported.go b/cmd/mount2/mount_unsupported.go
index 7adf1e72f..975a25b3e 100644
--- a/cmd/mount2/mount_unsupported.go
+++ b/cmd/mount2/mount_unsupported.go
@@ -1,6 +1,7 @@
// Build for mount for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build !linux && (!darwin || !amd64)
// +build !linux
// +build !darwin !amd64
diff --git a/cmd/mount2/node.go b/cmd/mount2/node.go
index 90f98379a..fae416d64 100644
--- a/cmd/mount2/node.go
+++ b/cmd/mount2/node.go
@@ -1,3 +1,4 @@
+//go:build linux || (darwin && amd64)
// +build linux darwin,amd64
package mount2
diff --git a/cmd/mountlib/daemon.go b/cmd/mountlib/daemon.go
index 8d27e402d..1896afef2 100644
--- a/cmd/mountlib/daemon.go
+++ b/cmd/mountlib/daemon.go
@@ -1,5 +1,6 @@
// Daemonization interface for non-Unix variants only
+//go:build windows || plan9 || js
// +build windows plan9 js
package mountlib
diff --git a/cmd/mountlib/daemon_unix.go b/cmd/mountlib/daemon_unix.go
index 5842b9393..7aa76c3ca 100644
--- a/cmd/mountlib/daemon_unix.go
+++ b/cmd/mountlib/daemon_unix.go
@@ -1,5 +1,6 @@
// Daemonization interface for Unix variants only
+//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package mountlib
diff --git a/cmd/mountlib/sighup.go b/cmd/mountlib/sighup.go
index a912b8d47..7b661a2db 100644
--- a/cmd/mountlib/sighup.go
+++ b/cmd/mountlib/sighup.go
@@ -1,3 +1,4 @@
+//go:build !plan9 && !js
// +build !plan9,!js
package mountlib
diff --git a/cmd/mountlib/sighup_unsupported.go b/cmd/mountlib/sighup_unsupported.go
index fb8c550aa..b9c80895b 100644
--- a/cmd/mountlib/sighup_unsupported.go
+++ b/cmd/mountlib/sighup_unsupported.go
@@ -1,3 +1,4 @@
+//go:build plan9 || js
// +build plan9 js
package mountlib
diff --git a/cmd/ncdu/ncdu.go b/cmd/ncdu/ncdu.go
index d04b842ff..38f97d659 100644
--- a/cmd/ncdu/ncdu.go
+++ b/cmd/ncdu/ncdu.go
@@ -1,6 +1,7 @@
// Package ncdu implements a text based user interface for exploring a remote
-//+build !plan9,!solaris,!js
+//go:build !plan9 && !solaris && !js
+// +build !plan9,!solaris,!js
package ncdu
diff --git a/cmd/ncdu/ncdu_unsupported.go b/cmd/ncdu/ncdu_unsupported.go
index fac52d63f..6f66cfb6c 100644
--- a/cmd/ncdu/ncdu_unsupported.go
+++ b/cmd/ncdu/ncdu_unsupported.go
@@ -1,6 +1,7 @@
// Build for ncdu for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9 || solaris || js
// +build plan9 solaris js
package ncdu
diff --git a/cmd/selfupdate/help.go b/cmd/selfupdate/help.go
index fe9a63158..a428447b3 100644
--- a/cmd/selfupdate/help.go
+++ b/cmd/selfupdate/help.go
@@ -1,3 +1,4 @@
+//go:build !noselfupdate
// +build !noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/noselfupdate.go b/cmd/selfupdate/noselfupdate.go
index 41afd1c94..05e5ad120 100644
--- a/cmd/selfupdate/noselfupdate.go
+++ b/cmd/selfupdate/noselfupdate.go
@@ -1,3 +1,4 @@
+//go:build noselfupdate
// +build noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/selfupdate.go b/cmd/selfupdate/selfupdate.go
index ec534a714..0e354e1a7 100644
--- a/cmd/selfupdate/selfupdate.go
+++ b/cmd/selfupdate/selfupdate.go
@@ -1,3 +1,4 @@
+//go:build !noselfupdate
// +build !noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/selfupdate_test.go b/cmd/selfupdate/selfupdate_test.go
index a9a889ba7..2e6b15b58 100644
--- a/cmd/selfupdate/selfupdate_test.go
+++ b/cmd/selfupdate/selfupdate_test.go
@@ -1,3 +1,4 @@
+//go:build !noselfupdate
// +build !noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/verify.go b/cmd/selfupdate/verify.go
index 0c135c75c..9cc0cf9d5 100644
--- a/cmd/selfupdate/verify.go
+++ b/cmd/selfupdate/verify.go
@@ -1,3 +1,4 @@
+//go:build !noselfupdate
// +build !noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/writable_unix.go b/cmd/selfupdate/writable_unix.go
index 30cb8a9bf..020f75492 100644
--- a/cmd/selfupdate/writable_unix.go
+++ b/cmd/selfupdate/writable_unix.go
@@ -1,5 +1,5 @@
-// +build !windows,!plan9,!js
-// +build !noselfupdate
+//go:build !windows && !plan9 && !js && !noselfupdate
+// +build !windows,!plan9,!js,!noselfupdate
package selfupdate
diff --git a/cmd/selfupdate/writable_unsupported.go b/cmd/selfupdate/writable_unsupported.go
index bc68073d6..4944e7b46 100644
--- a/cmd/selfupdate/writable_unsupported.go
+++ b/cmd/selfupdate/writable_unsupported.go
@@ -1,3 +1,4 @@
+//go:build (plan9 || js) && !noselfupdate
// +build plan9 js
// +build !noselfupdate
diff --git a/cmd/selfupdate/writable_windows.go b/cmd/selfupdate/writable_windows.go
index 7e23f56dc..eed74b32a 100644
--- a/cmd/selfupdate/writable_windows.go
+++ b/cmd/selfupdate/writable_windows.go
@@ -1,5 +1,5 @@
-// +build windows
-// +build !noselfupdate
+//go:build windows && !noselfupdate
+// +build windows,!noselfupdate
package selfupdate
diff --git a/cmd/selfupdate_disabled.go b/cmd/selfupdate_disabled.go
index 3d666700b..3daf1c88d 100644
--- a/cmd/selfupdate_disabled.go
+++ b/cmd/selfupdate_disabled.go
@@ -1,3 +1,4 @@
+//go:build noselfupdate
// +build noselfupdate
package cmd
diff --git a/cmd/selfupdate_enabled.go b/cmd/selfupdate_enabled.go
index 5ee10354a..41aa5f125 100644
--- a/cmd/selfupdate_enabled.go
+++ b/cmd/selfupdate_enabled.go
@@ -1,3 +1,4 @@
+//go:build !noselfupdate
// +build !noselfupdate
package cmd
diff --git a/cmd/serve/dlna/data/assets_generate.go b/cmd/serve/dlna/data/assets_generate.go
index c2d866622..69230a297 100644
--- a/cmd/serve/dlna/data/assets_generate.go
+++ b/cmd/serve/dlna/data/assets_generate.go
@@ -1,5 +1,6 @@
//go:generate go run assets_generate.go
// The "go:generate" directive compiles static assets by running assets_generate.go
+//go:build ignore
// +build ignore
package main
diff --git a/cmd/serve/dlna/data/assets_vfsdata.go b/cmd/serve/dlna/data/assets_vfsdata.go
index 8a9b8b69f..a33659f0a 100644
--- a/cmd/serve/dlna/data/assets_vfsdata.go
+++ b/cmd/serve/dlna/data/assets_vfsdata.go
@@ -1,5 +1,6 @@
// Code generated by vfsgen; DO NOT EDIT.
+//go:build !dev
// +build !dev
package data
diff --git a/cmd/serve/docker/systemd.go b/cmd/serve/docker/systemd.go
index 049eb7dab..981964c1b 100644
--- a/cmd/serve/docker/systemd.go
+++ b/cmd/serve/docker/systemd.go
@@ -1,3 +1,4 @@
+//go:build linux && !android
// +build linux,!android
package docker
diff --git a/cmd/serve/docker/systemd_unsupported.go b/cmd/serve/docker/systemd_unsupported.go
index acf97a2a7..e25d784c0 100644
--- a/cmd/serve/docker/systemd_unsupported.go
+++ b/cmd/serve/docker/systemd_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux || android
// +build !linux android
package docker
diff --git a/cmd/serve/docker/unix.go b/cmd/serve/docker/unix.go
index 3b93ae36d..696f8d4f7 100644
--- a/cmd/serve/docker/unix.go
+++ b/cmd/serve/docker/unix.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd
// +build linux freebsd
package docker
diff --git a/cmd/serve/docker/unix_unsupported.go b/cmd/serve/docker/unix_unsupported.go
index 75547c7c1..82ef12410 100644
--- a/cmd/serve/docker/unix_unsupported.go
+++ b/cmd/serve/docker/unix_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux && !freebsd
// +build !linux,!freebsd
package docker
diff --git a/cmd/serve/ftp/ftp.go b/cmd/serve/ftp/ftp.go
index a6e9f793b..c3bcab6a9 100644
--- a/cmd/serve/ftp/ftp.go
+++ b/cmd/serve/ftp/ftp.go
@@ -1,6 +1,7 @@
// Package ftp implements an FTP server for rclone
-//+build !plan9
+//go:build !plan9
+// +build !plan9
package ftp
diff --git a/cmd/serve/ftp/ftp_test.go b/cmd/serve/ftp/ftp_test.go
index 3b7cba306..6ac0d344c 100644
--- a/cmd/serve/ftp/ftp_test.go
+++ b/cmd/serve/ftp/ftp_test.go
@@ -3,7 +3,8 @@
//
// We skip tests on platforms with troublesome character mappings
-//+build !windows,!darwin,!plan9
+//go:build !windows && !darwin && !plan9
+// +build !windows,!darwin,!plan9
package ftp
diff --git a/cmd/serve/ftp/ftp_unsupported.go b/cmd/serve/ftp/ftp_unsupported.go
index 76b4b2ecf..05ad78a39 100644
--- a/cmd/serve/ftp/ftp_unsupported.go
+++ b/cmd/serve/ftp/ftp_unsupported.go
@@ -1,6 +1,7 @@
// Build for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9
// +build plan9
package ftp
diff --git a/cmd/serve/http/data/assets_generate.go b/cmd/serve/http/data/assets_generate.go
index ae5d87b3b..6196ba206 100644
--- a/cmd/serve/http/data/assets_generate.go
+++ b/cmd/serve/http/data/assets_generate.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
package main
diff --git a/cmd/serve/http/data/assets_vfsdata.go b/cmd/serve/http/data/assets_vfsdata.go
index dc96cd755..1324e34e4 100644
--- a/cmd/serve/http/data/assets_vfsdata.go
+++ b/cmd/serve/http/data/assets_vfsdata.go
@@ -1,5 +1,6 @@
// Code generated by vfsgen; DO NOT EDIT.
+//go:build !dev
// +build !dev
package data
diff --git a/cmd/serve/proxy/proxy_code.go b/cmd/serve/proxy/proxy_code.go
index 1e2979602..3b7b698b5 100644
--- a/cmd/serve/proxy/proxy_code.go
+++ b/cmd/serve/proxy/proxy_code.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// A simple auth proxy for testing purposes
diff --git a/cmd/serve/servetest/proxy_code.go b/cmd/serve/servetest/proxy_code.go
index 5340e5ee0..291f305fb 100644
--- a/cmd/serve/servetest/proxy_code.go
+++ b/cmd/serve/servetest/proxy_code.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// A simple auth proxy for testing purposes
diff --git a/cmd/serve/sftp/connection.go b/cmd/serve/sftp/connection.go
index 93a80c60b..d269f7108 100644
--- a/cmd/serve/sftp/connection.go
+++ b/cmd/serve/sftp/connection.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/cmd/serve/sftp/connection_test.go b/cmd/serve/sftp/connection_test.go
index 062affe4b..e9f8830cd 100644
--- a/cmd/serve/sftp/connection_test.go
+++ b/cmd/serve/sftp/connection_test.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/cmd/serve/sftp/handler.go b/cmd/serve/sftp/handler.go
index 58e34b48e..aba3601a2 100644
--- a/cmd/serve/sftp/handler.go
+++ b/cmd/serve/sftp/handler.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/cmd/serve/sftp/server.go b/cmd/serve/sftp/server.go
index 278630851..178169714 100644
--- a/cmd/serve/sftp/server.go
+++ b/cmd/serve/sftp/server.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/cmd/serve/sftp/sftp.go b/cmd/serve/sftp/sftp.go
index 9182f38d8..54854044e 100644
--- a/cmd/serve/sftp/sftp.go
+++ b/cmd/serve/sftp/sftp.go
@@ -1,5 +1,6 @@
// Package sftp implements an SFTP server to serve an rclone VFS
+//go:build !plan9
// +build !plan9
package sftp
diff --git a/cmd/serve/sftp/sftp_test.go b/cmd/serve/sftp/sftp_test.go
index 19ff69f41..71305ba75 100644
--- a/cmd/serve/sftp/sftp_test.go
+++ b/cmd/serve/sftp/sftp_test.go
@@ -3,7 +3,8 @@
//
// We skip tests on platforms with troublesome character mappings
-//+build !windows,!darwin,!plan9
+//go:build !windows && !darwin && !plan9
+// +build !windows,!darwin,!plan9
package sftp
diff --git a/cmd/serve/sftp/sftp_unsupported.go b/cmd/serve/sftp/sftp_unsupported.go
index f0126b027..db3d265b5 100644
--- a/cmd/serve/sftp/sftp_unsupported.go
+++ b/cmd/serve/sftp/sftp_unsupported.go
@@ -1,6 +1,7 @@
// Build for sftp for unsupported platforms to stop go complaining
// about "no buildable Go source files "
+//go:build plan9
// +build plan9
package sftp
diff --git a/cmd/serve/webdav/webdav_test.go b/cmd/serve/webdav/webdav_test.go
index cef20546d..b6ee3259a 100644
--- a/cmd/serve/webdav/webdav_test.go
+++ b/cmd/serve/webdav/webdav_test.go
@@ -3,7 +3,8 @@
//
// We skip tests on platforms with troublesome character mappings
-//+build !windows,!darwin
+//go:build !windows && !darwin
+// +build !windows,!darwin
package webdav
diff --git a/cmd/siginfo_darwin.go b/cmd/siginfo_darwin.go
index 67acd8304..62e403277 100644
--- a/cmd/siginfo_darwin.go
+++ b/cmd/siginfo_darwin.go
@@ -1,4 +1,5 @@
-//+build darwin
+//go:build darwin
+// +build darwin
package cmd
diff --git a/cmd/siginfo_others.go b/cmd/siginfo_others.go
index d1c878e27..a2266f632 100644
--- a/cmd/siginfo_others.go
+++ b/cmd/siginfo_others.go
@@ -1,4 +1,5 @@
-//+build !darwin
+//go:build !darwin
+// +build !darwin
package cmd
diff --git a/fs/accounting/accounting_other.go b/fs/accounting/accounting_other.go
index 294677a3c..3dc7f2843 100644
--- a/fs/accounting/accounting_other.go
+++ b/fs/accounting/accounting_other.go
@@ -1,6 +1,7 @@
// Accounting and limiting reader
// Non-unix specific functions.
+//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package accounting
diff --git a/fs/accounting/accounting_unix.go b/fs/accounting/accounting_unix.go
index a59fe83e1..ec79ce544 100644
--- a/fs/accounting/accounting_unix.go
+++ b/fs/accounting/accounting_unix.go
@@ -1,6 +1,7 @@
// Accounting and limiting reader
// Unix specific functions.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package accounting
diff --git a/fs/config/config_read_password.go b/fs/config/config_read_password.go
index 023053c7e..c1a0f4992 100644
--- a/fs/config/config_read_password.go
+++ b/fs/config/config_read_password.go
@@ -2,6 +2,7 @@
// See https://github.com/golang/go/issues/14441 - plan9
// https://github.com/golang/go/issues/13085 - solaris
+//go:build !solaris && !plan9
// +build !solaris,!plan9
package config
diff --git a/fs/config/config_read_password_unsupported.go b/fs/config/config_read_password_unsupported.go
index eb762448c..5a48643ef 100644
--- a/fs/config/config_read_password_unsupported.go
+++ b/fs/config/config_read_password_unsupported.go
@@ -2,6 +2,7 @@
// See https://github.com/golang/go/issues/14441 - plan9
// https://github.com/golang/go/issues/13085 - solaris
+//go:build solaris || plan9
// +build solaris plan9
package config
diff --git a/fs/config/configfile/configfile_other.go b/fs/config/configfile/configfile_other.go
index a55dc26c5..a2380d94c 100644
--- a/fs/config/configfile/configfile_other.go
+++ b/fs/config/configfile/configfile_other.go
@@ -1,6 +1,7 @@
// Read, write and edit the config file
// Non-unix specific functions.
+//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package configfile
diff --git a/fs/config/configfile/configfile_unix.go b/fs/config/configfile/configfile_unix.go
index bfdae94ef..eb985b8b4 100644
--- a/fs/config/configfile/configfile_unix.go
+++ b/fs/config/configfile/configfile_unix.go
@@ -1,6 +1,7 @@
// Read, write and edit the config file
// Unix specific functions.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package configfile
diff --git a/fs/driveletter/driveletter.go b/fs/driveletter/driveletter.go
index 322b244a4..0a683509e 100644
--- a/fs/driveletter/driveletter.go
+++ b/fs/driveletter/driveletter.go
@@ -1,5 +1,6 @@
// Package driveletter returns whether a name is a valid drive letter
+//go:build !windows
// +build !windows
package driveletter
diff --git a/fs/driveletter/driveletter_windows.go b/fs/driveletter/driveletter_windows.go
index 7f63b94d7..40ca94d43 100644
--- a/fs/driveletter/driveletter_windows.go
+++ b/fs/driveletter/driveletter_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package driveletter
diff --git a/fs/fserrors/enospc_error.go b/fs/fserrors/enospc_error.go
index a2cb1d496..930c5a174 100644
--- a/fs/fserrors/enospc_error.go
+++ b/fs/fserrors/enospc_error.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package fserrors
diff --git a/fs/fserrors/enospc_error_notsupported.go b/fs/fserrors/enospc_error_notsupported.go
index c4cd1e940..f71231c17 100644
--- a/fs/fserrors/enospc_error_notsupported.go
+++ b/fs/fserrors/enospc_error_notsupported.go
@@ -1,10 +1,11 @@
+//go:build plan9
// +build plan9
package fserrors
-// IsErrNoSpace() on plan9 returns false because
+// IsErrNoSpace() on plan9 returns false because
// plan9 does not support syscall.ENOSPC error.
func IsErrNoSpace(cause error) (isNoSpc bool) {
isNoSpc = false
- return
+ return
}
diff --git a/fs/fserrors/retriable_errors.go b/fs/fserrors/retriable_errors.go
index 9ec0b5b67..6dd48248f 100644
--- a/fs/fserrors/retriable_errors.go
+++ b/fs/fserrors/retriable_errors.go
@@ -1,3 +1,4 @@
+//go:build !plan9
// +build !plan9
package fserrors
diff --git a/fs/fserrors/retriable_errors_windows.go b/fs/fserrors/retriable_errors_windows.go
index c6bea32ae..9c5ff061f 100644
--- a/fs/fserrors/retriable_errors_windows.go
+++ b/fs/fserrors/retriable_errors_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package fserrors
diff --git a/fs/fspath/fuzz.go b/fs/fspath/fuzz.go
index a03bc0ee2..c40095059 100644
--- a/fs/fspath/fuzz.go
+++ b/fs/fspath/fuzz.go
@@ -1,4 +1,5 @@
-//+build gofuzz
+//go:build gofuzz
+// +build gofuzz
/*
Fuzz test the Parse function
diff --git a/fs/log/redirect_stderr.go b/fs/log/redirect_stderr.go
index 12af61eec..b4e99ef2a 100644
--- a/fs/log/redirect_stderr.go
+++ b/fs/log/redirect_stderr.go
@@ -1,5 +1,6 @@
// Log the panic to the log file - for oses which can't do this
+//go:build !windows && !darwin && !dragonfly && !freebsd && !linux && !nacl && !netbsd && !openbsd
// +build !windows,!darwin,!dragonfly,!freebsd,!linux,!nacl,!netbsd,!openbsd
package log
diff --git a/fs/log/redirect_stderr_unix.go b/fs/log/redirect_stderr_unix.go
index 8ca90f6ad..e0b8e4eca 100644
--- a/fs/log/redirect_stderr_unix.go
+++ b/fs/log/redirect_stderr_unix.go
@@ -1,5 +1,6 @@
// Log the panic under unix to the log file
+//go:build !windows && !solaris && !plan9 && !js
// +build !windows,!solaris,!plan9,!js
package log
diff --git a/fs/log/redirect_stderr_windows.go b/fs/log/redirect_stderr_windows.go
index c800305c3..f55f144f7 100644
--- a/fs/log/redirect_stderr_windows.go
+++ b/fs/log/redirect_stderr_windows.go
@@ -4,6 +4,7 @@
//
// https://play.golang.org/p/kLtct7lSUg
+//go:build windows
// +build windows
package log
diff --git a/fs/log/syslog.go b/fs/log/syslog.go
index 17c8094f9..84c84c908 100644
--- a/fs/log/syslog.go
+++ b/fs/log/syslog.go
@@ -1,5 +1,6 @@
// Syslog interface for non-Unix variants only
+//go:build windows || nacl || plan9
// +build windows nacl plan9
package log
diff --git a/fs/log/syslog_unix.go b/fs/log/syslog_unix.go
index 3c3133e58..ea0d3645a 100644
--- a/fs/log/syslog_unix.go
+++ b/fs/log/syslog_unix.go
@@ -1,5 +1,6 @@
// Syslog interface for Unix variants only
+//go:build !windows && !nacl && !plan9
// +build !windows,!nacl,!plan9
package log
diff --git a/fs/log/systemd.go b/fs/log/systemd.go
index 840b505f2..2e572790a 100644
--- a/fs/log/systemd.go
+++ b/fs/log/systemd.go
@@ -1,5 +1,6 @@
// Systemd interface for non-Unix variants only
+//go:build windows || nacl || plan9
// +build windows nacl plan9
package log
diff --git a/fs/log/systemd_unix.go b/fs/log/systemd_unix.go
index fe001b56d..a2aa8e51c 100644
--- a/fs/log/systemd_unix.go
+++ b/fs/log/systemd_unix.go
@@ -1,5 +1,6 @@
// Systemd interface for Unix variants only
+//go:build !windows && !nacl && !plan9
// +build !windows,!nacl,!plan9
package log
diff --git a/fs/rc/js/main.go b/fs/rc/js/main.go
index 53a1026f0..b5eb93cb7 100644
--- a/fs/rc/js/main.go
+++ b/fs/rc/js/main.go
@@ -2,6 +2,7 @@
//
// This library exports the core rc functionality
+//go:build js
// +build js
package main
diff --git a/fs/rc/js/serve.go b/fs/rc/js/serve.go
index ee9a6b783..30e38e44d 100644
--- a/fs/rc/js/serve.go
+++ b/fs/rc/js/serve.go
@@ -1,4 +1,5 @@
-//+build none
+//go:build none
+// +build none
package main
diff --git a/fs/versioncheck.go b/fs/versioncheck.go
index 35062cf5b..29bbfd8e2 100644
--- a/fs/versioncheck.go
+++ b/fs/versioncheck.go
@@ -1,4 +1,5 @@
-//+build !go1.14
+//go:build !go1.14
+// +build !go1.14
package fs
diff --git a/lib/atexit/atexit_other.go b/lib/atexit/atexit_other.go
index bd9f238bf..90dc70107 100644
--- a/lib/atexit/atexit_other.go
+++ b/lib/atexit/atexit_other.go
@@ -1,4 +1,5 @@
-//+build windows plan9
+//go:build windows || plan9
+// +build windows plan9
package atexit
diff --git a/lib/atexit/atexit_unix.go b/lib/atexit/atexit_unix.go
index 2df372a1a..13c3e292a 100644
--- a/lib/atexit/atexit_unix.go
+++ b/lib/atexit/atexit_unix.go
@@ -1,4 +1,5 @@
-//+build !windows,!plan9
+//go:build !windows && !plan9
+// +build !windows,!plan9
package atexit
diff --git a/lib/buildinfo/cgo.go b/lib/buildinfo/cgo.go
index 8009d3bea..06af926cd 100644
--- a/lib/buildinfo/cgo.go
+++ b/lib/buildinfo/cgo.go
@@ -1,3 +1,4 @@
+//go:build cgo
// +build cgo
package buildinfo
diff --git a/lib/buildinfo/osversion.go b/lib/buildinfo/osversion.go
index 8090f419a..b398702d5 100644
--- a/lib/buildinfo/osversion.go
+++ b/lib/buildinfo/osversion.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package buildinfo
diff --git a/lib/encoder/filename/fuzz.go b/lib/encoder/filename/fuzz.go
index 5983a407f..e0843f04c 100644
--- a/lib/encoder/filename/fuzz.go
+++ b/lib/encoder/filename/fuzz.go
@@ -1,4 +1,5 @@
-//+build gofuzz
+//go:build gofuzz
+// +build gofuzz
package filename
diff --git a/lib/encoder/filename/gentable.go b/lib/encoder/filename/gentable.go
index 5475c60ab..13c8a7d91 100644
--- a/lib/encoder/filename/gentable.go
+++ b/lib/encoder/filename/gentable.go
@@ -1,4 +1,5 @@
-//+build ignore
+//go:build ignore
+// +build ignore
package main
diff --git a/lib/encoder/os_darwin.go b/lib/encoder/os_darwin.go
index 7eb128bb2..70dad00ab 100644
--- a/lib/encoder/os_darwin.go
+++ b/lib/encoder/os_darwin.go
@@ -1,4 +1,5 @@
-//+build darwin
+//go:build darwin
+// +build darwin
package encoder
diff --git a/lib/encoder/os_other.go b/lib/encoder/os_other.go
index 32a916fb4..9fa043570 100644
--- a/lib/encoder/os_other.go
+++ b/lib/encoder/os_other.go
@@ -1,4 +1,5 @@
-//+build !windows,!darwin
+//go:build !windows && !darwin
+// +build !windows,!darwin
package encoder
diff --git a/lib/encoder/os_windows.go b/lib/encoder/os_windows.go
index d06b28243..87b47b646 100644
--- a/lib/encoder/os_windows.go
+++ b/lib/encoder/os_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package encoder
diff --git a/lib/file/driveletter_other.go b/lib/file/driveletter_other.go
index 16e6e641f..f18855823 100644
--- a/lib/file/driveletter_other.go
+++ b/lib/file/driveletter_other.go
@@ -1,4 +1,5 @@
-//+build !windows
+//go:build !windows
+// +build !windows
package file
diff --git a/lib/file/driveletter_windows.go b/lib/file/driveletter_windows.go
index ca080fc9c..352907ab9 100644
--- a/lib/file/driveletter_windows.go
+++ b/lib/file/driveletter_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package file
diff --git a/lib/file/file_other.go b/lib/file/file_other.go
index 5094cd6a1..cfa8cf0f1 100644
--- a/lib/file/file_other.go
+++ b/lib/file/file_other.go
@@ -1,4 +1,5 @@
-//+build !windows
+//go:build !windows
+// +build !windows
package file
diff --git a/lib/file/file_windows.go b/lib/file/file_windows.go
index dec7e0a36..0f797f731 100644
--- a/lib/file/file_windows.go
+++ b/lib/file/file_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package file
diff --git a/lib/file/preallocate_other.go b/lib/file/preallocate_other.go
index 87b01799e..bcb2f2783 100644
--- a/lib/file/preallocate_other.go
+++ b/lib/file/preallocate_other.go
@@ -1,4 +1,5 @@
-//+build !windows,!linux
+//go:build !windows && !linux
+// +build !windows,!linux
package file
diff --git a/lib/file/preallocate_unix.go b/lib/file/preallocate_unix.go
index 6f666410f..e6f85272c 100644
--- a/lib/file/preallocate_unix.go
+++ b/lib/file/preallocate_unix.go
@@ -1,4 +1,5 @@
-//+build linux
+//go:build linux
+// +build linux
package file
diff --git a/lib/file/preallocate_windows.go b/lib/file/preallocate_windows.go
index 11b39ad15..afa33fe4b 100644
--- a/lib/file/preallocate_windows.go
+++ b/lib/file/preallocate_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package file
diff --git a/lib/file/unc.go b/lib/file/unc.go
index 41661336d..c55573dc3 100644
--- a/lib/file/unc.go
+++ b/lib/file/unc.go
@@ -1,4 +1,5 @@
-//+build !windows
+//go:build !windows
+// +build !windows
package file
diff --git a/lib/file/unc_test.go b/lib/file/unc_test.go
index 5a22fe8ca..d4bb2138e 100644
--- a/lib/file/unc_test.go
+++ b/lib/file/unc_test.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package file
diff --git a/lib/file/unc_windows.go b/lib/file/unc_windows.go
index 5881befed..36cadf1d2 100644
--- a/lib/file/unc_windows.go
+++ b/lib/file/unc_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package file
diff --git a/lib/israce/israce.go b/lib/israce/israce.go
index 82f296590..99371f530 100644
--- a/lib/israce/israce.go
+++ b/lib/israce/israce.go
@@ -1,3 +1,4 @@
+//go:build race
// +build race
// Package israce reports if the Go race detector is enabled.
diff --git a/lib/israce/norace.go b/lib/israce/norace.go
index 559b56715..ecede869b 100644
--- a/lib/israce/norace.go
+++ b/lib/israce/norace.go
@@ -1,3 +1,4 @@
+//go:build !race
// +build !race
// Package israce reports if the Go race detector is enabled.
diff --git a/lib/mmap/mmap_unix.go b/lib/mmap/mmap_unix.go
index a5129261f..f5c7f40c2 100644
--- a/lib/mmap/mmap_unix.go
+++ b/lib/mmap/mmap_unix.go
@@ -1,6 +1,7 @@
// Package mmap implements a large block memory allocator using
// anonymous memory maps.
+//go:build !plan9 && !windows && !js
// +build !plan9,!windows,!js
package mmap
diff --git a/lib/mmap/mmap_unsupported.go b/lib/mmap/mmap_unsupported.go
index 7f956c7b8..264a4df46 100644
--- a/lib/mmap/mmap_unsupported.go
+++ b/lib/mmap/mmap_unsupported.go
@@ -1,5 +1,6 @@
// Fallback Alloc and Free for unsupported OSes
+//go:build plan9 || js
// +build plan9 js
package mmap
diff --git a/lib/mmap/mmap_windows.go b/lib/mmap/mmap_windows.go
index 436085527..ce57aadef 100644
--- a/lib/mmap/mmap_windows.go
+++ b/lib/mmap/mmap_windows.go
@@ -1,6 +1,7 @@
// Package mmap implements a large block memory allocator using
// anonymous memory maps.
+//go:build windows
// +build windows
package mmap
diff --git a/lib/plugin/plugin.go b/lib/plugin/plugin.go
index ab604a429..fb08c9420 100644
--- a/lib/plugin/plugin.go
+++ b/lib/plugin/plugin.go
@@ -1,3 +1,4 @@
+//go:build (darwin || linux) && !gccgo
// +build darwin linux
// +build !gccgo
diff --git a/lib/terminal/hidden_other.go b/lib/terminal/hidden_other.go
index 2a15b21b1..e5bf08ca9 100644
--- a/lib/terminal/hidden_other.go
+++ b/lib/terminal/hidden_other.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package terminal
diff --git a/lib/terminal/hidden_windows.go b/lib/terminal/hidden_windows.go
index 0745e87ed..5ef539fbe 100644
--- a/lib/terminal/hidden_windows.go
+++ b/lib/terminal/hidden_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package terminal
diff --git a/lib/terminal/terminal_normal.go b/lib/terminal/terminal_normal.go
index d8531ebf5..474716275 100644
--- a/lib/terminal/terminal_normal.go
+++ b/lib/terminal/terminal_normal.go
@@ -1,4 +1,5 @@
-//+build !js
+//go:build !js
+// +build !js
package terminal
diff --git a/lib/terminal/terminal_unsupported.go b/lib/terminal/terminal_unsupported.go
index d26fb6291..d1e743d2c 100644
--- a/lib/terminal/terminal_unsupported.go
+++ b/lib/terminal/terminal_unsupported.go
@@ -1,4 +1,5 @@
-//+build js
+//go:build js
+// +build js
package terminal
diff --git a/vfs/make_open_tests.go b/vfs/make_open_tests.go
index 8fbd34625..d20a0e290 100644
--- a/vfs/make_open_tests.go
+++ b/vfs/make_open_tests.go
@@ -7,7 +7,8 @@
//
// Run with go generate (defined in vfs.go)
//
-//+build none
+//go:build none
+// +build none
// FIXME include read too?
diff --git a/vfs/vfsflags/vfsflags_non_unix.go b/vfs/vfsflags/vfsflags_non_unix.go
index 6e90fac77..dd7250e57 100644
--- a/vfs/vfsflags/vfsflags_non_unix.go
+++ b/vfs/vfsflags/vfsflags_non_unix.go
@@ -1,3 +1,4 @@
+//go:build !linux && !darwin && !freebsd
// +build !linux,!darwin,!freebsd
package vfsflags
diff --git a/vfs/vfsflags/vfsflags_unix.go b/vfs/vfsflags/vfsflags_unix.go
index 1c1a802fd..08d8159eb 100644
--- a/vfs/vfsflags/vfsflags_unix.go
+++ b/vfs/vfsflags/vfsflags_unix.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin || freebsd
// +build linux darwin freebsd
package vfsflags
diff --git a/vfs/vfstest/read_non_unix.go b/vfs/vfstest/read_non_unix.go
index a874d4017..cbb60bbe5 100644
--- a/vfs/vfstest/read_non_unix.go
+++ b/vfs/vfstest/read_non_unix.go
@@ -1,3 +1,4 @@
+//go:build !linux && !darwin && !freebsd
// +build !linux,!darwin,!freebsd
package vfstest
diff --git a/vfs/vfstest/read_unix.go b/vfs/vfstest/read_unix.go
index c56f47ac3..afeeb197d 100644
--- a/vfs/vfstest/read_unix.go
+++ b/vfs/vfstest/read_unix.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin || freebsd
// +build linux darwin freebsd
package vfstest
diff --git a/vfs/vfstest/write_non_unix.go b/vfs/vfstest/write_non_unix.go
index dc07983a4..84b5bf00a 100644
--- a/vfs/vfstest/write_non_unix.go
+++ b/vfs/vfstest/write_non_unix.go
@@ -1,3 +1,4 @@
+//go:build !linux && !darwin && !freebsd
// +build !linux,!darwin,!freebsd
package vfstest
diff --git a/vfs/vfstest/write_unix.go b/vfs/vfstest/write_unix.go
index 1c51d142a..0d412be07 100644
--- a/vfs/vfstest/write_unix.go
+++ b/vfs/vfstest/write_unix.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin || freebsd
// +build linux darwin freebsd
package vfstest