Dagger
Search

greeter

via a remote git ref cannot walk into a workspace subdirectory through a
Directory argument annotated with defaultPath="/" + ignore patterns.

When loaded as github.com/dagger/dagger-test-modules/workspace-default-path/greeter@,
the module's defaultPath="/" must resolve to the repo root (where .git and
the root dagger.json live). The ignore patterns exclude everything except
workspace-default-path/target-subdir/, so workspace.Directory(
"workspace-default-path/target-subdir") must return a directory whose
contents include hello.txt.

This mirrors toolchains/java-sdk-dev's production pattern:

pub workspace: Directory! @defaultPath(path: "/") @ignorePatterns(patterns: [
"*",
"!sdk/java/runtime/images/",
...
])

workspace.directory("sdk/java/runtime/images/maven")

Installation

dagger install github.com/dagger/dagger-test-modules/workspace-default-path/greeter@ea9f448364a8d3a9278e0de8303fc987f839bbab

Entrypoint

Return Type
Greeter
Example
dagger -m github.com/dagger/dagger-test-modules/workspace-default-path/greeter@ea9f448364a8d3a9278e0de8303fc987f839bbab call \
func (m *MyModule) Example() *dagger.Greeter  {
	return dag.
			Greeter()
}
@function
def example() -> dagger.Greeter:
	return (
		dag.greeter()
	)
@func()
example(): Greeter {
	return dag
		.greeter()
}

Types

Greeter 🔗

read() 🔗

Read returns the contents of target-subdir/hello.txt, reached by walking into the workspace root (defaultPath=“/”) and then into the target subdirectory. The ignore patterns must re-include that subdirectory for Read to find the file.

It also calls engine-dep (a relative dependency) to force the parent’s load path to actually resolve the sibling module — mirroring the java-sdk-dev case where ../engine-dev is fetched as part of the toolchain load.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
workspaceDirectory -No description provided
Example
dagger -m github.com/dagger/dagger-test-modules/workspace-default-path/greeter@ea9f448364a8d3a9278e0de8303fc987f839bbab call \
 read
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Greeter().
			Read(ctx)
}
@function
async def example() -> str:
	return await (
		dag.greeter()
		.read()
	)
@func()
async example(): Promise<string> {
	return dag
		.greeter()
		.read()
}

readCheck() 🔗

ReadCheck exposes the same subdirectory access as Read through a check-annotated function. The production java-sdk-dev regression surfaces via @check functions (test, lint), so this path must pass once the bug is fixed.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
workspaceDirectory -No description provided
Example
dagger -m github.com/dagger/dagger-test-modules/workspace-default-path/greeter@ea9f448364a8d3a9278e0de8303fc987f839bbab call \
 read-check
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Greeter().
			ReadCheck(ctx)
}
@function
async def example() -> None:
	return await (
		dag.greeter()
		.read_check()
	)
@func()
async example(): Promise<void> {
	return dag
		.greeter()
		.readCheck()
}

workspaceEntries() 🔗

WorkspaceEntries lists the entries at the workspace root after ignore patterns are applied. It’s a sanity check that distinguishes “workspace root doesn’t load” from “walking into a subdirectory fails” — only the latter is the target bug.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
workspaceDirectory -No description provided
Example
dagger -m github.com/dagger/dagger-test-modules/workspace-default-path/greeter@ea9f448364a8d3a9278e0de8303fc987f839bbab call \
 workspace-entries
func (m *MyModule) Example(ctx context.Context) []string  {
	return dag.
			Greeter().
			WorkspaceEntries(ctx)
}
@function
async def example() -> List[str]:
	return await (
		dag.greeter()
		.workspace_entries()
	)
@func()
async example(): Promise<string[]> {
	return dag
		.greeter()
		.workspaceEntries()
}