MCPcopy Create free account
hub / github.com/dagger/dagger / namespaceFromModule

Function namespaceFromModule

core/schema/cache.go:96–119  ·  view source on GitHub ↗
(ctx context.Context, m *core.Module)

Source from the content-addressed store, hash-verified

94}
95
96func namespaceFromModule(ctx context.Context, m *core.Module) (string, error) {
97 if m == nil {
98 return "mainClient", nil
99 }
100
101 src := m.Source.Value
102 name := src.Self().ModuleOriginalName
103
104 var symbolic string
105 switch src.Self().Kind {
106 case core.ModuleSourceKindLocal:
107 symbolic = src.Self().SourceRootSubpath
108 case core.ModuleSourceKindGit:
109 symbolic = src.Self().Git.Symbolic
110 case core.ModuleSourceKindDir:
111 sourceDigest, err := src.Self().SourceImplementationDigest(ctx)
112 if err != nil {
113 return "", err
114 }
115 symbolic = sourceDigest.String()
116 }
117
118 return "mod(" + name + symbolic + ")", nil
119}

Callers 1

cacheVolumeCacheKeyMethod · 0.85

Calls 3

SelfMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected