A fast, ergonomic, multi-driver storage library for Go.
Quick Start · Install · Drivers · Transfers · Signed Requests · Testing · Benchmarks · API · Development
Read, write, and list files through one Go interface. Choose a driver for each disk. Use a local directory for development, or a remote backend such as S3 for shared storage. Use a manager when backups, uploads, and assets need separate disks.
Write and read a file on a local disk. Open an existing Go module that uses Go 1.25.0 or newer, then add Storage and the local driver.
go get github.com/goforj/storage github.com/goforj/storage/driver/localstoragepackage main
import (
"context"
"fmt"
"log"
"github.com/goforj/storage"
"github.com/goforj/storage/driver/localstorage"
)
func main() {
ctx := context.Background()
// The local driver creates the root directory if needed.
disk, err := storage.Build(ctx, localstorage.Config{Root: "./data"})
if err != nil {
log.Fatalf("open local disk: %v", err)
}
defer disk.Close()
// Paths are relative to the disk root, so this file lives under ./data.
const path = "notes/hello.txt"
if err := disk.Put(ctx, path, []byte("hello from storage")); err != nil {
log.Fatalf("write %s: %v", path, err)
}
body, err := disk.Get(ctx, path)
if err != nil {
log.Fatalf("read %s: %v", path, err)
}
fmt.Println(string(body))
// hello from storage
}Add these calls at the end of main.
// Work on a copy so the original stays in notes.
if err := disk.Copy(ctx, "notes/hello.txt", "notes/hello-copy.txt"); err != nil {
log.Fatal(err)
}
if err := disk.Move(ctx, "notes/hello-copy.txt", "archive/hello.txt"); err != nil {
log.Fatal(err)
}
// Read from the destination to verify the move before cleanup.
archived, err := disk.Get(ctx, "archive/hello.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println("Archived copy:", string(archived))
// Archived copy: hello from storage
if err := disk.Delete(ctx, "archive/hello.txt"); err != nil {
log.Fatal(err)
}Run the same backup job on a local disk or on RustFS through the S3 driver.
Add the Storage module and the driver you use. For S3, run the following command in your Go module.
go get github.com/goforj/storage github.com/goforj/storage/driver/s3storageAll drivers read and write byte slices and support bounded reads. S3 and Azure Blob also support streaming objects. Select a driver badge for its configuration reference.
If a backend would benefit from a first-class driver, open an issue and tell us what you need it to support. For other backends, see the full list of Rclone backends. See the inline Rclone example for a local write and read.
Use Rclone with trusted remotes and directory trees. Its local remote follows the filesystem's symlink behavior. Use the first-party local driver when operations must stay inside a filesystem root.
Directory operations
- Dropbox, Google Drive, OneDrive, and WebDAV return
ErrUnsupported. - S3, GCS, and Azure Blob delete only empty directory markers.
- Other drivers delete empty directories. Rclone depends on the remote.
Azure Blob directory moves return ErrConflict before writing the destination if a blob shares a path with a virtual directory or a trailing-slash key is backed by an object other than an empty directory marker.
Use storage.GetWithLimit when a request or job reads a file into memory. For example, cap a report at 8 MiB with storage.GetWithLimit(ctx, disk, "reports/annual.csv", 8<<20). An oversized file returns storage.ErrTooLarge.
Use storage.WriteStream to write from an io.Reader to a local, S3, GCS, or Azure Blob disk. The caller closes the reader. The stream can have an unknown length. The write replaces the destination after the reader reaches EOF.
The CSV import example streams an HTTP response into S3. To run it, start the RustFS service from the backup example. Run go run ./import_csv <export-url> from examples with a working HTTP export URL. The command writes the response to exports/orders.csv.
When the source is another disk, pass both disks to storage.CopyFile. For S3 disks on the same endpoint and region with matching credentials, a copy up to 5 GiB can stay on the provider. Other copies stream through the application and require a streaming reader and writer. The copy replaces an existing destination and keeps the source.
err := storage.CopyFile(ctx, local, "exports/orders.csv", archive, "orders.csv")S3 buffers small files in 64 KiB and uses 16 MiB parts for larger streams, up to 10,000 parts. GCS uses 4 MiB resumable chunks. Azure Blob uses 4 MiB blocks, up to 50,000 blocks. Use the sized object API on Azure Blob when you need larger blocks.
Copies within an S3 disk use provider-side multipart copy for objects larger than 5 GiB. Each part uses a source byte range, so the file does not pass through your app. The copy carries source tags and file metadata. The provider publishes the destination after all parts succeed.
Allow the disk to read tags on the source and write them on the destination. For a versioned source, grant access to the source version and its tags. If a copy fails partway through, Storage attempts to abort the multipart upload.
S3 can store a file named reports alongside the folder reports/. When an application acts on a row from a cursor page, pass the row's storage.Entry to storage.MoveEntry or storage.DeleteEntry. The entry's kind selects the file or folder at that path.
err := storage.MoveEntry(ctx, disk, entry, "archive/reports")Move a directory to an unused destination and keep exclusive access to that destination until the move completes. DeleteEntry deletes files and empty directory markers. A directory with children returns storage.ErrForbidden. An object with data at a trailing-slash key returns storage.ErrUnsupported during a directory move or deletion.
S3 directory markers require a backend that supports conditional writes and deletes. MakeDir returns storage.ErrConflict if the marker key already contains data. Deleting a marker whose ETag changed also returns storage.ErrConflict. On Amazon S3, grant s3:GetObject, s3:PutObject, and s3:DeleteObject for the marker keys used by these operations.
On S3, use storage.SignDownload or storage.SignUpload when a client needs temporary access to one object. Pass the TTL in whole seconds, from one second to seven days. Temporary credentials can expire sooner. Send the returned URL, method, and headers to the client.
upload, err := storage.SignUpload(ctx, disk, "incoming/report.csv", 5*time.Minute)The upload request can replace an existing object at that path. Choose the path and authorize the caller before signing. For browser uploads, configure the bucket's CORS policy to allow the app's origin, the returned method, and any signed headers.
Pass storagetest.Fake(t) to the code under test. Use AssertExists, AssertMissing, or AssertContents to check what it wrote. The fake buffers streamed writes in memory and replaces a file once the input reaches EOF. Use storagetest.FakeManager when the code selects a disk by name.
func TestWriteNote(t *testing.T) {
disk := storagetest.Fake(t)
if err := disk.Put(t.Context(), "notes/hello.txt", []byte("hello from storage")); err != nil {
t.Fatal(err)
}
storagetest.AssertContents(t, disk, "notes/hello.txt", []byte("hello from storage"))
}- Streaming reads. An 8 MiB read from RustFS allocated about 31 KiB with the S3 streaming API and 20 MiB with
Get. Benchmark results and reproduction steps - Transfer integrity. Each of eight fixtures uploaded and downloaded 100 GB, with a SHA-256 check on every object. Recorded transfer run
Copy results and benchmark charts
8 MiB copy on local benchmark fixtures
| Fixture | ms/op | KiB allocated/op | Allocations/op |
|---|---|---|---|
| local | 8.851 | 35.9 | 89.1 |
| memory | 0.289 | 8192.6 | 11.0 |
| rclone_local | 11.668 | 75.5 | 146.4 |
| ftp | 2.770 | 100.1 | 422.1 |
| sftp | 85.930 | 19702.5 | 6542.2 |
| redis | 5.794 | 8211.6 | 241.0 |
| gcs | 12.036 | 16791.0 | 1208.4 |
| s3 | 32.221 | 78.6 | 934.4 |
| rclone_s3 | 67.041 | 126.9 | 1573.0 |
Pass a context to constructors and operations. Replace storage.BuildContext(ctx, cfg) with storage.Build(ctx, cfg) and disk.WithContext(ctx).Get(path) with disk.Get(ctx, path). Close standalone disks with disk.Close() and manager-owned disks with manager.Close(). See the v0.13.0 upgrade notes for custom drivers and streaming.
Use storage.ListCursorPage on S3 or Google Cloud Storage (GCS) to list immediate children one backend page at a time. Start with an empty cursor. Pass NextCursor back with the same disk and path until it is empty.
for cursor := ""; ; {
page, err := storage.ListCursorPage(ctx, disk, "reports", cursor, 50)
if err != nil {
return err
}
for _, entry := range page.Entries {
fmt.Println(entry.Path)
}
if page.NextCursor == "" {
break
}
cursor = page.NextCursor
}S3 and GCS accept limits from 1 to 1,000. The provider can return a short or empty page with a continuation token. Use the cursor to detect the last page. A file and directory with the same path can appear separately. Each page reflects the live listing.
See the package documentation for the full API.
| Group | Functions |
|---|---|
| Files | Delete · Get · Move · Put · URL |
| Directories | CountFiles · ListPage · PaginateEntries · List · Walk |
| Construction | Build |
| Manager | New |
| Streaming | GetWithLimit · Objects |
| Paths | JoinPrefix · NormalizePath |
| Driver Constructors | azureblob · dropbox · ftp · gcs · googledrive · local · memory · onedrive · rclone · redis · s3 · s3storage.PrepareBucket · sftp · smb · webdav |
| Rclone Config | RenderLocal · RenderS3 |
Delete removes the object at path.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
const path = "docs/readme.txt"
if err := disk.Put(context.Background(), path, []byte("hello")); err != nil {
log.Fatalf("write file: %v", err)
}
if err := disk.Delete(context.Background(), path); err != nil {
log.Fatalf("delete file: %v", err)
}
exists, err := disk.Exists(context.Background(), path)
if err != nil {
log.Fatalf("check whether file exists: %v", err)
}
fmt.Println(exists)
// falseGet reads the object at path.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
defer disk.Close()
ctx, cancel := context.WithCancel(context.Background())
cancel()
_, err = disk.Get(ctx, "docs/readme.txt")
fmt.Println(errors.Is(err, context.Canceled))
// trueMove moves the object or directory tree at src to dst.
For directory moves implemented as copy and delete, reserve the destination for the move. If copying fails, the driver rolls back entries it copied. If source deletion fails, the complete destination and some source entries can both remain.
S3 rechecks the copied source before requesting an ETag-conditional delete. Pause source metadata and tag edits during the move. On general-purpose buckets, metadata can change without changing the ETag used by the delete.
Rclone uses a native rename for local files when available. If the rename is unavailable, the destination must be unused. For Rclone moves that copy and delete, reserve the destination and pause source writes until the move returns. Rclone verifies the copy before deleting the source. When verification detects a change, the move returns ErrConflict and keeps the source.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/readme.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
if err := disk.Move(context.Background(), "docs/readme.txt", "archive/readme.txt"); err != nil {
log.Fatal(err)
}
data, err := disk.Get(context.Background(), "archive/readme.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(data))
// helloPut writes an object at path, overwriting any existing object.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/readme.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
entry, err := disk.Stat(context.Background(), "docs/readme.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println(entry.Path, entry.Size)
// docs/readme.txt 5URL returns a usable access URL when the driver supports it.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/readme.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
_, err = disk.URL(context.Background(), "docs/readme.txt")
fmt.Println("URL unsupported:", errors.Is(err, storage.ErrUnsupported))
// URL unsupported: trueCountFiles returns the recursive count of non-directory entries under path.
CountFiles uses Walk under the hood, so it works across drivers that support recursive traversal.
ctx := context.Background()
disk, err := storage.Build(ctx, memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
defer disk.Close()
if err := disk.Put(ctx, "docs/readme.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
if err := disk.Put(ctx, "docs/archive/guide.txt", []byte("guide")); err != nil {
log.Fatal(err)
}
total, err := storage.CountFiles(ctx, disk, "docs")
if err != nil {
log.Fatal(err)
}
fmt.Println(total)
// 2ListPage returns one offset-based page of immediate children under path. It uses the driver's paging method when available and otherwise pages the result of List. The limit bounds the returned entries. A driver may still fetch the full listing. Use cursor pagination to fetch one provider page on S3 or GCS.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/a.txt", []byte("a")); err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/b.txt", []byte("b")); err != nil {
log.Fatal(err)
}
for offset := 0; ; {
page, err := storage.ListPage(context.Background(), disk, "docs", offset, 1)
if err != nil {
log.Fatal(err)
}
for _, entry := range page.Entries {
fmt.Println(entry.Path)
// docs/a.txt
// docs/b.txt
}
// A full page can also be the last page.
if !page.HasMore {
break
}
offset += len(page.Entries)
}PaginateEntries returns a clamped page without mutating the caller's entry slice.
entries := []storage.Entry{{Path: "a.txt"}, {Path: "b.txt"}, {Path: "c.txt"}}
page := storage.PaginateEntries(entries, 1, 1)
fmt.Println(page.Entries[0].Path, page.HasMore)
// b.txt trueList returns immediate children sorted by path. Pass an empty path to list the disk root.
Each entry path is relative to the disk root. Use Walk to visit descendants.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/readme.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
entries, err := disk.List(context.Background(), "docs")
if err != nil {
log.Fatal(err)
}
for _, entry := range entries {
fmt.Println(entry.Path)
}
// docs/readme.txtWalk visits entries recursively in deterministic path order.
disk, err := storage.Build(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
if err := disk.Put(context.Background(), "docs/archive/guide.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
if err := disk.Walk(context.Background(), "docs", func(entry storage.Entry) error {
fmt.Println(entry.Path)
// docs/archive
// docs/archive/guide.txt
return nil
}); err != nil {
log.Fatal(err)
}Build opens a standalone disk using ctx for setup.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
disk, err := storage.Build(ctx, memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
defer disk.Close()
if err := disk.Put(ctx, "notes/hello.txt", []byte("hello")); err != nil {
log.Fatal(err)
}New opens the configured disks. Set Default to one of their names and call manager.Close() at shutdown to close them all.
manager, err := storage.New(context.Background(), storage.Config{
Default: "scratch",
Disks: map[storage.DiskName]storage.DriverConfig{
"scratch": memorystorage.Config{},
"uploads": memorystorage.Config{},
},
})
if err != nil {
log.Fatal(err)
}
uploads, err := manager.Disk("uploads")
if err != nil {
log.Fatal(err)
}
if err := uploads.Put(context.Background(), "notes/hello.txt", []byte("hello")); err != nil {
log.Fatal(err)
}
// Check the same path on the default disk to verify that the disks are independent.
exists, err := manager.Default().Exists(context.Background(), "notes/hello.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println("On the default disk:", exists)
// On the default disk: false
if err := manager.Close(); err != nil {
log.Fatal(err)
}GetWithLimit reads a file into memory with a caller-supplied byte limit. It returns ErrTooLarge and no data if the file exceeds the limit. A zero limit accepts only an empty file. All first-class drivers support bounded reads. A custom driver must support streamed or bounded reads.
Use a limit your application can afford to hold in memory. Use storage.ReadStream to process larger files on drivers that expose a stream.
See the local streaming example for a write and read.
Objects returns a driver's streaming object capability. Each streaming call takes its own context. Unsupported drivers return ErrUnsupported.
Download with OpenObject and close the returned reader. Upload with PutObject and pass the reader's exact byte count. WalkObjects visits objects one provider page at a time. For a direct driver handle, call storagecore.Objects.
Use the backup example to start RustFS before running this upload.
// Run the RustFS backup demo first to create the bucket.
ctx := context.Background()
disk, err := storage.Build(ctx, s3storage.Config{
Bucket: "storage-demo",
Region: "us-east-1",
Endpoint: "http://127.0.0.1:19000",
UsePathStyle: true,
AccessKeyID: "storage-demo",
SecretAccessKey: "storage-demo-password",
})
if err != nil {
log.Fatalf("build S3 disk: %v", err)
}
objects, err := storage.Objects(disk)
if err != nil {
log.Fatalf("open object streaming API: %v", err)
}
// A sized upload requires the exact byte count before the reader is consumed.
body := strings.NewReader("hello from storage")
info, err := objects.PutObject(ctx, "stream.txt", body, storagecore.PutObjectOptions{
Size: body.Size(),
})
if err != nil {
log.Fatalf("upload object: %v", err)
}
fmt.Println(info.Key, info.Size)
// stream.txt 18JoinPrefix combines a disk prefix with a path using slash separators.
fmt.Println(storage.JoinPrefix("assets", "logo.svg"))
// assets/logo.svgNormalizePath cleans a user path, normalizes separators, and rejects attempts to escape the disk root or prefix root.
The empty string and root-like inputs normalize to the logical root.
path, err := storage.NormalizePath(" /avatars//user-1.png ")
if err != nil {
log.Fatal(err)
}
fmt.Println(path)
// avatars/user-1.pngNew prepares a client without contacting Azure or creating a container.
The container must already exist. Use AccountURL for Azure Identity or ConnectionString for Azurite or account-key authentication. Signed read URLs require an account key.
disk, err := azureblobstorage.New(context.Background(), azureblobstorage.Config{
Container: "backups",
ConnectionString: os.Getenv("AZURE_STORAGE_CONNECTION_STRING"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New prepares a Dropbox disk using an access token.
disk, err := dropboxstorage.New(context.Background(), dropboxstorage.Config{
Token: os.Getenv("DROPBOX_ACCESS_TOKEN"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New connects to an existing FTP server using the supplied credentials.
Enable StagedWrites to publish uploads by rename. This requires server support and rename permission. Interrupted direct uploads can leave a partial file.
disk, err := ftpstorage.New(context.Background(), ftpstorage.Config{
Host: "files.example.com",
User: "backups",
Password: os.Getenv("FTP_PASSWORD"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New opens a GCS disk for an existing bucket. This example uses Google Application Default Credentials.
disk, err := gcsstorage.New(context.Background(), gcsstorage.Config{
Bucket: "uploads",
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New prepares a Google Drive disk that calls your token source for each request.
Set SharedDriveID for a Shared Drive. Reuse one disk handle to coordinate writes to the same path, or coordinate writers across separate handles in your application.
disk, err := googledrivestorage.New(context.Background(), googledrivestorage.Config{
FolderID: "backup-folder-id",
TokenSource: func(context.Context) (string, error) {
return os.Getenv("GOOGLE_DRIVE_ACCESS_TOKEN"), nil
},
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New constructs local storage rooted at cfg.Root with an optional prefix.
Use BufferedWrites for data you can recreate. The default syncs file contents before replacement. In either mode, a power loss can lose the directory update because the parent directory is unsynced.
disk, err := localstorage.New(context.Background(), localstorage.Config{
Root: "./data",
Prefix: "sandbox",
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New constructs in-memory storage.
disk, err := memorystorage.New(context.Background(), memorystorage.Config{})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New prepares a disk using a caller-managed Graph credential.
Use the document library's drive ID for SharePoint. An empty DriveID selects the signed-in user's OneDrive. Uploads and copies are limited to 250 MB.
disk, err := onedrivestorage.New(context.Background(), onedrivestorage.Config{
DriveID: "document-library-id",
TokenSource: func(context.Context) (string, error) {
return os.Getenv("ONEDRIVE_ACCESS_TOKEN"), nil
},
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New opens an Rclone remote. All disks in a process share one Rclone configuration. Define the backups remote before opening this disk.
disk, err := rclonestorage.New(context.Background(), rclonestorage.Config{
Remote: "backups:archive",
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New constructs Redis-backed storage using go-redis.
When upgrading from v0.4.6 or earlier, stop all clients sharing a database and prefix, upgrade them together, then restart them. Older clients cannot read the new index.
disk, err := redisstorage.New(context.Background(), redisstorage.Config{
Addr: "127.0.0.1:6379",
Prefix: "scratch",
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New prepares an S3 disk for an existing bucket. This example uses the default AWS credential chain.
disk, err := s3storage.New(context.Background(), s3storage.Config{
Bucket: "uploads",
Region: "us-east-1",
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()PrepareBucket creates a missing bucket using the same configuration and credentials as the driver. Existing buckets are unchanged. Permission failures never trigger a creation attempt.
// Start the backup demo's RustFS container before running this example.
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
cfg := s3storage.Config{
Bucket: "storage-demo",
Region: "us-east-1",
Endpoint: "http://127.0.0.1:19000",
UsePathStyle: true,
AccessKeyID: "storage-demo",
SecretAccessKey: "storage-demo-password",
}
if err := s3storage.PrepareBucket(ctx, cfg); err != nil {
log.Fatalf("prepare S3 bucket: %v", err)
}
fmt.Println("bucket ready")
// bucket readyNew connects to an SFTP server and verifies its host key. Set SFTP_KEY_PATH to your private key file and SFTP_KNOWN_HOSTS to a known_hosts file that contains the server's key.
After canceling a write, let cleanup finish before closing the disk. A .storage-tmp- file may remain if cleanup cannot reach the server.
disk, err := sftpstorage.New(context.Background(), sftpstorage.Config{
Host: "files.example.com",
User: "backups",
KeyPath: os.Getenv("SFTP_KEY_PATH"),
KnownHostsPath: os.Getenv("SFTP_KNOWN_HOSTS"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New opens a signed SMB session. Close the returned disk when it is no longer needed.
The server must support signing over SMB 2 or 3. Grant the account access on both the share and the filesystem.
disk, err := smbstorage.New(context.Background(), smbstorage.Config{
Address: "fileserver.example.com",
Share: "backups",
User: "storage",
Password: os.Getenv("SMB_PASSWORD"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()New prepares a WebDAV disk at an existing collection URL.
Copy and move require an unused destination. File deletion requires a strong ETag and support for If-Match.
disk, err := webdavstorage.New(context.Background(), webdavstorage.Config{
Endpoint: "https://files.example.com/remote.php/dav/files/backups/",
User: "backups",
Password: os.Getenv("WEBDAV_PASSWORD"),
})
if err != nil {
log.Fatal(err)
}
defer disk.Close()RenderLocal returns ini-formatted rclone config for a local backend.
cfg, err := rclonestorage.RenderLocal(rclonestorage.LocalRemote{Name: "local"})
if err != nil {
log.Fatal(err)
}
fmt.Print(cfg)
// [local]
// type = localRenderS3 returns ini-formatted rclone config content for a single S3 remote.
cfg, err := rclonestorage.RenderS3(rclonestorage.S3Remote{
Name: "assets",
Region: "us-east-1",
AccessKeyID: "example-key",
SecretAccessKey: "example-secret",
})
if err != nil {
log.Fatal(err)
}
// Show the remote name without logging credentials.
header, _, _ := strings.Cut(cfg, "\n")
fmt.Println(header)
// [assets]make test # Test the root module
make test-examples # Test the examples module
make test-integration # Test all driver fixtures with Docker
make test-integration gcs # Test GCS with its emulator
make test-coverage # Generate combined coverage
go run ./docs/examplegen/main.go # Regenerate the runnable examples
go run ./docs/readme/main.go # Regenerate the API reference
make docs-watch # Regenerate docs and examples as code changesRun go test ./... in each driver module you change. See make help for all
targets, the test plan for fixture details, and the
release runbook for publishing.
