Skip to content

split packages as modules #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged

Conversation

fredbi
Copy link
Member

@fredbi fredbi commented Apr 1, 2025

This PR transforms the "swag" package into a mono repo, which exposes a collection of independant go modules.

The objective is to reduce the footprint of required dependencies.

To remain fully backward-compatible, the swag module imports all the newly created (sub) modules, for programs that consume its deprecated API.

ci: ci automation and bots configuration have been adapted to support this new mono-repo structure.

@fredbi fredbi marked this pull request as draft April 1, 2025 20:31
@fredbi fredbi changed the title split packages as modules WIP: split packages as modules Apr 1, 2025
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.40%. Comparing base (f024303) to head (525116a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #119   +/-   ##
=======================================
  Coverage   90.40%   90.40%           
=======================================
  Files          36       36           
  Lines        1835     1835           
=======================================
  Hits         1659     1659           
  Misses        142      142           
  Partials       34       34           
Flag Coverage Δ
oldstable-macos-latest 89.15% <ø> (?)
oldstable-ubuntu-latest 89.15% <ø> (?)
oldstable-windows-latest 90.08% <ø> (ø)
stable-macos-latest 89.15% <ø> (?)
stable-ubuntu-latest 89.15% <ø> (ø)
stable-windows-latest 90.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fredbi fredbi force-pushed the refact/sub-go-modules branch from ee44012 to c4b0c82 Compare April 1, 2025 21:17
@fredbi fredbi changed the title WIP: split packages as modules split packages as modules Apr 1, 2025
@fredbi fredbi requested a review from Copilot April 1, 2025 21:18
@fredbi fredbi marked this pull request as ready for review April 1, 2025 21:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR converts the existing "swag" package into a multi-module mono repo, allowing consumers to depend only on the modules they need while maintaining backward compatibility through the legacy API.

  • Updated documentation and README files to refer to “modules” instead of “packages” and describe the new testing instructions.
  • Adjusted CI configuration and linters to accommodate the multi-module structure.
  • Modified Dependabot settings to scan across multiple directories.

Reviewed Changes

Copilot reviewed 16 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
doc.go Updated docs to list modules (e.g. cmdutils, conv, fileutils, etc.)
README.md Revised module bullet list, dependency notes, and instructions for testing
.golangci.yml Added gomoddirectives linter to support modern module directive checks
.github/workflows/go-test.yml Modified test workflow to run tests in each module using find and pushd
.github/dependabot.yaml Updated dependency scan configuration to cover multiple directories
Files not reviewed (12)
  • cmdutils/go.mod: Language not supported
  • conv/go.mod: Language not supported
  • fileutils/go.mod: Language not supported
  • go.mod: Language not supported
  • jsonname/go.mod: Language not supported
  • jsonutils/go.mod: Language not supported
  • loading/go.mod: Language not supported
  • mangling/go.mod: Language not supported
  • netutils/go.mod: Language not supported
  • stringutils/go.mod: Language not supported
  • typeutils/go.mod: Language not supported
  • yamlutils/go.mod: Language not supported
Comments suppressed due to low confidence (1)

README.md:23

  • [nitpick] Consider reviewing the ordering of the module names in the README to ensure a consistent grouping (alphabetical or logical) for improved readability.
* Module `cmdutils`

README.md Outdated

#### Note to contributors

The usual `go test ./...` command, run from the root of this repo won't work any longer to test all submodules.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI go test work will solve this in Go 1.25

But I know swag still supports Go 1.20... so...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. I've see you're following that issue. Notice that "go test work" will partially solve this issue, since the go team seems still rather opposed to support the concept of mono-repos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this comment specifically for you... :)

This PR transforms the "swag" package into a mono repo,
which exposes a collection of independant go modules.

The objective is to reduce the footprint of required dependencies.

To remain fully backward-compatible, the swag module imports all
the newly created (sub) modules, for programs that consume its
deprecated API.

ci: ci automation, test coverage reporting and dependabot configuration have been adapted to support
this new mono-repo structure.

Signed-off-by: Frederic BIDON <[email protected]>
@fredbi fredbi force-pushed the refact/sub-go-modules branch from 121e17c to 525116a Compare April 2, 2025 11:59
@fredbi fredbi merged commit fbcb5d8 into go-openapi:master Apr 2, 2025
11 checks passed
@fredbi fredbi deleted the refact/sub-go-modules branch April 2, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants