fix(build): update Dagger build to work without go.work files#4817
Merged
markphelps merged 3 commits intov2from Oct 2, 2025
Merged
fix(build): update Dagger build to work without go.work files#4817markphelps merged 3 commits intov2from
markphelps merged 3 commits intov2from
Conversation
The Dagger base image build was parsing go.work and go.work.sum files to determine which module dependency files to mount. Since these workspace files were removed from version control (being local-dev only), the build process now mounts dependency files directly based on the replace directives in go.mod. Changes: - Mount root go.mod and go.sum directly instead of go.work fi 8000 les - Explicitly mount submodule dependency files (core, errors, rpc/*, sdk/go) - Remove unused golang.org/x/mod/modfile import - Support both v1 (4 submodules) and v2 (6 submodules) module structures Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
|
Related Documentation Checked 4 published document(s). No updates required. You have 1 draft document(s). Publish docs to keep them always up-to-date |
The Dagger build process needs to mount go.mod and go.sum files for all submodules that have replace directives. The build module and sdk/go/v2 submodule were missing from the list, causing go mod download to fail when running tests that depend on the build module. This adds both missing submodules to ensure their dependencies are properly downloaded before the test phase. Fixes the unit test failure where go run ./build/internal/cmd/gitea/... could not find the build module. Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #4817 +/- ##
==========================================
- Coverage 58.55% 58.49% -0.06%
==========================================
Files 135 135
Lines 16840 16840
==========================================
- Hits 9860 9851 -9
- Misses 6294 6303 +9
Partials 686 686
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The Dagger build container needs a go.work file to support running commands across multiple Go modules (main module and submodules like build, core, errors, etc.). Without go.work, commands like 'go run ./build/internal/cmd/gitea/...' fail because Go doesn't recognize build as part of the workspace and treats it as an external module that's not in the dependency graph. This change dynamically creates a go.work file in the container after mounting the full project, enabling the workspace mode that allows tests to run commands in submodules while maintaining access to the main module's resources. Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
|
Documentation Updates Checked 4 published document(s). No updates required. You have 1 draft document(s). Publish docs to keep them always up-to-date |
ptejasvini
pushed a commit
to ptejasvini/flipt
that referenced
this pull request
Oct 3, 2025
…io#4817) * fix(build): update Dagger build to work without go.work files The Dagger base image build was parsing go.work and go.work.sum files to determine which module dependency files to mount. Since these workspace files were removed from version control (being local-dev only), the build process now mounts dependency files directly based on the replace directives in go.mod. Changes: - Mount root go.mod and go.sum directly instead of go.work files - Explicitly mount submodule dependency files (core, errors, rpc/*, sdk/go) - Remove unused golang.org/x/mod/modfile import - Support both v1 (4 submodules) and v2 (6 submodules) module structures Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * fix(build): add missing build and sdk/go/v2 submodules to Dagger mount The Dagger build process needs to mount go.mod and go.sum files for all submodules that have replace directives. The build module and sdk/go/v2 submodule were missing from the list, causing go mod download to fail when running tests that depend on the build module. This adds both missing submodules to ensure their dependencies are properly downloaded before the test phase. Fixes the unit test failure where go run ./build/internal/cmd/gitea/... could not find the build module. Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * fix(build): create go.work file in container for multi-module support The Dagger build container needs a go.work file to support running commands across multiple Go modules (main module and submodules like build, core, errors, etc.). Without go.work, commands like 'go run ./build/internal/cmd/gitea/...' fail because Go doesn't recognize build as part of the workspace and treats it as an external module that's not in the dependency graph. This change dynamically creates a go.work file in the container after mounting the full project, enabling the workspace mode that allows tests to run commands in submodules while maintaining access to the main module's resources. Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --------- Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> Signed-off-by: tejasvini1 <33099251+ptejasvini@users.noreply.github.com>
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.
Summary
Updates the Dagger base image build process to work without
go.workandgo.work.sumfiles, which were removed from version control as they are meant for local development only.Changes
build/internal/flipt.go:go.workworkspace filesgo.modandgo.sumreplacedirectivesgolang.org/x/mod/modfileimportBackward Compatibility
This change maintains full compatibility with the existing build process. The Dagger build now uses the
replacedirectives ingo.modas the source of truth for which submodule dependency files to mount, rather than parsing workspace files.