From 23e9066b4fb9d20215a717551f056d24f37b45f4 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 20 Aug 2025 21:59:37 +0100 Subject: [PATCH] build: make rclone build with wasip1/wasm as well as js/wasm Fixes #7831 --- backend/azureblob/azureblob.go | 2 +- backend/azureblob/azureblob_internal_test.go | 2 +- backend/azureblob/azureblob_test.go | 2 +- backend/azureblob/azureblob_unsupported.go | 2 +- backend/azurefiles/azurefiles.go | 2 +- .../azurefiles/azurefiles_internal_test.go | 2 +- backend/azurefiles/azurefiles_test.go | 2 +- backend/azurefiles/azurefiles_unsupported.go | 2 +- backend/cache/cache.go | 2 +- backend/cache/cache_internal_test.go | 2 +- backend/cache/cache_test.go | 2 +- backend/cache/cache_unsupported.go | 2 +- backend/cache/cache_upload_test.go | 2 +- backend/cache/directory.go | 2 +- backend/cache/handle.go | 2 +- backend/cache/object.go | 2 +- backend/cache/plex.go | 2 +- backend/cache/storage_memory.go | 2 +- backend/cache/storage_persistent.go | 2 +- backend/cache/utils_test.go | 3 +-- backend/local/lchmod.go | 2 +- backend/local/lchmod_unix.go | 2 +- backend/local/lchtimes.go | 2 +- backend/local/lchtimes_unix.go | 2 +- backend/local/metadata_other.go | 2 +- backend/local/symlink.go | 2 +- backend/local/symlink_other.go | 2 +- backend/oracleobjectstorage/byok.go | 2 +- backend/oracleobjectstorage/client.go | 2 +- backend/oracleobjectstorage/command.go | 2 +- backend/oracleobjectstorage/copy.go | 2 +- backend/oracleobjectstorage/multipart.go | 2 +- backend/oracleobjectstorage/object.go | 2 +- backend/oracleobjectstorage/options.go | 2 +- .../oracleobjectstorage.go | 2 +- .../oracleobjectstorage_test.go | 2 +- .../oracleobjectstorage_unsupported.go | 2 +- backend/oracleobjectstorage/waiter.go | 2 +- backend/protondrive/protondrive.go | 2 ++ backend/protondrive/protondrive_test.go | 2 ++ .../protondrive/protondrive_unsupported.go | 7 +++++++ backend/qingstor/qingstor.go | 2 +- backend/qingstor/qingstor_test.go | 2 +- backend/qingstor/qingstor_unsupported.go | 2 +- backend/qingstor/upload.go | 2 +- backend/sftp/sftp.go | 2 +- backend/sftp/sftp_internal_test.go | 2 +- backend/sftp/sftp_test.go | 2 +- backend/sftp/sftp_unsupported.go | 2 +- backend/sftp/ssh.go | 2 +- backend/sftp/ssh_external.go | 2 +- backend/sftp/ssh_internal.go | 2 +- backend/sftp/stringlock.go | 2 +- backend/sftp/stringlock_test.go | 2 +- bin/cross-compile.go | 1 + cmd/cachestats/cachestats.go | 2 +- cmd/cachestats/cachestats_unsupported.go | 2 +- cmd/mountlib/sighup.go | 2 +- cmd/mountlib/sighup_unsupported.go | 2 +- cmd/ncdu/ncdu.go | 2 +- cmd/ncdu/ncdu_unsupported.go | 2 +- cmd/selfupdate/writable_unix.go | 2 +- cmd/selfupdate/writable_unsupported.go | 2 +- cmd/serve/sftp/connection.go | 2 +- cmd/serve/sftp/connection_test.go | 2 +- cmd/serve/sftp/handler.go | 2 +- cmd/serve/sftp/server.go | 2 +- cmd/serve/sftp/sftp.go | 2 +- cmd/serve/sftp/sftp_test.go | 2 +- cmd/serve/sftp/sftp_unsupported.go | 2 +- fs/daemon_other.go | 2 +- fs/daemon_unix.go | 2 +- fs/fserrors/retriable_errors.go | 2 +- fs/fserrors/retriable_errors_wasm.go | 21 +++++++++++++++++++ fs/log/redirect_stderr_unix.go | 2 +- fs/rc/js/main.go | 2 +- lib/diskusage/diskusage_unsupported.go | 2 +- lib/kv/bolt.go | 2 +- lib/kv/internal_test.go | 2 +- lib/kv/unsupported.go | 2 +- lib/mmap/mmap_unix.go | 2 +- lib/mmap/mmap_unsupported.go | 2 +- lib/terminal/terminal_normal.go | 2 +- lib/terminal/terminal_unsupported.go | 2 +- 84 files changed, 112 insertions(+), 80 deletions(-) create mode 100644 backend/protondrive/protondrive_unsupported.go create mode 100644 fs/fserrors/retriable_errors_wasm.go diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 71166f3b3..0e8266dc4 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm // Package azureblob provides an interface to the Microsoft Azure blob object storage system package azureblob diff --git a/backend/azureblob/azureblob_internal_test.go b/backend/azureblob/azureblob_internal_test.go index 67669775d..0a8132fb3 100644 --- a/backend/azureblob/azureblob_internal_test.go +++ b/backend/azureblob/azureblob_internal_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package azureblob diff --git a/backend/azureblob/azureblob_test.go b/backend/azureblob/azureblob_test.go index 6f2b65acf..68d15eecf 100644 --- a/backend/azureblob/azureblob_test.go +++ b/backend/azureblob/azureblob_test.go @@ -1,6 +1,6 @@ // Test AzureBlob filesystem interface -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package azureblob diff --git a/backend/azureblob/azureblob_unsupported.go b/backend/azureblob/azureblob_unsupported.go index 50fcea34c..6d39dcdd8 100644 --- a/backend/azureblob/azureblob_unsupported.go +++ b/backend/azureblob/azureblob_unsupported.go @@ -1,7 +1,7 @@ // Build for azureblob for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || solaris || js +//go:build plan9 || solaris || js || wasm // Package azureblob provides an interface to the Microsoft Azure blob object storage system package azureblob diff --git a/backend/azurefiles/azurefiles.go b/backend/azurefiles/azurefiles.go index a9fed6e2b..397940d8f 100644 --- a/backend/azurefiles/azurefiles.go +++ b/backend/azurefiles/azurefiles.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package azurefiles provides an interface to Microsoft Azure Files package azurefiles diff --git a/backend/azurefiles/azurefiles_internal_test.go b/backend/azurefiles/azurefiles_internal_test.go index 4996267a1..81e0f7b1d 100644 --- a/backend/azurefiles/azurefiles_internal_test.go +++ b/backend/azurefiles/azurefiles_internal_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package azurefiles diff --git a/backend/azurefiles/azurefiles_test.go b/backend/azurefiles/azurefiles_test.go index 987d08494..79d82bd77 100644 --- a/backend/azurefiles/azurefiles_test.go +++ b/backend/azurefiles/azurefiles_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package azurefiles diff --git a/backend/azurefiles/azurefiles_unsupported.go b/backend/azurefiles/azurefiles_unsupported.go index d2723e62f..8d9059f8a 100644 --- a/backend/azurefiles/azurefiles_unsupported.go +++ b/backend/azurefiles/azurefiles_unsupported.go @@ -1,7 +1,7 @@ // Build for azurefiles for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || js +//go:build plan9 || js || wasm // Package azurefiles provides an interface to Microsoft Azure Files package azurefiles diff --git a/backend/cache/cache.go b/backend/cache/cache.go index 6977ff2d7..f1c1a239e 100644 --- a/backend/cache/cache.go +++ b/backend/cache/cache.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package cache implements a virtual provider to cache existing remotes. package cache diff --git a/backend/cache/cache_internal_test.go b/backend/cache/cache_internal_test.go index 0138d8d83..08c9ce8d8 100644 --- a/backend/cache/cache_internal_test.go +++ b/backend/cache/cache_internal_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js && !race +//go:build !plan9 && !js && !wasm && !race package cache_test diff --git a/backend/cache/cache_test.go b/backend/cache/cache_test.go index 96b7e36ae..c026f5b2b 100644 --- a/backend/cache/cache_test.go +++ b/backend/cache/cache_test.go @@ -1,6 +1,6 @@ // Test Cache filesystem interface -//go:build !plan9 && !js && !race +//go:build !plan9 && !js && !wasm && !race package cache_test diff --git a/backend/cache/cache_unsupported.go b/backend/cache/cache_unsupported.go index 8c94aaf26..86c0e4866 100644 --- a/backend/cache/cache_unsupported.go +++ b/backend/cache/cache_unsupported.go @@ -1,7 +1,7 @@ // Build for cache for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || js +//go:build plan9 || js || wasm // Package cache implements a virtual provider to cache existing remotes. package cache diff --git a/backend/cache/cache_upload_test.go b/backend/cache/cache_upload_test.go index a47a1792a..d26f00946 100644 --- a/backend/cache/cache_upload_test.go +++ b/backend/cache/cache_upload_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js && !race +//go:build !plan9 && !js && !wasm && !race package cache_test diff --git a/backend/cache/directory.go b/backend/cache/directory.go index 5c45db9c7..1d341291b 100644 --- a/backend/cache/directory.go +++ b/backend/cache/directory.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/handle.go b/backend/cache/handle.go index c12080043..49165ca3a 100644 --- a/backend/cache/handle.go +++ b/backend/cache/handle.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/object.go b/backend/cache/object.go index 87c292804..8711b5831 100644 --- a/backend/cache/object.go +++ b/backend/cache/object.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/plex.go b/backend/cache/plex.go index ff686f793..18dfed012 100644 --- a/backend/cache/plex.go +++ b/backend/cache/plex.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/storage_memory.go b/backend/cache/storage_memory.go index 2b2acf8f4..3c45369e0 100644 --- a/backend/cache/storage_memory.go +++ b/backend/cache/storage_memory.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/storage_persistent.go b/backend/cache/storage_persistent.go index 737b2e4ae..7b395ea09 100644 --- a/backend/cache/storage_persistent.go +++ b/backend/cache/storage_persistent.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/cache/utils_test.go b/backend/cache/utils_test.go index 9f85b0155..4f9998c93 100644 --- a/backend/cache/utils_test.go +++ b/backend/cache/utils_test.go @@ -1,5 +1,4 @@ -//go:build !plan9 && !js -// +build !plan9,!js +//go:build !plan9 && !js && !wasm package cache diff --git a/backend/local/lchmod.go b/backend/local/lchmod.go index 823718dfe..df463bbf5 100644 --- a/backend/local/lchmod.go +++ b/backend/local/lchmod.go @@ -1,4 +1,4 @@ -//go:build windows || plan9 || js || linux +//go:build windows || plan9 || js || wasm || linux package local diff --git a/backend/local/lchmod_unix.go b/backend/local/lchmod_unix.go index f1fdc4745..4f3e3f610 100644 --- a/backend/local/lchmod_unix.go +++ b/backend/local/lchmod_unix.go @@ -1,4 +1,4 @@ -//go:build !windows && !plan9 && !js && !linux +//go:build !windows && !plan9 && !js && !wasm && !linux package local diff --git a/backend/local/lchtimes.go b/backend/local/lchtimes.go index fcabdcc34..46fb3dc3b 100644 --- a/backend/local/lchtimes.go +++ b/backend/local/lchtimes.go @@ -1,4 +1,4 @@ -//go:build plan9 || js +//go:build plan9 || js || wasm package local diff --git a/backend/local/lchtimes_unix.go b/backend/local/lchtimes_unix.go index 96889db47..59a37ba1a 100644 --- a/backend/local/lchtimes_unix.go +++ b/backend/local/lchtimes_unix.go @@ -1,4 +1,4 @@ -//go:build !windows && !plan9 && !js +//go:build !windows && !plan9 && !js && !wasm package local diff --git a/backend/local/metadata_other.go b/backend/local/metadata_other.go index dc6a5a736..c7c9a97a9 100644 --- a/backend/local/metadata_other.go +++ b/backend/local/metadata_other.go @@ -1,4 +1,4 @@ -//go:build dragonfly || plan9 || js +//go:build dragonfly || plan9 || js || wasm package local diff --git a/backend/local/symlink.go b/backend/local/symlink.go index bdce264c7..b7c69a0fc 100644 --- a/backend/local/symlink.go +++ b/backend/local/symlink.go @@ -1,4 +1,4 @@ -//go:build !windows && !plan9 && !js +//go:build !windows && !plan9 && !js && !wasm package local diff --git a/backend/local/symlink_other.go b/backend/local/symlink_other.go index 2d5bcab07..457e7d2ae 100644 --- a/backend/local/symlink_other.go +++ b/backend/local/symlink_other.go @@ -1,4 +1,4 @@ -//go:build windows || plan9 || js +//go:build windows || plan9 || js || wasm package local diff --git a/backend/oracleobjectstorage/byok.go b/backend/oracleobjectstorage/byok.go index b3392515b..b0cddddf7 100644 --- a/backend/oracleobjectstorage/byok.go +++ b/backend/oracleobjectstorage/byok.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/client.go b/backend/oracleobjectstorage/client.go index 0749c4699..d44deddad 100644 --- a/backend/oracleobjectstorage/client.go +++ b/backend/oracleobjectstorage/client.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/command.go b/backend/oracleobjectstorage/command.go index fa687fef8..52aeec1a2 100644 --- a/backend/oracleobjectstorage/command.go +++ b/backend/oracleobjectstorage/command.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/copy.go b/backend/oracleobjectstorage/copy.go index 76b5d939c..7ac186db3 100644 --- a/backend/oracleobjectstorage/copy.go +++ b/backend/oracleobjectstorage/copy.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/multipart.go b/backend/oracleobjectstorage/multipart.go index d3f471b91..966974d22 100644 --- a/backend/oracleobjectstorage/multipart.go +++ b/backend/oracleobjectstorage/multipart.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/object.go b/backend/oracleobjectstorage/object.go index d9cc20f84..2568eb711 100644 --- a/backend/oracleobjectstorage/object.go +++ b/backend/oracleobjectstorage/object.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/options.go b/backend/oracleobjectstorage/options.go index f24a4d156..0ef1fa9d0 100644 --- a/backend/oracleobjectstorage/options.go +++ b/backend/oracleobjectstorage/options.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/oracleobjectstorage.go b/backend/oracleobjectstorage/oracleobjectstorage.go index 5204b2214..24e704d87 100644 --- a/backend/oracleobjectstorage/oracleobjectstorage.go +++ b/backend/oracleobjectstorage/oracleobjectstorage.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm // Package oracleobjectstorage provides an interface to the OCI object storage system. package oracleobjectstorage diff --git a/backend/oracleobjectstorage/oracleobjectstorage_test.go b/backend/oracleobjectstorage/oracleobjectstorage_test.go index f41dfb605..a8f72450a 100644 --- a/backend/oracleobjectstorage/oracleobjectstorage_test.go +++ b/backend/oracleobjectstorage/oracleobjectstorage_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/oracleobjectstorage/oracleobjectstorage_unsupported.go b/backend/oracleobjectstorage/oracleobjectstorage_unsupported.go index ccbc39316..de363d930 100644 --- a/backend/oracleobjectstorage/oracleobjectstorage_unsupported.go +++ b/backend/oracleobjectstorage/oracleobjectstorage_unsupported.go @@ -1,7 +1,7 @@ // Build for oracleobjectstorage for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || solaris || js +//go:build plan9 || solaris || js || wasm // Package oracleobjectstorage provides an interface to the OCI object storage system. package oracleobjectstorage diff --git a/backend/oracleobjectstorage/waiter.go b/backend/oracleobjectstorage/waiter.go index d09f00033..9c13383a3 100644 --- a/backend/oracleobjectstorage/waiter.go +++ b/backend/oracleobjectstorage/waiter.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !solaris && !js +//go:build !plan9 && !solaris && !js && !wasm package oracleobjectstorage diff --git a/backend/protondrive/protondrive.go b/backend/protondrive/protondrive.go index 821e3f9c7..25eb1861e 100644 --- a/backend/protondrive/protondrive.go +++ b/backend/protondrive/protondrive.go @@ -1,3 +1,5 @@ +//go:build !wasm + // Package protondrive implements the Proton Drive backend package protondrive diff --git a/backend/protondrive/protondrive_test.go b/backend/protondrive/protondrive_test.go index 86aa0c075..0047efdad 100644 --- a/backend/protondrive/protondrive_test.go +++ b/backend/protondrive/protondrive_test.go @@ -1,3 +1,5 @@ +//go:build !wasm + package protondrive_test import ( diff --git a/backend/protondrive/protondrive_unsupported.go b/backend/protondrive/protondrive_unsupported.go new file mode 100644 index 000000000..a6893baa2 --- /dev/null +++ b/backend/protondrive/protondrive_unsupported.go @@ -0,0 +1,7 @@ +// Build for sftp for unsupported platforms to stop go complaining +// about "no buildable Go source files " + +//go:build wasm + +// Package protondrive implements the Proton Drive backend +package protondrive diff --git a/backend/qingstor/qingstor.go b/backend/qingstor/qingstor.go index 39113d149..997aab073 100644 --- a/backend/qingstor/qingstor.go +++ b/backend/qingstor/qingstor.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package qingstor provides an interface to QingStor object storage // Home: https://www.qingcloud.com/ diff --git a/backend/qingstor/qingstor_test.go b/backend/qingstor/qingstor_test.go index d599b79e0..40fe7daf7 100644 --- a/backend/qingstor/qingstor_test.go +++ b/backend/qingstor/qingstor_test.go @@ -1,6 +1,6 @@ // Test QingStor filesystem interface -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package qingstor diff --git a/backend/qingstor/qingstor_unsupported.go b/backend/qingstor/qingstor_unsupported.go index e16a2e80c..c36968ff7 100644 --- a/backend/qingstor/qingstor_unsupported.go +++ b/backend/qingstor/qingstor_unsupported.go @@ -1,7 +1,7 @@ // Build for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || js +//go:build plan9 || js || wasm // Package qingstor provides an interface to QingStor object storage // Home: https://www.qingcloud.com/ diff --git a/backend/qingstor/upload.go b/backend/qingstor/upload.go index 14ea24aa9..66f105c22 100644 --- a/backend/qingstor/upload.go +++ b/backend/qingstor/upload.go @@ -1,6 +1,6 @@ // Upload object to QingStor -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package qingstor diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index e3d5242fb..dcc58467c 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm // Package sftp provides a filesystem interface using github.com/pkg/sftp package sftp diff --git a/backend/sftp/sftp_internal_test.go b/backend/sftp/sftp_internal_test.go index e799f6654..994a1f121 100644 --- a/backend/sftp/sftp_internal_test.go +++ b/backend/sftp/sftp_internal_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/backend/sftp/sftp_test.go b/backend/sftp/sftp_test.go index 2e9ad9f20..64a27e1ec 100644 --- a/backend/sftp/sftp_test.go +++ b/backend/sftp/sftp_test.go @@ -1,6 +1,6 @@ // Test Sftp filesystem interface -//go:build !plan9 +//go:build !plan9 && !wasm package sftp_test diff --git a/backend/sftp/sftp_unsupported.go b/backend/sftp/sftp_unsupported.go index 67794bc4f..b441913f9 100644 --- a/backend/sftp/sftp_unsupported.go +++ b/backend/sftp/sftp_unsupported.go @@ -1,7 +1,7 @@ // Build for sftp for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 +//go:build plan9 || wasm // Package sftp provides a filesystem interface using github.com/pkg/sftp package sftp diff --git a/backend/sftp/ssh.go b/backend/sftp/ssh.go index d0a25e29e..e09677427 100644 --- a/backend/sftp/ssh.go +++ b/backend/sftp/ssh.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/backend/sftp/ssh_external.go b/backend/sftp/ssh_external.go index a42cdd7cc..c8032b1b1 100644 --- a/backend/sftp/ssh_external.go +++ b/backend/sftp/ssh_external.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/backend/sftp/ssh_internal.go b/backend/sftp/ssh_internal.go index 2508bbf31..84efa64c2 100644 --- a/backend/sftp/ssh_internal.go +++ b/backend/sftp/ssh_internal.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/backend/sftp/stringlock.go b/backend/sftp/stringlock.go index df658f961..d8933405b 100644 --- a/backend/sftp/stringlock.go +++ b/backend/sftp/stringlock.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/backend/sftp/stringlock_test.go b/backend/sftp/stringlock_test.go index ded8f3cfd..c279dc243 100644 --- a/backend/sftp/stringlock_test.go +++ b/backend/sftp/stringlock_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/bin/cross-compile.go b/bin/cross-compile.go index a89bac327..4f77bf01c 100644 --- a/bin/cross-compile.go +++ b/bin/cross-compile.go @@ -74,6 +74,7 @@ var osarches = []string{ "plan9/amd64", "solaris/amd64", "js/wasm", + "wasip1/wasm", } // Special environment flags for a given arch diff --git a/cmd/cachestats/cachestats.go b/cmd/cachestats/cachestats.go index 115bbd534..ff93472df 100644 --- a/cmd/cachestats/cachestats.go +++ b/cmd/cachestats/cachestats.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package cachestats provides the cachestats command. package cachestats diff --git a/cmd/cachestats/cachestats_unsupported.go b/cmd/cachestats/cachestats_unsupported.go index 1ab469e91..d40f8a831 100644 --- a/cmd/cachestats/cachestats_unsupported.go +++ b/cmd/cachestats/cachestats_unsupported.go @@ -1,7 +1,7 @@ // Build for cache for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || js +//go:build plan9 || js || wasm // Package cachestats provides the cachestats command. package cachestats diff --git a/cmd/mountlib/sighup.go b/cmd/mountlib/sighup.go index 2dfbf9621..c65c4c2ca 100644 --- a/cmd/mountlib/sighup.go +++ b/cmd/mountlib/sighup.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package mountlib diff --git a/cmd/mountlib/sighup_unsupported.go b/cmd/mountlib/sighup_unsupported.go index 8e786f696..8a70cc882 100644 --- a/cmd/mountlib/sighup_unsupported.go +++ b/cmd/mountlib/sighup_unsupported.go @@ -1,4 +1,4 @@ -//go:build plan9 || js +//go:build plan9 || js || wasm package mountlib diff --git a/cmd/ncdu/ncdu.go b/cmd/ncdu/ncdu.go index 41dbcd75a..17d8fd419 100644 --- a/cmd/ncdu/ncdu.go +++ b/cmd/ncdu/ncdu.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package ncdu implements a text based user interface for exploring a remote package ncdu diff --git a/cmd/ncdu/ncdu_unsupported.go b/cmd/ncdu/ncdu_unsupported.go index 34d99ed6c..2fda897d0 100644 --- a/cmd/ncdu/ncdu_unsupported.go +++ b/cmd/ncdu/ncdu_unsupported.go @@ -1,7 +1,7 @@ // Build for ncdu for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 || js +//go:build plan9 || js || wasm // Package ncdu implements a text based user interface for exploring a remote package ncdu diff --git a/cmd/selfupdate/writable_unix.go b/cmd/selfupdate/writable_unix.go index 48c355717..f45347901 100644 --- a/cmd/selfupdate/writable_unix.go +++ b/cmd/selfupdate/writable_unix.go @@ -1,4 +1,4 @@ -//go:build !windows && !plan9 && !js && !noselfupdate +//go:build !windows && !plan9 && !js && !wasm && !noselfupdate package selfupdate diff --git a/cmd/selfupdate/writable_unsupported.go b/cmd/selfupdate/writable_unsupported.go index 0f0380c01..6f271e855 100644 --- a/cmd/selfupdate/writable_unsupported.go +++ b/cmd/selfupdate/writable_unsupported.go @@ -1,4 +1,4 @@ -//go:build (plan9 || js) && !noselfupdate +//go:build (plan9 || js || wasm) && !noselfupdate package selfupdate diff --git a/cmd/serve/sftp/connection.go b/cmd/serve/sftp/connection.go index 3fc4396cf..fc078f6d5 100644 --- a/cmd/serve/sftp/connection.go +++ b/cmd/serve/sftp/connection.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/cmd/serve/sftp/connection_test.go b/cmd/serve/sftp/connection_test.go index b406e79f4..36159bf94 100644 --- a/cmd/serve/sftp/connection_test.go +++ b/cmd/serve/sftp/connection_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/cmd/serve/sftp/handler.go b/cmd/serve/sftp/handler.go index f7c9c3c47..290bd69d6 100644 --- a/cmd/serve/sftp/handler.go +++ b/cmd/serve/sftp/handler.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/cmd/serve/sftp/server.go b/cmd/serve/sftp/server.go index 17889503d..1062cf69b 100644 --- a/cmd/serve/sftp/server.go +++ b/cmd/serve/sftp/server.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package sftp diff --git a/cmd/serve/sftp/sftp.go b/cmd/serve/sftp/sftp.go index 4f641874c..de1a6d7ca 100644 --- a/cmd/serve/sftp/sftp.go +++ b/cmd/serve/sftp/sftp.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm // Package sftp implements an SFTP server to serve an rclone VFS package sftp diff --git a/cmd/serve/sftp/sftp_test.go b/cmd/serve/sftp/sftp_test.go index e18d6b86d..c4a5cea41 100644 --- a/cmd/serve/sftp/sftp_test.go +++ b/cmd/serve/sftp/sftp_test.go @@ -3,7 +3,7 @@ // // We skip tests on platforms with troublesome character mappings -//go:build !windows && !darwin && !plan9 +//go:build !windows && !darwin && !plan9 && !wasm package sftp diff --git a/cmd/serve/sftp/sftp_unsupported.go b/cmd/serve/sftp/sftp_unsupported.go index 22e0673a7..12dd8ca0e 100644 --- a/cmd/serve/sftp/sftp_unsupported.go +++ b/cmd/serve/sftp/sftp_unsupported.go @@ -1,7 +1,7 @@ // Build for sftp for unsupported platforms to stop go complaining // about "no buildable Go source files " -//go:build plan9 +//go:build plan9 || wasm // Package sftp implements an SFTP server to serve an rclone VFS package sftp diff --git a/fs/daemon_other.go b/fs/daemon_other.go index 4e8043701..0f04775a5 100644 --- a/fs/daemon_other.go +++ b/fs/daemon_other.go @@ -1,6 +1,6 @@ // Daemonization stub for non-Unix platforms (common definitions) -//go:build windows || plan9 || js +//go:build windows || plan9 || js || wasm package fs diff --git a/fs/daemon_unix.go b/fs/daemon_unix.go index 04c128508..e702011b8 100644 --- a/fs/daemon_unix.go +++ b/fs/daemon_unix.go @@ -1,6 +1,6 @@ // Daemonization interface for Unix platforms (common definitions) -//go:build !windows && !plan9 && !js +//go:build !windows && !plan9 && !js && !wasm package fs diff --git a/fs/fserrors/retriable_errors.go b/fs/fserrors/retriable_errors.go index bd24f0a8e..a7d6f1914 100644 --- a/fs/fserrors/retriable_errors.go +++ b/fs/fserrors/retriable_errors.go @@ -1,4 +1,4 @@ -//go:build !plan9 +//go:build !plan9 && !wasm package fserrors diff --git a/fs/fserrors/retriable_errors_wasm.go b/fs/fserrors/retriable_errors_wasm.go new file mode 100644 index 000000000..e5c5272e5 --- /dev/null +++ b/fs/fserrors/retriable_errors_wasm.go @@ -0,0 +1,21 @@ +//go:build wasm + +package fserrors + +import ( + "syscall" +) + +func init() { + retriableErrors = append(retriableErrors, + syscall.EPIPE, + syscall.ETIMEDOUT, + syscall.ECONNREFUSED, + //syscall.EHOSTDOWN, + syscall.EHOSTUNREACH, + syscall.ECONNABORTED, + syscall.EAGAIN, + //syscall.EWOULDBLOCK, + syscall.ECONNRESET, + ) +} diff --git a/fs/log/redirect_stderr_unix.go b/fs/log/redirect_stderr_unix.go index dd7aa4d6f..c3891b8e8 100644 --- a/fs/log/redirect_stderr_unix.go +++ b/fs/log/redirect_stderr_unix.go @@ -1,6 +1,6 @@ // Log the panic under unix to the log file -//go:build !windows && !solaris && !plan9 && !js +//go:build !windows && !solaris && !plan9 && !js && !wasm package log diff --git a/fs/rc/js/main.go b/fs/rc/js/main.go index f13e88903..c70bdcef0 100644 --- a/fs/rc/js/main.go +++ b/fs/rc/js/main.go @@ -2,7 +2,7 @@ // // This library exports the core rc functionality -//go:build js +//go:build js || wasm package main diff --git a/lib/diskusage/diskusage_unsupported.go b/lib/diskusage/diskusage_unsupported.go index 1e4bddc40..83d86e117 100644 --- a/lib/diskusage/diskusage_unsupported.go +++ b/lib/diskusage/diskusage_unsupported.go @@ -1,4 +1,4 @@ -//go:build illumos || js || plan9 || solaris +//go:build illumos || js || wasm || plan9 || solaris package diskusage diff --git a/lib/kv/bolt.go b/lib/kv/bolt.go index d6ccb7aaf..0d571d6d9 100644 --- a/lib/kv/bolt.go +++ b/lib/kv/bolt.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm // Package kv provides key/value database. package kv diff --git a/lib/kv/internal_test.go b/lib/kv/internal_test.go index f101f720e..39e4e5bb6 100644 --- a/lib/kv/internal_test.go +++ b/lib/kv/internal_test.go @@ -1,4 +1,4 @@ -//go:build !plan9 && !js +//go:build !plan9 && !js && !wasm package kv diff --git a/lib/kv/unsupported.go b/lib/kv/unsupported.go index c4bb0deff..37832a87a 100644 --- a/lib/kv/unsupported.go +++ b/lib/kv/unsupported.go @@ -1,4 +1,4 @@ -//go:build plan9 || js +//go:build plan9 || js || wasm // Package kv provides key/value database. package kv diff --git a/lib/mmap/mmap_unix.go b/lib/mmap/mmap_unix.go index 8bc9e2e22..49637b9cf 100644 --- a/lib/mmap/mmap_unix.go +++ b/lib/mmap/mmap_unix.go @@ -1,7 +1,7 @@ // Package mmap implements a large block memory allocator using // anonymous memory maps. -//go:build !plan9 && !windows && !js +//go:build !plan9 && !windows && !js && !wasm package mmap diff --git a/lib/mmap/mmap_unsupported.go b/lib/mmap/mmap_unsupported.go index e78817da7..25bbaaeaa 100644 --- a/lib/mmap/mmap_unsupported.go +++ b/lib/mmap/mmap_unsupported.go @@ -1,6 +1,6 @@ // Fallback Alloc and Free for unsupported OSes -//go:build plan9 || js +//go:build plan9 || js || wasm package mmap diff --git a/lib/terminal/terminal_normal.go b/lib/terminal/terminal_normal.go index a1b399a47..f410273b1 100644 --- a/lib/terminal/terminal_normal.go +++ b/lib/terminal/terminal_normal.go @@ -1,4 +1,4 @@ -//go:build !js +//go:build !js && !wasm package terminal diff --git a/lib/terminal/terminal_unsupported.go b/lib/terminal/terminal_unsupported.go index 6a2c98ceb..078dcb764 100644 --- a/lib/terminal/terminal_unsupported.go +++ b/lib/terminal/terminal_unsupported.go @@ -1,4 +1,4 @@ -//go:build js +//go:build js || wasm package terminal