Skip to content

refactor(dependencies): extract ansible bash scripts via go:embed - #283

Merged
patrick-hermann-sva merged 1 commit into
mainfrom
refactor/dependencies-extract-ansible-scripts
May 28, 2026
Merged

refactor(dependencies): extract ansible bash scripts via go:embed#283
patrick-hermann-sva merged 1 commit into
mainfrom
refactor/dependencies-extract-ansible-scripts

Conversation

@patrick-hermann-sva

Copy link
Copy Markdown
Contributor

Summary

Moves the two large embedded bash blobs in dependencies/ansible.go into standalone files under dependencies/scripts/, loaded via //go:embed. Behavior unchanged.

File Before After
dependencies/ansible.go 314 LOC 136 LOC
dependencies/scripts/check-ansible-updates.sh (inline) 100 LOC
dependencies/scripts/update-ansible-requirements.sh (inline) 81 LOC

The update script preserves the UPDATE_ALL=%v / COLLECTIONS_TO_UPDATE=(%s) placeholders so fmt.Sprintf still wires Go state in at runtime.

Refs #262 — P3 "Split oversized files: dependencies/ansible.go". Completes the last remaining item under that checkbox.

Side benefit

The two scripts are now lintable with shellcheck and editable with proper bash tooling (syntax highlighting, format on save, etc).

Test plan

  • go build ./... clean
  • go vet ./... clean
  • gofmt -l . clean
  • dagger functions -m ./dependencies lists the same 4 functions with identical descriptions
  • End-to-end run of apply-ansible-updates against a real requirements.yaml — recommend smoke-testing before merge since the bash blobs aren't exercised by dagger functions

🤖 Generated with Claude Code

Moves the two large embedded bash blobs in `dependencies/ansible.go`
into standalone files under `dependencies/scripts/` and loads them
via `//go:embed`. Behavior is unchanged — the scripts are byte-for-
byte the same as the previous string literals.

Result:
- ansible.go:                 314 LOC → 136 LOC
- scripts/check-ansible-updates.sh:       100 LOC (was inline in UpdateAnsibleRequirements)
- scripts/update-ansible-requirements.sh:  81 LOC (was inline in UpdateAnsibleRequirementsAndApply)

The update script keeps the `UPDATE_ALL=%v` / `COLLECTIONS_TO_UPDATE=(%s)`
placeholders so `fmt.Sprintf` still wires Go state in at runtime.

Side benefit: the bash is now lintable with shellcheck.

Refs #262 (P3 — split oversized files; `dependencies/ansible.go` slice).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@patrick-hermann-sva
patrick-hermann-sva merged commit 110a39f into main May 28, 2026
3 checks passed
@patrick-hermann-sva
patrick-hermann-sva deleted the refactor/dependencies-extract-ansible-scripts branch May 28, 2026 07:31
@patrick-hermann-sva

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 0.115.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant