gen

command
v0.56.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Command gen writes driver_shapes.go: one concrete type per capability combination a plugin can declare.

Why a generator

filex decides what a storage can do by TYPE-ASSERTING optional interfaces (storage.Writer, storage.Toucher, storage.Presigner …) at forty-odd call sites. A plugin that cannot write must therefore be handed to filex as a value that has NO Write method — not one that returns an error, or the UI offers an upload button, a trash move and a version snapshot that each fail at the last moment.

With one optional axis that is two types. With five — write, mtime, watch, presign, multipart — it is twenty, and twenty hand-written structs is a place where somebody eventually embeds the wrong thing and a read-only plugin quietly becomes writable. So they are generated, and driver_shapes_test.go asserts the generated file is what this program produces.

go run ./internal/plugin/gen > internal/plugin/driver_shapes.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL