8000 fix(build): update Dagger build to work without go.work files by markphelps · Pull Request #4817 · flipt-io/flipt · GitHub
[go: up one dir, main page]

Skip to content

fix(build): update Dagger build to work without go.work files#4817

Merged
markphelps merged 3 commits intov2from
fix/remove-workspace-dagger-build
Oct 2, 2025
Merged

fix(build): update Dagger build to work without go.work files#4817
markphelps merged 3 commits intov2from
fix/remove-workspace-dagger-build

Conversation

@markphelps
Copy link
Collaborator

Summary

Updates the Dagger base image build process to work without go.work and go.work.sum files, which were removed from version control as they are meant for local development only.

Changes

  • Modified build/internal/flipt.go:
    • Removed parsing of go.work workspace files
    • Now directly mounts root go.mod and go.sum
    • Explicitly mounts submodule dependency files based on replace directives
    • Removed unused golang.org/x/mod/modfile import
    • Supports v2 branch with 6 submodules (core, errors, rpc/flipt, rpc/v2/environments, rpc/v2/evaluation, sdk/go)

Backward Compatibility

This change maintains full compatibility with the existing build process. The Dagger build now uses the replace directives in go.mod as the source of truth for which submodule dependency files to mount, rather than parsing workspace 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 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>
@markphelps markphelps requested a review from a team as a code owner October 2, 2025 17:36
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 2, 2025
@dosubot
Copy link
dosubot bot commented Oct 2, 2025

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

How did I do? Any feedback?  Join Discord

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
Copy link
codecov bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.49%. Comparing base (58bb542) to head (0542485).
⚠️ Report is 3 commits behind head on v2.

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              
Flag Coverage Δ
integrationtests 33.17% <ø> (-0.75%) ⬇️
unittests 49.12% <ø> (ø)

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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>
@markphelps markphelps merged commit dc81622 into v2 Oct 2, 2025
27 of 29 checks passed
@markphelps markphelps deleted the fix/remove-workspace-dagger-build branch October 2, 2025 18:11
@dosubot
Copy link
dosubot bot commented Oct 2, 2025

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

How did I do? Any feedback?  Join Discord

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0