status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
stdout { contents } } } } } } }` rand1 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand1, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand2, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedTemp(t *testing.T) { t.Parallel() execRes := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
From struct { WithMountedTemp struct { Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query(`{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { exec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) { stdout { contents } } } } } }`, &execRes, nil) require.NoError(t, err) require.Contains(t, execRes.Container.From.WithMountedTemp.Exec.Stdout.Contents, "tmpfs /mnt/tmp tmpfs") } func TestContainerMountsWithoutMount(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID string } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID execRes := struct { Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
WithMountedTemp struct { Mounts []string WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithoutMount struct { Mounts []string Exec struct { Stdout struct { Contents string } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { mounts withMountedDirectory(path: "/mnt/dir", source: $id) { mounts
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
exec(args: ["ls", "/mnt/dir"]) { stdout { contents } withoutMount(path: "/mnt/dir") { mounts exec(args: ["ls", "/mnt/dir"]) { stdout { contents } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.Mounts) require.Equal(t, []string{"/mnt/tmp", "/mnt/dir"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Mounts) require.Equal(t, "some-dir\nsome-file\n", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Mounts) } func TestContainerStackedMounts(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { ID string } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "lower-content") { id } } }`, &dirRes, nil) require.NoError(t, err) lowerID := dirRes.Directory.WithNewFile.ID err = testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "upper-content") { id } } }`, &dirRes, nil) require.NoError(t, err) upperID := dirRes.Directory.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithoutMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Mounts []string Exec struct { Stdout struct { Contents string } } } } } } } } } }{} err = testutil.Query( `query Test($lower: DirectoryID!, $upper: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $lower) { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents } withMountedDirectory(path: "/mnt/dir", source: $upper) { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} withoutMount(path: "/mnt/dir") { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "lower": lowerID, "upper": upperID, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Mounts) require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/dir", "/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Mounts) require.Equal(t, "upper-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Mounts) require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents) } func TestContainerDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID writeRes := struct { Container struct { From struct { WithMountedDirectory struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { ID core.DirectoryID } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withMountedDirectory(path: "/mnt/dir/overlap", source: $id) { exec(args: ["sh", "-c", "echo hello >> /mnt/dir/overlap/another-file"]) { directory(path: "/mnt/dir/overlap") { id } } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.Exec.Directory.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["cat", "/mnt/dir/another-file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "hello\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerDirectoryErrors(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/some-file") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "path /mnt/dir/some-file is a file, not a directory") err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: no such file or directory") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
directory(path: "/mnt/tmp/bogus") { id } } } } }`, nil, nil) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs") cacheID := newCache(t) err = testutil.Query( `query Test($cache: CacheID!) { container { from(address: "alpine:3.16.2") { withMountedCache(path: "/mnt/cache", cache: $cache) { directory(path: "/mnt/cache/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache") } func TestContainerDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { Directory struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-dir/sub-file", contents: "sub-content\n") { directory(path: "some-dir") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.Directory.ID writeRes := struct { Container struct { From struct { WithMountedDirectory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Exec struct { Directory struct { ID core.DirectoryID } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["sh", "-c", "echo more-content >> /mnt/dir/sub-dir/sub-file"]) { directory(path: "/mnt/dir/sub-dir") { id } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.Exec.Directory.ID execRes := struct { Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["cat", "/mnt/dir/sub-file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerFile(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
t.Parallel() id := newDirWithFile(t, "some-file", "some-content-") writeRes := struct { Container struct { From struct { WithMountedDirectory struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
File struct { ID core.FileID } } } } } } }{} err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withMountedDirectory(path: "/mnt/dir/overlap", source: $id) { exec(args: ["sh", "-c", "echo -n appended >> /mnt/dir/overlap/some-file"]) { file(path: "/mnt/dir/overlap/some-file") { id } } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.Exec.File.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
WithMountedFile struct { Exec struct { Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: FileID!) { container { from(address: "alpine:3.16.2") { withMountedFile(path: "/mnt/file", source: $id) { exec(args: ["cat", "/mnt/file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "some-content-appended", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents) } func TestContainerFileErrors(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
t.Parallel() id := newDirWithFile(t, "some-file", "some-content") err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { file(path: "/mnt/dir/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: no such file or directory") err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { file(path: "/mnt/dir") { id }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "path /mnt/dir is a directory, not a file") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { file(path: "/mnt/tmp/bogus") { id } } } } }`, nil, nil) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs") cacheID := newCache(t) err = testutil.Query( `query Test($cache: CacheID!) { container { from(address: "alpine:3.16.2") { withMountedCache(path: "/mnt/cache", cache: $cache) { file(path: "/mnt/cache/bogus") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache") secretID := newSecret(t, "some-secret") err = testutil.Query( `query Test($secret: SecretID!) { container { from(address: "alpine:3.16.2") { withMountedSecret(path: "/sekret", source: $secret) { file(path: "/sekret") { contents } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "secret": secretID, }}) require.Error(t, err) require.Contains(t, err.Error(), "sekret: no such file or directory") } func TestContainerFSDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Container struct { From struct { Directory struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { directory(path: "/etc") { id } } } }`, &dirRes, nil) require.NoError(t, err) etcID := dirRes.Container.From.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/etc", source: $id) { exec(args: ["cat", "/mnt/etc/alpine-release"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": etcID, }}) require.NoError(t, err) require.Equal(t, "3.16.2\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerRelativePaths(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { WithNewFile struct { ID core.DirectoryID } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { id } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.ID writeRes := struct { Container struct { From struct { Exec struct { WithWorkdir struct { WithWorkdir struct { Workdir string WithMountedDirectory struct { WithMountedTemp struct { WithMountedCache struct { Mounts []string Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Directory struct { ID core.DirectoryID } } WithoutMount struct { Mounts []string } } } } } } } } } }{} cacheID := newCache(t) err = testutil.Query( `query Test($id: DirectoryID!, $cache: CacheID!) { container { from(address: "alpine:3.16.2") { exec(args: ["mkdir", "-p", "/mnt/sub"]) { withWorkdir(path: "/mnt") { withWorkdir(path: "sub") { workdir withMountedDirectory(path: "dir", source: $id) { withMountedTemp(path: "tmp") { withMountedCache(path: "cache", cache: $cache) { mounts exec(args: ["touch", "dir/another-file"]) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
directory(path: "dir") { id } } withoutMount(path: "cache") { mounts } } } } } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/sub/dir", "/mnt/sub/tmp", "/mnt/sub/cache"}, writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.Mounts) require.Equal(t, []string{"/mnt/sub/dir", "/mnt/sub/tmp"}, writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.WithoutMount.Mounts) writtenID := writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.Exec.Directory.ID execRes := struct { Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["ls", "/mnt/dir"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "another-file\nsome-file\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerMultiFrom(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
t.Parallel() dirRes := struct { Directory struct { ID core.DirectoryID } }{} err := testutil.Query( `{ directory { id } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
Exec struct { Exec struct { Stdout struct { Contents string } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "node:18.10.0-alpine") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["sh", "-c", "node --version >> /mnt/versions"]) { from(address: "golang:1.18.2-alpine") { exec(args: ["sh", "-c", "go version >> /mnt/versions"]) { exec(args: ["cat", "/mnt/versions"]) { stdout { contents } } } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Contains(t, execRes.Container.From.WithMountedDirectory.Exec.From.Exec.Exec.Stdout.Contents, "v18.10.0\n") require.Contains(t, execRes.Container.From.WithMountedDirectory.Exec.From.Exec.Exec.Stdout.Contents, "go version go1.18.2") } func TestContainerPublish(t *testing.T) { ctx := context.Background() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() randomID := identity.NewID() go func() { err := c.Do(ctx, &dagger.Request{ Query: `query RunRegistry($rand: String!) { container { from(address: "registry:2") { withEnvVariable(name: "RANDOM", value: $rand) { exec(args: ["/etc/docker/registry/config.yml"]) { stdout { contents } stderr {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
contents } } } } } }`, Variables: map[string]any{ "rand": randomID, }, }, &dagger.Response{Data: new(map[string]any)}, ) if err != nil { t.Logf("error running registry: %v", err) } }() err = c.Do(ctx, &dagger.Request{ Query: `query WaitForRegistry($rand: String!) { container { from(address: "alpine:3.16.2") { withEnvVariable(name: "RANDOM", value: $rand) { exec(args: ["sh", "-c", "for i in $(seq 1 60); do nc -zv 127.0.0.1 5000 && exit 0; sleep 1; done; exit 1"]) { stdout { contents } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
} }`, Variables: map[string]any{ "rand": randomID, }, }, &dagger.Response{Data: new(map[string]any)}, ) require.NoError(t, err) testRef := core.ContainerAddress("127.0.0.1:5000/testimagepush:latest") err = c.Do(ctx, &dagger.Request{ Query: `query TestImagePush($ref: ContainerAddress!) { container { from(address: "alpine:3.16.2") { publish(address: $ref) } } }`, Variables: map[string]any{ "ref": testRef, }, }, &dagger.Response{Data: new(map[string]any)}, ) require.NoError(t, err) res := struct { Container struct { From struct { Fs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/container_test.go
File struct { Contents string } } } } }{} err = c.Do(ctx, &dagger.Request{ Query: `query TestImagePull($ref: ContainerAddress!) { container { from(address: $ref) { fs { file(path: "/etc/alpine-release") { contents } } } } }`, Variables: map[string]any{ "ref": testRef, }, }, &dagger.Response{Data: &res}, ) require.NoError(t, err) require.Equal(t, res.Container.From.Fs.File.Contents, "3.16.2\n") }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
package core import ( "testing" "github.com/stretchr/testify/require" "go.dagger.io/dagger/core" "go.dagger.io/dagger/internal/testutil" ) func TestEmptyDirectory(t *testing.T) { t.Parallel() var res struct { Directory struct { ID core.DirectoryID Contents []string } } err := testutil.Query( `{ directory { id contents } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Directory.ID) require.Empty(t, res.Directory.Contents) } func TestDirectoryWithNewFile(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithNewFile struct { ID core.DirectoryID Contents []string } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { id contents } } }`, &res, nil) require.NoError(t, err) require.NotEmpty(t, res.Directory.WithNewFile.ID) require.Equal(t, []string{"some-file"}, res.Directory.WithNewFile.Contents) } func TestDirectoryContents(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithNewFile struct { WithNewFile struct { Contents []string } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "some-content") { contents } } } }`, &res, nil) require.NoError(t, err) require.ElementsMatch(t, []string{"some-file", "some-dir"}, res.Directory.WithNewFile.WithNewFile.Contents) } func TestDirectoryContentsOfPath(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithNewFile struct { WithNewFile struct { Contents []string } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "some-content") { contents(path: "some-dir") } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Contents) } func TestDirectoryDirectory(t *testing.T) { t.Parallel() var res struct { Directory struct { WithNewFile struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
WithNewFile struct { Directory struct { Contents []string } } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "some-content") { directory(path: "some-dir") { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Directory.Contents) } func TestDirectoryDirectoryWithNewFile(t *testing.T) { t.Parallel() var res struct { Directory struct { WithNewFile struct { WithNewFile struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
WithNewFile struct { Contents []string } } } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "some-content") { directory(path: "some-dir") { withNewFile(path: "another-file", contents: "more-content") { contents } } } } } }`, &res, nil) require.NoError(t, err) require.ElementsMatch(t, []string{"sub-file", "another-file"}, res.Directory.WithNewFile.WithNewFile.Directory.WithNewFile.Contents) } func TestDirectoryWithDirectory(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithNewFile struct { WithNewFile struct { Directory struct { ID core.DirectoryID } } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "some-content") { directory(path: "some-dir") { id } } } } }`, &res, nil) require.NoError(t, err) var res2 struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithDirectory struct { Contents []string } } } err = testutil.Query( `query Test($src: DirectoryID!) { directory { withDirectory(path: "with-dir", directory: $src) { contents(path: "with-dir") } } }`, &res2, &testutil.QueryOptions{ Variables: map[string]any{ "src": res.Directory.WithNewFile.WithNewFile.Directory.ID, }, }) require.NoError(t, err) require.Equal(t, []string{"sub-file"}, res2.Directory.WithDirectory.Contents) err = testutil.Query( `query Test($src: DirectoryID!) { directory { withDirectory(path: "sub-dir/sub-sub-dir/with-dir", directory: $src) { contents(path: "sub-dir/sub-sub-dir/with-dir") } } }`, &res2, &testutil.QueryOptions{
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Variables: map[string]any{ "src": res.Directory.WithNewFile.WithNewFile.Directory.ID, }, }) require.NoError(t, err) require.Equal(t, []string{"sub-file"}, res2.Directory.WithDirectory.Contents) } func TestDirectoryWithCopiedFile(t *testing.T) { var fileRes struct { Directory struct { WithNewFile struct { File struct { ID core.DirectoryID } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { file(path: "some-file") { id } } } }`, &fileRes, nil) require.NoError(t, err) require.NotEmpty(t, fileRes.Directory.WithNewFile.File.ID) var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithCopiedFile struct { File struct { ID core.DirectoryID Contents string } } } } err = testutil.Query( `query Test($src: FileID!) { directory { withCopiedFile(path: "target-file", source: $src) { file(path: "target-file") { id contents } } } }`, &res, &testutil.QueryOptions{ Variables: map[string]any{ "src": fileRes.Directory.WithNewFile.File.ID, }, }) require.NoError(t, err) require.NotEmpty(t, res.Directory.WithCopiedFile.File.ID) require.Equal(t, "some-content", res.Directory.WithCopiedFile.File.Contents) } func TestDirectoryWithoutDirectory(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
t.Parallel() dirID := newDirWithFiles(t, "some-file", "some-content", "some-dir/sub-file", "sub-content") var res2 struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
WithDirectory struct { WithoutDirectory struct { Contents []string } } } } err := testutil.Query( `query Test($src: DirectoryID!) { directory { withDirectory(path: "with-dir", directory: $src) { withoutDirectory(path: "with-dir/some-dir") { contents(path: "with-dir") } } } }`, &res2, &testutil.QueryOptions{ Variables: map[string]any{ "src": dirID, }, }) require.NoError(t, err) require.Equal(t, []string{"some-file"}, res2.Directory.WithDirectory.WithoutDirectory.Contents) } func TestDirectoryWithoutFile(t *testing.T) { t.Parallel() dirID := newDirWithFiles(t, "some-file", "some-content", "some-dir/sub-file", "sub-content") var res2 struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { WithDirectory struct { WithoutFile struct { Contents []string } } } } err := testutil.Query( `query Test($src: DirectoryID!) { directory { withDirectory(path: "with-dir", directory: $src) { withoutFile(path: "with-dir/some-file") { contents(path: "with-dir") } } } }`, &res2, &testutil.QueryOptions{ Variables: map[string]any{ "src": dirID, }, }) require.NoError(t, err) require.Equal(t, []string{"some-dir"}, res2.Directory.WithDirectory.WithoutFile.Contents) } func TestDirectoryDiff(t *testing.T) { t.Parallel() aID := newDirWithFile(t, "a-file", "a-content") bID := newDirWithFile(t, "b-file", "b-content") var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Directory struct { Diff struct { Contents []string } } } diff := `query Diff($id: DirectoryID!, $other: DirectoryID!) { directory(id: $id) { diff(other: $other) { contents } } }` err := testutil.Query(diff, &res, &testutil.QueryOptions{
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/directory_test.go
Variables: map[string]any{ "id": aID, "other": bID, }, }) require.NoError(t, err) require.Equal(t, []string{"b-file"}, res.Directory.Diff.Contents) err = testutil.Query(diff, &res, &testutil.QueryOptions{ Variables: map[string]any{ "id": bID, "other": aID, }, }) require.NoError(t, err) require.Equal(t, []string{"a-file"}, res.Directory.Diff.Contents) /* This triggers a nil panic in Buildkit! Issue: https://github.com/dagger/dagger/issues/3337 This might be fixed once we update Buildkit. err = testutil.Query(diff, &res, &testutil.QueryOptions{ Variables: map[string]any{ "id": aID, "other": aID, }, }) require.NoError(t, err) require.Empty(t, res.Directory.Diff.Contents) */ }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
package core import ( "context" "fmt" "testing" "github.com/stretchr/testify/require" "go.dagger.io/dagger/sdk/go/dagger" ) func TestExtensionAlpine(t *testing.T) { ctx := context.Background() c, err := dagger.Connect( ctx, dagger.WithWorkdir("../../"), dagger.WithConfigPath("../../examples/alpine/dagger.json"), ) require.NoError(t, err) defer c.Close() data := struct { Alpine struct { Build struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
Exec struct { Stdout struct { Contents string } } } } }{} resp := &dagger.Response{Data: &data} err = c.Do(ctx, &dagger.Request{ Query: ` query { alpine { build(pkgs: ["curl"]) { exec(args: ["curl", "--version"]) { stdout { contents } } } } }`, }, resp, ) require.NoError(t, err) require.NotEmpty(t, data.Alpine.Build.Exec.Stdout.Contents) } func TestExtensionNetlify(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
t.Skip("Skipping test until shared netlify tokens are supported here, feel free to run locally though") runner := func(lang string) func(*testing.T) { return func(t *testing.T) { ctx := context.Background() c, err := dagger.Connect( ctx, dagger.WithWorkdir("../../"), dagger.WithConfigPath(fmt.Sprintf("../../examples/netlify/%s/dagger.json", lang)), ) require.NoError(t, err) defer c.Close() dirID, err := c.Core().Host().Workdir().Read().ID(ctx) require.NoError(t, err) secretID, err := c.Core().Host().Variable("NETLIFY_AUTH_TOKEN").Secret().ID(ctx) require.NoError(t, err) data := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
Netlify struct { Deploy struct { URL string } } }{} resp := &dagger.Response{Data: &data} err = c.Do(ctx, &dagger.Request{ Query: `query TestNetlify( $source: DirectoryID!, $token: SecretID!, ) { netlify { deploy( contents: $source, siteName: "test-cloak-netlify-deploy", token: $token, ) { url
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
} } }`, Variables: map[string]any{ "source": dirID, "token": secretID, }, }, resp, ) require.NoError(t, err) require.NotEmpty(t, data.Netlify.Deploy.URL) } } for _, lang := range []string{"go", "ts"} { t.Run(lang, runner(lang)) } } func TestExtensionYarn(t *testing.T) { ctx := context.Background() c, err := dagger.Connect( ctx, dagger.WithWorkdir("../../"), dagger.WithConfigPath("../../examples/yarn/dagger.json"), ) require.NoError(t, err) defer c.Close() dirID, err := c.Core().Host().Workdir().Read().ID(ctx) require.NoError(t, err) data := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
Yarn struct { Script struct { Contents []string } } }{} resp := &dagger.Response{Data: &data} err = c.Do(ctx, &dagger.Request{ Query: `query TestYarn($source: DirectoryID!) { yarn { script(source: $source, runArgs: ["build"]) { contents(path: "sdk/nodejs/dagger/dist") } } }`, Variables: map[string]any{ "source": dirID, }, }, resp, ) require.NoError(t, err) require.NotEmpty(t, data.Yarn.Script.Contents) data2 := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/integration/examples_test.go
Directory struct { Yarn struct { Contents []string } } }{} resp2 := &dagger.Response{Data: &data2} err = c.Do(ctx, &dagger.Request{ Query: `query TestYarn($source: DirectoryID!) { directory(id: $source) { yarn(runArgs: ["build"]) { contents(path: "sdk/nodejs/dagger/dist") } } }`, Variables: map[string]any{ "source": dirID, }, }, resp2, ) require.NoError(t, err) require.NotEmpty(t, data2.Directory.Yarn.Contents) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/schema/directory.go
package schema import ( "go.dagger.io/dagger/core" "go.dagger.io/dagger/router" ) type directorySchema struct { *baseSchema } var _ router.ExecutableSchema = &directorySchema{} func (s *directorySchema) Name() string { return "directory" } func (s *directorySchema) Schema() string { return Directory } var directoryIDResolver = stringResolver(core.DirectoryID("")) func (s *directorySchema) Resolvers() router.Resolvers { return router.Resolvers{ "DirectoryID": directoryIDResolver, "Query": router.ObjectResolver{ "directory": router.ToResolver(s.directory), }, "Directory": router.ObjectResolver{
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/schema/directory.go
"contents": router.ToResolver(s.contents), "file": router.ToResolver(s.file), "withNewFile": router.ToResolver(s.withNewFile), "withCopiedFile": router.ToResolver(s.withCopiedFile), "withoutFile": router.ToResolver(s.withoutFile), "directory": router.ToResolver(s.subdirectory), "withDirectory": router.ToResolver(s.withDirectory), "withoutDirectory": router.ToResolver(s.withoutDirectory), "diff": router.ToResolver(s.diff), }, } } func (s *directorySchema) Dependencies() []router.ExecutableSchema { return nil } type directoryArgs struct { ID core.DirectoryID } func (s *directorySchema) directory(ctx *router.Context, parent any, args directoryArgs) (*core.Directory, error) { return &core.Directory{ ID: args.ID, }, nil } type subdirectoryArgs struct { Path string } func (s *directorySchema) subdirectory(ctx *router.Context, parent *core.Directory, args subdirectoryArgs) (*core.Directory, error) { return parent.Directory(ctx, args.Path) } type withDirectoryArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/schema/directory.go
Path string Directory core.DirectoryID } func (s *directorySchema) withDirectory(ctx *router.Context, parent *core.Directory, args withDirectoryArgs) (*core.Directory, error) { return parent.WithDirectory(ctx, args.Path, &core.Directory{ID: args.Directory}) } type contentArgs struct { Path string } func (s *directorySchema) contents(ctx *router.Context, parent *core.Directory, args contentArgs) ([]string, error) { return parent.Contents(ctx, s.gw, args.Path) } type dirFileArgs struct { Path string } func (s *directorySchema) file(ctx *router.Context, parent *core.Directory, args dirFileArgs) (*core.File, error) { return parent.File(ctx, args.Path) } type withNewFileArgs struct { Path string Contents string } func (s *directorySchema) withNewFile(ctx *router.Context, parent *core.Directory, args withNewFileArgs) (*core.Directory, error) { return parent.WithNewFile(ctx, s.gw, args.Path, []byte(args.Contents)) } type withCopiedFileArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
core/schema/directory.go
Path string Source core.FileID } func (s *directorySchema) withCopiedFile(ctx *router.Context, parent *core.Directory, args withCopiedFileArgs) (*core.Directory, error) { return parent.WithCopiedFile(ctx, args.Path, &core.File{ID: args.Source}) } type withoutDirectoryArgs struct { Path string } func (s *directorySchema) withoutDirectory(ctx *router.Context, parent *core.Directory, args withoutDirectoryArgs) (*core.Directory, error) { return parent.Without(ctx, args.Path) } type withoutFileArgs struct { Path string } func (s *directorySchema) withoutFile(ctx *router.Context, parent *core.Directory, args withoutFileArgs) (*core.Directory, error) { return parent.Without(ctx, args.Path) } type diffArgs struct { Other core.DirectoryID } func (s *directorySchema) diff(ctx *router.Context, parent *core.Directory, args diffArgs) (*core.Directory, error) { return parent.Diff(ctx, &core.Directory{ID: args.Other}) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
package api import ( "context" "github.com/Khan/genqlient/graphql" "go.dagger.io/dagger/sdk/go/dagger/querybuilder" ) func New(c graphql.Client) *Query { return &Query{
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q: querybuilder.Query(), c: c, } } type GraphQLMarshaller interface { GraphQLType() string GraphQLMarshal(ctx context.Context) (any, error) } type CacheID string func (s CacheID) GraphQLType() string { return "CacheID" } func (s CacheID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type ContainerAddress string func (s ContainerAddress) GraphQLType() string { return "ContainerAddress" } func (s ContainerAddress) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type ContainerID string func (s ContainerID) GraphQLType() string { return "ContainerID" } func (s ContainerID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} type DirectoryID string func (s DirectoryID) GraphQLType() string { return "DirectoryID" } func (s DirectoryID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type FileID string func (s FileID) GraphQLType() string { return "FileID" } func (s FileID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type HostDirectoryID string func (s HostDirectoryID) GraphQLType() string { return "HostDirectoryID" } func (s HostDirectoryID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type SecretID string func (s SecretID) GraphQLType() string { return "SecretID" } func (s SecretID) GraphQLMarshal(ctx context.Context) (any, error) { return string(s), nil } type CacheVolume struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *CacheVolume) ID(ctx context.Context) (CacheID, error) { q := r.q.Select("id") var response CacheID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *CacheVolume) GraphQLType() string { return "CacheVolume" } func (r *CacheVolume) GraphQLMarshal(ctx context.Context) (any, error) { id, err := r.ID(ctx) if err != nil { return nil, err } return map[string]any{"id": id}, nil } type Container struct { q *querybuilder.Selection c graphql.Client } func (r *Container) DefaultArgs(ctx context.Context) ([]string, error) { q := r.q.Select("defaultArgs") var response []string q = q.Bind(&response)
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
return response, q.Execute(ctx, r.c) } func (r *Container) Directory(path string) *Directory { q := r.q.Select("directory") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } func (r *Container) Entrypoint(ctx context.Context) ([]string, error) { q := r.q.Select("entrypoint") var response []string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Container) EnvVariable(ctx context.Context, name string) (string, error) { q := r.q.Select("envVariable") q = q.Arg("name", name) var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Container) EnvVariables(ctx context.Context) ([]EnvVariable, error) { q := r.q.Select("envVariables") var response []EnvVariable q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type ContainerExecOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
Args []string RedirectStderr string RedirectStdout string Stdin string } func (r *Container) Exec(opts ...ContainerExecOpts) *Container { q := r.q.Select("exec") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Args) { q = q.Arg("args", opts[i].Args) break } } for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].RedirectStderr) { q = q.Arg("redirectStderr", opts[i].RedirectStderr) break } } for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].RedirectStdout) { q = q.Arg("redirectStdout", opts[i].RedirectStdout) break } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Stdin) { q = q.Arg("stdin", opts[i].Stdin) break } } return &Container{ q: q, c: r.c, } } func (r *Container) ExitCode(ctx context.Context) (int, error) { q := r.q.Select("exitCode") var response int q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Container) File(path string) *File { q := r.q.Select("file") q = q.Arg("path", path) return &File{ q: q, c: r.c, } } func (r *Container) From(address ContainerAddress) *Container { q := r.q.Select("from") q = q.Arg("address", address) return &Container{ q: q,
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
c: r.c, } } func (r *Container) FS() *Directory { q := r.q.Select("fs") return &Directory{ q: q, c: r.c, } } func (r *Container) ID(ctx context.Context) (ContainerID, error) { q := r.q.Select("id") var response ContainerID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Container) GraphQLType() string { return "Container" } func (r *Container) GraphQLMarshal(ctx context.Context) (any, error) { id, err := r.ID(ctx) if err != nil { return nil, err } return map[string]any{"id": id}, nil } func (r *Container) Mounts(ctx context.Context) ([]string, error) { q := r.q.Select("mounts") var response []string q = q.Bind(&response)
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
return response, q.Execute(ctx, r.c) } func (r *Container) Publish(ctx context.Context, address ContainerAddress) (ContainerAddress, error) { q := r.q.Select("publish") q = q.Arg("address", address) var response ContainerAddress q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Container) Stderr() *File { q := r.q.Select("stderr") return &File{ q: q, c: r.c, } } func (r *Container) Stdout() *File { q := r.q.Select("stdout") return &File{ q: q, c: r.c, } } func (r *Container) User(ctx context.Context) (string, error) { q := r.q.Select("user") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type ContainerWithDefaultArgsOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
Args []string } func (r *Container) WithDefaultArgs(opts ...ContainerWithDefaultArgsOpts) *Container { q := r.q.Select("withDefaultArgs") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Args) { q = q.Arg("args", opts[i].Args) break } } return &Container{ q: q, c: r.c, } } func (r *Container) WithEntrypoint(args []string) *Container { q := r.q.Select("withEntrypoint") q = q.Arg("args", args) return &Container{ q: q, c: r.c, }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} func (r *Container) WithEnvVariable(name string, value string) *Container { q := r.q.Select("withEnvVariable") q = q.Arg("name", name) q = q.Arg("value", value) return &Container{ q: q, c: r.c, } } func (r *Container) WithFS(id DirectoryID) *Container { q := r.q.Select("withFS") q = q.Arg("id", id) return &Container{ q: q, c: r.c, } } type ContainerWithMountedCacheOpts struct { Source DirectoryID } func (r *Container) WithMountedCache(cache CacheID, path string, opts ...ContainerWithMountedCacheOpts) *Container { q := r.q.Select("withMountedCache") q = q.Arg("cache", cache) q = q.Arg("path", path) for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Source) { q = q.Arg("source", opts[i].Source) break
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} } return &Container{ q: q, c: r.c, } } func (r *Container) WithMountedDirectory(path string, source DirectoryID) *Container { q := r.q.Select("withMountedDirectory") q = q.Arg("path", path) q = q.Arg("source", source) return &Container{ q: q, c: r.c, } } func (r *Container) WithMountedFile(path string, source FileID) *Container { q := r.q.Select("withMountedFile") q = q.Arg("path", path) q = q.Arg("source", source) return &Container{ q: q, c: r.c, } } func (r *Container) WithMountedSecret(path string, source SecretID) *Container { q := r.q.Select("withMountedSecret") q = q.Arg("path", path) q = q.Arg("source", source) return &Container{
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q: q, c: r.c, } } func (r *Container) WithMountedTemp(path string) *Container { q := r.q.Select("withMountedTemp") q = q.Arg("path", path) return &Container{ q: q, c: r.c, } } func (r *Container) WithSecretVariable(name string, secret SecretID) *Container { q := r.q.Select("withSecretVariable") q = q.Arg("name", name) q = q.Arg("secret", secret) return &Container{ q: q, c: r.c, } } func (r *Container) WithUser(name string) *Container { q := r.q.Select("withUser") q = q.Arg("name", name) return &Container{ q: q, c: r.c, } } func (r *Container) WithWorkdir(path string) *Container {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q := r.q.Select("withWorkdir") q = q.Arg("path", path) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutEnvVariable(name string) *Container { q := r.q.Select("withoutEnvVariable") q = q.Arg("name", name) return &Container{ q: q, c: r.c, } } func (r *Container) WithoutMount(path string) *Container { q := r.q.Select("withoutMount") q = q.Arg("path", path) return &Container{ q: q, c: r.c, } } func (r *Container) Workdir(ctx context.Context) (string, error) { q := r.q.Select("workdir") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } type DirectoryContentsOpts struct { Path string } func (r *Directory) Contents(ctx context.Context, opts ...DirectoryContentsOpts) ([]string, error) { q := r.q.Select("contents") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Path) { q = q.Arg("path", opts[i].Path) break } } var response []string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Directory) Diff(other DirectoryID) *Directory { q := r.q.Select("diff") q = q.Arg("other", other) return &Directory{ q: q, c: r.c, }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} func (r *Directory) Directory(path string) *Directory { q := r.q.Select("directory") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } func (r *Directory) File(path string) *File { q := r.q.Select("file") q = q.Arg("path", path) return &File{ q: q, c: r.c, } } func (r *Directory) ID(ctx context.Context) (DirectoryID, error) { q := r.q.Select("id") var response DirectoryID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Directory) GraphQLType() string { return "Directory" } func (r *Directory) GraphQLMarshal(ctx context.Context) (any, error) { id, err := r.ID(ctx) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} return map[string]any{"id": id}, nil } func (r *Directory) LoadProject(configPath string) *Project { q := r.q.Select("loadProject") q = q.Arg("configPath", configPath) return &Project{ q: q, c: r.c, } } func (r *Directory) WithCopiedFile(path string, source FileID) *Directory { q := r.q.Select("withCopiedFile") q = q.Arg("path", path) q = q.Arg("source", source) return &Directory{ q: q, c: r.c, } } func (r *Directory) WithDirectory(directory DirectoryID, path string) *Directory { q := r.q.Select("withDirectory") q = q.Arg("directory", directory) q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } type DirectoryWithNewFileOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
Contents string } func (r *Directory) WithNewFile(path string, opts ...DirectoryWithNewFileOpts) *Directory { q := r.q.Select("withNewFile") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Contents) { q = q.Arg("contents", opts[i].Contents) break } } q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } func (r *Directory) WithoutDirectory(path string) *Directory { q := r.q.Select("withoutDirectory") q = q.Arg("path", path)
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
return &Directory{ q: q, c: r.c, } } func (r *Directory) WithoutFile(path string) *Directory { q := r.q.Select("withoutFile") q = q.Arg("path", path) return &Directory{ q: q, c: r.c, } } type EnvVariable struct { q *querybuilder.Selection c graphql.Client } func (r *EnvVariable) Name(ctx context.Context) (string, error) { q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *EnvVariable) Value(ctx context.Context) (string, error) { q := r.q.Select("value") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type File struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *File) Contents(ctx context.Context) (string, error) { q := r.q.Select("contents") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *File) ID(ctx context.Context) (FileID, error) { q := r.q.Select("id") var response FileID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *File) GraphQLType() string { return "File" } func (r *File) GraphQLMarshal(ctx context.Context) (any, error) { id, err := r.ID(ctx) if err != nil { return nil, err } return map[string]any{"id": id}, nil } func (r *File) Secret() *Secret {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q := r.q.Select("secret") return &Secret{ q: q, c: r.c, } } func (r *File) Size(ctx context.Context) (int, error) { q := r.q.Select("size") var response int q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type GitRef struct { q *querybuilder.Selection c graphql.Client } func (r *GitRef) Digest(ctx context.Context) (string, error) { q := r.q.Select("digest") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *GitRef) Tree() *Directory { q := r.q.Select("tree") return &Directory{ q: q, c: r.c, } } type GitRepository struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *GitRepository) Branch(name string) *GitRef { q := r.q.Select("branch") q = q.Arg("name", name) return &GitRef{ q: q, c: r.c, } } func (r *GitRepository) Branches(ctx context.Context) ([]string, error) { q := r.q.Select("branches") var response []string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *GitRepository) Tag(name string) *GitRef { q := r.q.Select("tag") q = q.Arg("name", name) return &GitRef{ q: q, c: r.c, } } func (r *GitRepository) Tags(ctx context.Context) ([]string, error) { q := r.q.Select("tags") var response []string q = q.Bind(&response)
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
return response, q.Execute(ctx, r.c) } type Host struct { q *querybuilder.Selection c graphql.Client } func (r *Host) Directory(id HostDirectoryID) *HostDirectory { q := r.q.Select("directory") q = q.Arg("id", id) return &HostDirectory{ q: q, c: r.c, } } func (r *Host) Variable(name string) *HostVariable { q := r.q.Select("variable") q = q.Arg("name", name) return &HostVariable{ q: q, c: r.c, } } func (r *Host) Workdir() *HostDirectory { q := r.q.Select("workdir") return &HostDirectory{ q: q, c: r.c, } } type HostDirectory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *HostDirectory) Read() *Directory { q := r.q.Select("read") return &Directory{ q: q, c: r.c, } } type HostDirectoryWriteOpts struct { Path string } func (r *HostDirectory) Write(ctx context.Context, contents DirectoryID, opts ...HostDirectoryWriteOpts) (bool, error) { q := r.q.Select("write") q = q.Arg("contents", contents) for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Path) { q = q.Arg("path", opts[i].Path) break } } var response bool q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type HostVariable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *HostVariable) Secret() *Secret { q := r.q.Select("secret") return &Secret{ q: q, c: r.c, } } func (r *HostVariable) Value(ctx context.Context) (string, error) { q := r.q.Select("value") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Project struct { q *querybuilder.Selection c graphql.Client } func (r *Project) Extensions(ctx context.Context) ([]Project, error) { q := r.q.Select("extensions") var response []Project q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Project) GeneratedCode() *Directory { q := r.q.Select("generatedCode")
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
return &Directory{ q: q, c: r.c, } } func (r *Project) Install(ctx context.Context) (bool, error) { q := r.q.Select("install") var response bool q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Project) Name(ctx context.Context) (string, error) { q := r.q.Select("name") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Project) Schema(ctx context.Context) (string, error) { q := r.q.Select("schema") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Project) SDK(ctx context.Context) (string, error) { q := r.q.Select("sdk") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) } type Query struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
q *querybuilder.Selection c graphql.Client } func (r *Query) CacheVolume(key string) *CacheVolume { q := r.q.Select("cacheVolume") q = q.Arg("key", key) return &CacheVolume{ q: q, c: r.c, } } type ContainerOpts struct { ID ContainerID } func (r *Query) Container(opts ...ContainerOpts) *Container { q := r.q.Select("container") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].ID) { q = q.Arg("id", opts[i].ID) break } } return &Container{ q: q, c: r.c, } } type DirectoryOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
ID DirectoryID } func (r *Query) Directory(opts ...DirectoryOpts) *Directory { q := r.q.Select("directory") for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].ID) { q = q.Arg("id", opts[i].ID) break } } return &Directory{ q: q, c: r.c, } } func (r *Query) File(id FileID) *File { q := r.q.Select("file") q = q.Arg("id", id) return &File{ q: q, c: r.c, } } func (r *Query) Git(url string) *GitRepository { q := r.q.Select("git") q = q.Arg("url", url) return &GitRepository{ q: q, c: r.c,
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
} } func (r *Query) Host() *Host { q := r.q.Select("host") return &Host{ q: q, c: r.c, } } func (r *Query) HTTP(url string) *File { q := r.q.Select("http") q = q.Arg("url", url) return &File{ q: q, c: r.c, } } func (r *Query) Project(name string) *Project { q := r.q.Select("project") q = q.Arg("name", name) return &Project{ q: q, c: r.c, } } func (r *Query) Secret(id SecretID) *Secret { q := r.q.Select("secret") q = q.Arg("id", id) return &Secret{ q: q,
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/api/api.gen.go
c: r.c, } } type Secret struct { q *querybuilder.Selection c graphql.Client } func (r *Secret) ID(ctx context.Context) (SecretID, error) { q := r.q.Select("id") var response SecretID q = q.Bind(&response) return response, q.Execute(ctx, r.c) } func (r *Secret) GraphQLType() string { return "Secret" } func (r *Secret) GraphQLMarshal(ctx context.Context) (any, error) { id, err := r.ID(ctx) if err != nil { return nil, err } return map[string]any{"id": id}, nil } func (r *Secret) Plaintext(ctx context.Context) (string, error) { q := r.q.Select("plaintext") var response string q = q.Bind(&response) return response, q.Execute(ctx, r.c) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/client_test.go
package dagger import ( "context" "testing" "github.com/stretchr/testify/require" "go.dagger.io/dagger/sdk/go/dagger/api" ) func TestDirectory(t *testing.T) { t.Parallel() ctx := context.Background() c, err := Connect(ctx) require.NoError(t, err) defer c.Close() dir := c.Core().Directory() contents, err := dir. WithNewFile("/hello.txt", api.DirectoryWithNewFileOpts{ Contents: "world", }). File("/hello.txt"). Contents(ctx) require.NoError(t, err) require.Equal(t, "world", contents) } func TestGit(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/client_test.go
t.Parallel() ctx := context.Background() c, err := Connect(ctx) require.NoError(t, err) defer c.Close() tree := c.Core().Git("github.com/dagger/dagger"). Branch("main"). Tree() files, err := tree.Contents(ctx) require.NoError(t, err) require.Contains(t, files, "README.md") readmeFile := tree.File("README.md") readme, err := readmeFile.Contents(ctx) require.NoError(t, err) require.NotEmpty(t, readme) require.Contains(t, readme, "Dagger") readmeID, err := readmeFile.ID(ctx) require.NoError(t, err) otherReadme, err := c.Core().File(readmeID).Contents(ctx) require.NoError(t, err) require.Equal(t, readme, otherReadme) } func TestContainer(t *testing.T) { t.Parallel() ctx := context.Background() c, err := Connect(ctx) require.NoError(t, err) defer c.Close()
closed
dagger/dagger
https://github.com/dagger/dagger
3,397
API: contents field can be ambiguous
Both `File` and `Directory` have a `contents` field. This can be confusing, for instance: ```go c.Directory().WithNewFile("/foo.txt").Contents(ctx) ``` `WithNewFile()` returns a `Directory` so here we're listing the directory rather than grabbing the contents of `/foo.txt`. With the builder pattern, it's not obvious to the naked eye which object is being returned. I suggest renaming `directory.contents` to files perhaps? e.g. ```go c.Directory().WithNewFile("/foo.txt").Files(ctx) // <-- list files c.Directory().WithNewFile("/foo.txt").File("/foo.txt").Contents() // <-- get a file's contents ``` /cc @shykes @vito @sipsma
https://github.com/dagger/dagger/issues/3397
https://github.com/dagger/dagger/pull/3441
02450d48aba17b0bb0366d56bb5cef34d0cc5bfa
744dc4d6b062d193ddd4f2f649bf78fc71c20327
2022-10-15T01:18:47Z
go
2022-10-19T22:39:18Z
sdk/go/dagger/client_test.go
alpine := c. Core(). Container(). From("alpine:3.16.2") contents, err := alpine. FS(). File("/etc/alpine-release"). Contents(ctx) require.NoError(t, err) require.Equal(t, "3.16.2\n", contents) stdout, err := alpine.Exec(api.ContainerExecOpts{ Args: []string{"cat", "/etc/alpine-release"}, }).Stdout().Contents(ctx) require.NoError(t, err) require.Equal(t, "3.16.2\n", stdout) id, err := alpine.ID(ctx) require.NoError(t, err) c. Core(). Container(api.ContainerOpts{ ID: id, }). FS(). File("/etc/alpine-release"). Contents(ctx) require.NoError(t, err) require.Equal(t, "3.16.2\n", contents) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,257
Replace `ContainerAddress` with a regular string
per https://github.com/dagger/dagger/pull/3219#discussion_r987337784 We generally use scalars for opaque values that pass through the client without ever being modified or constructed directly. `ContainerAddress` on the other hand is a user-provided string, and having to cast it to this special type is a little weird. Also, we currently use regular strings for paths (e.g. `withNewFile(path: String!)`), so it seems a little inconsistent to opt for a scalar type for image addresses but not paths.
https://github.com/dagger/dagger/issues/3257
https://github.com/dagger/dagger/pull/3443
3c9cbd207ec1c5950d3c2ae55fc555356026c682
311a1205797776e318bf979c748b538fbf80e2dd
2022-10-04T22:04:40Z
go
2022-10-19T22:59:53Z
core/container.go
package core import ( "context" "encoding/json" "fmt" "path" "strconv" "strings" "github.com/containerd/containerd/platforms" "github.com/docker/distribution/reference" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" dockerfilebuilder "github.com/moby/buildkit/frontend/dockerfile/builder" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "go.dagger.io/dagger/core/shim" ) type Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,257
Replace `ContainerAddress` with a regular string
per https://github.com/dagger/dagger/pull/3219#discussion_r987337784 We generally use scalars for opaque values that pass through the client without ever being modified or constructed directly. `ContainerAddress` on the other hand is a user-provided string, and having to cast it to this special type is a little weird. Also, we currently use regular strings for paths (e.g. `withNewFile(path: String!)`), so it seems a little inconsistent to opt for a scalar type for image addresses but not paths.
https://github.com/dagger/dagger/issues/3257
https://github.com/dagger/dagger/pull/3443
3c9cbd207ec1c5950d3c2ae55fc555356026c682
311a1205797776e318bf979c748b538fbf80e2dd
2022-10-04T22:04:40Z
go
2022-10-19T22:59:53Z
core/container.go
ID ContainerID `json:"id"` } type ContainerAddress string type ContainerID string func (id ContainerID) decode() (*containerIDPayload, error) { if id == "" { return &containerIDPayload{}, nil } var payload containerIDPayload if err := decodeID(&payload, id); err != nil { return nil, err } return &payload, nil } type containerIDPayload struct { FS *pb.Definition `json:"fs"` Config specs.ImageConfig `json:"cfg"` Mounts []ContainerMount `json:"mounts,omitempty"` Meta *pb.Definition `json:"meta,omitempty"` Platform specs.Platform `json:"platform,omitempty"` Secrets []ContainerSecret `json:"secret_env,omitempty"` } type ContainerSecret struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,257
Replace `ContainerAddress` with a regular string
per https://github.com/dagger/dagger/pull/3219#discussion_r987337784 We generally use scalars for opaque values that pass through the client without ever being modified or constructed directly. `ContainerAddress` on the other hand is a user-provided string, and having to cast it to this special type is a little weird. Also, we currently use regular strings for paths (e.g. `withNewFile(path: String!)`), so it seems a little inconsistent to opt for a scalar type for image addresses but not paths.
https://github.com/dagger/dagger/issues/3257
https://github.com/dagger/dagger/pull/3443
3c9cbd207ec1c5950d3c2ae55fc555356026c682
311a1205797776e318bf979c748b538fbf80e2dd
2022-10-04T22:04:40Z
go
2022-10-19T22:59:53Z
core/container.go
Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` } func (payload *containerIDPayload) Encode() (ContainerID, error) { id, err := encodeID(payload) if err != nil { return "", err } return ContainerID(id), nil } func (payload *containerIDPayload) FSState() (llb.State, error) { if payload.FS == nil { return llb.Scratch(), nil } return defToState(payload.FS) } const metaMount = "/dagger" const metaSourcePath = "meta" func (payload *containerIDPayload) MetaState() (*llb.State, error) { if payload.Meta == nil { return nil, nil } metaSt, err := defToState(payload.Meta) if err != nil { return nil, err } return &metaSt, nil } type ContainerMount struct {