refactor(v2)!: restructure repo into services/ + features/, bump module to /v2#268
Merged
Conversation
…iders/server layout
…ghbors Resolves the 4 CodeQL go/uncontrolled-allocation-size high-severity alerts (pre-existing; first surfaced now that CodeQL runs in CI): - EC2/GCE/Azure-VM RunInstances validated count>0 but had no upper bound, so an oversized MaxCount could drive an unbounded slice allocation (OOM). Cap at 1000 per call, mirroring real provider limits. - Vertex AI FindNeighbors was already clamped to maxNeighbors (1000); drop the sized make() capacity so the (already-safe) allocation isn't flagged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The repository root had 43 top-level folders — nearly all of them public Go packages. For a published module, the directory layout is the public API (import path = directory path), so this reorg is a breaking change and ships as a new major version: the module path becomes
github.com/stackshy/cloudemu/v2.New layout (root: 43 → 9)
Organized by architectural role, so future additions have one predictable home:
services/(incl.kubernetes,cost,resourcediscovery— they emulate real cloud services).features/(topologyis cloudemu-only analysis, hence a feature, not a service).pagination,statemachine→internal/(private helpers, never part of the public API).Migration for users
Commits
Split file-wise (~49 commits): one per moved package, then per-tree import updates (providers, server, config/errors, examples, internal), then docs.
Verification
go build ./...,go vet ./..., and the fullgo test ./...suite all pass on the restructured tree — nothing broke functionally. README, in-repodocs/*.md,doc.go, and badges are updated to the v2 paths (repo/logo URLs kept).The docs site (cloudemu-docs) is updated in a separate PR.