Decide the base.File.DeleteFileVersion signature: variadic bool, options or second method

Aperta
#102 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
api

Direzione di ricerca

Read base/baseline.go, b2/baseline.go, and the CHANGELOG entry from #53, then compare the existing wire tests in base, b2, and internal/b2types. First decide which signature option best fits the public API and record the reasoning. If the signature changes, update the listed call sites and changelog; done means the stated go test ./base/ ./b2/ ./internal/b2types/ checks pass, existing no-option calls compile, and false remains omitted from the wire request.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Decide whether base.File.DeleteFileVersion should keep the variadic bypassGovernance ...bool parameter added in #53. Raised in review on #53 as a non-blocking point.

#53 added the option as func (f *File) DeleteFileVersion(ctx context.Context, bypassGovernance ...bool) error. The variadic bool keeps existing callers compiling, but it reads oddly: DeleteFileVersion(ctx, true, true) is accepted and silently ignores the second value, a bare true at the call site says nothing about what it does, and adding a second option later means another positional parameter or a breaking change. The b2 layer already uses a functional option (b2.BypassGovernance(), a DeleteOption), and the unexported interfaces use a plain bool, so base is the only place with the variadic form.

Options, with trade-offs:

  • Keep the variadic bool. Source compatible and already merged, but ambiguous and not extensible.
  • Add an options type to base (a DeleteOption func, mirroring b2). Extensible and consistent with b2, still source compatible if it is also variadic (opts ...DeleteOption), at the cost of a little more API.
  • Add a second method (for example DeleteFileVersionBypassingGovernance). No variadics and very explicit, but it multiplies methods if more flags appear.

blazer is at v0, so changing the signature is allowed, but it is still a public package, so the decision should be made before a release (v0.9.0) rather than after.

What is needed:

  • Pick one option and record the reason in the PR or this issue.
  • If the signature changes, update b2/baseline.go, the CHANGELOG entry from #53, and the base and b2 wire tests added in #53, and keep the omitempty behavior (never send an explicit false).

Acceptance checks:

  • go test ./base/ ./b2/ ./internal/b2types/ passes with the wire tests from #53 unchanged in what they assert (no argument and false omit the field, true sends it).
  • DeleteFileVersion(ctx) with no option still compiles for existing callers.
  • The CHANGELOG describes the final signature.

Related: #53.

Lingua principale
Go
Stelle
66
Fork
18
Merge medio
1g 10h
PR unite (30g)
132

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Backblaze/blazer

Tutte le issue di Backblaze/blazer

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.