MCPcopy Index your code
hub / github.com/dagger/dagger / resolveModule

Method resolveModule

engine/server/session_workspaces.go:983–1012  ·  view source on GitHub ↗

resolveModule resolves a module through the dagql pipeline. Handles all module sources uniformly: legacy compat modules, implicit CWD modules, and -m flag modules. Legacy settings (LegacyDefaultPath, ArgCustomizations, WorkspaceConfig, etc.) are passed as internal args to asModule so they are appli

(
	ctx context.Context,
	dag *dagql.Server,
	mod pendingModule,
)

Source from the content-addressed store, hash-verified

981// is installed into dagql — mutating the result after Select is incorrect because
982// dagql may return a cached (and already-installed) pointer.
983func (srv *Server) resolveModule(
984 ctx context.Context,
985 dag *dagql.Server,
986 mod pendingModule,
987) (dagql.ObjectResult[*core.Module], error) {
988 srcArgs := []dagql.NamedInput{
989 {Name: "refString", Value: dagql.String(mod.Ref)},
990 }
991 if mod.RefPin != "" {
992 srcArgs = append(srcArgs, dagql.NamedInput{Name: "refPin", Value: dagql.String(mod.RefPin)})
993 }
994 if mod.DisableFindUp {
995 srcArgs = append(srcArgs, dagql.NamedInput{Name: "disableFindUp", Value: dagql.Boolean(true)})
996 }
997
998 var src dagql.ObjectResult[*core.ModuleSource]
999 err := dag.Select(ctx, dag.Root(), &src,
1000 dagql.Selector{Field: "moduleSource", Args: srcArgs},
1001 )
1002 if err != nil {
1003 return dagql.ObjectResult[*core.Module]{}, fmt.Errorf("resolving module source %q: %w", mod.Ref, err)
1004 }
1005
1006 resolved, err := srv.resolveModuleSourceAsModule(ctx, dag, src, mod)
1007 if err != nil {
1008 return dagql.ObjectResult[*core.Module]{}, fmt.Errorf("resolving module source %q: %w", mod.Ref, err)
1009 }
1010
1011 return resolved, nil
1012}
1013
1014func (srv *Server) mergeLegacyCallerEnvDefaults(
1015 ctx context.Context,

Callers 1

resolveModuleLoadMethod · 0.95

Calls 5

StringTypeAlias · 0.92
BooleanTypeAlias · 0.92
SelectMethod · 0.65
RootMethod · 0.45

Tested by

no test coverage detected