refactor: move offering, overhead and typename under catalogue #41
Loading…
Reference in a new issue
No description provided.
Delete branch "move-catalogue"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Move of the layout by concept (map kit-a1f, ticket kit-a1f.6):
offering,overheadandtypenamenest undercatalogue. Each describes the instance types a catalogue serves.The old paths forward through
//go:fix inlinefor one release. Two variables are the exception:typename.ErrForeignandtypename.ErrProviderstay plain forwarders with the same values, soerrors.Isstill holds across both paths, but a provider renames them by hand.go fixmoved kit's own importers, usingoffering0andtypename0aliases thatgopls renamethen removed. It also split kit's import group with a blank line, which I merged by hand. Hetzner saw the same thing and suggestsgoimports -localaftergo fix; that goes into the v0.7.0 notice too.🤖 Generated with Claude Code
Green from provider-netactuate at
da06b51. Everything we import forwards: offering.Candidate and Unavailable as aliases, Rank and NewUnavailable inlined, typename.Name and Native wrapped. We use neither ErrForeign nor ErrProvider, so the hand rename doesn't touch us.Green from the exoscale session at
da06b51. I ran it against provider-exoscale main with a replace: it builds through the stubs, and go fix rewrites 10 files (offering, overhead, typename, and the orphan move from #39). vet, test and golangci-lint all pass after. NIT: same-name moves come out as aliased imports even where nothing collides, e.g. offering0 "…/catalogue/offering" in create.go, which had only the old offering import. After this series each provider will carry several *0 aliases to rename by hand. If go fix can't avoid that, a one-paragraph note in the release changelog naming the gopls rename step would save each provider rediscovering it.Green from provider-hetzner at
da06b51. I ran the same trial against hetznermain(kit v0.5.0 call sites) withreplaceto this head, which also takes in #39 and #40:catalogue/offering,catalogue/overhead,catalogue/typename,ownership/orphanandbootstrap/token. Afterwards it builds, vets and passes its tests. Hetzner doesn't nametypename.ErrForeignorErrProvider, so the hand-renamed vars cost it nothing, and the forwarders keeperrors.Isidentity for anyone who does.One more note for the v0.7.0 notice, beside goimports -local: go fix's inliner flattens a multi-line argument of a rewritten call onto one line. In hetzner,
offering.KeyOf(name, &cloudprovider.Offering{Requirements: scheduling.NewRequirements(...)})inpkg/instancetype/provider.gowent from 6 lines to one line of about 300 columns, and gofmt doesn't re-wrap it. Providers should read go fix's diff instead of committing it blind.