Merge pull request #1790 from shykes/nop

dagger.#Nop: work around bugs in the DAG resolver
This commit is contained in:
Andrea Luzzardi
2022-03-16 13:40:26 -07:00
committed by GitHub
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
package dagger
// A core action that does nothing
// Useful to work around bugs in the DAG resolver.
// See for example https://github.com/dagger/dagger/issues/1789
#Nop: {
$dagger: task: _name: "Nop"
input: _
output: input
}

20
plan/task/nop.go Normal file
View File

@@ -0,0 +1,20 @@
package task
import (
"context"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
)
func init() {
Register("Nop", func() Task { return &nopTask{} })
}
type nopTask struct {
}
func (t *nopTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
return v, nil
}