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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
"workdir": router.ToResolver(s.workdir), "withWorkdir": router.ToResolver(s.withWorkdir), "envVariables": router.ToResolver(s.envVariables), "envVariable": router.ToResolver(s.envVariable), "withEnvVariable": router.ToResolver(s.withEnvVariable), "withSecretVariable": router.ToResolver(s.withSecretVariable), "withoutEnvVariable": router.ToResolver(s.withoutEnvVariable), "entrypoint": router.ToResolver(s.entrypoint), "withEntrypoint": router.ToResolver(s.withEntrypoint), "defaultArgs": router.ToResolver(s.defaultArgs), "withDefaultArgs": router.ToResolver(s.withDefaultArgs), "mounts": router.ToResolver(s.mounts), "withMountedDirectory": router.ToResolver(s.withMountedDirectory), "withMountedFile": router.ToResolver(s.withMountedFile), "withMountedTemp": router.ToResolver(s.withMountedTemp), "withMountedCache": router.ToResolver(s.withMountedCache), "withMountedSecret": router.ToResolver(s.withMountedSecret), "withoutMount": router.ToResolver(s.withoutMount), "exec": router.ToResolver(s.exec), "exitCode": router.ToResolver(s.exitCode), "stdout": router.ToResolver(s.stdout), "stderr": router.ToResolver(s.stderr), "publish": router.ToResolver(s.publish), }, } } func (s *containerSchema) Dependencies() []router.ExecutableSchema { return nil } type containerArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
ID core.ContainerID } func (s *containerSchema) container(ctx *router.Context, parent any, args containerArgs) (*core.Container, error) { return &core.Container{ ID: args.ID, }, nil } type containerFromArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Address core.ContainerAddress } func (s *containerSchema) from(ctx *router.Context, parent *core.Container, args containerFromArgs) (*core.Container, error) { addr := string(args.Address) refName, err := reference.ParseNormalizedNamed(addr) if err != nil { return nil, err } ref := reference.TagNameOnly(refName).String() _, cfgBytes, err := s.gw.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{ Platform: &s.platform, ResolveMode: llb.ResolveModeDefault.String(), }) if err != nil { return nil, err } var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err } dir, err := core.NewDirectory(ctx, llb.Image(addr), "/", s.platform) if err != nil { return nil, err } ctr, err := parent.WithFS(ctx, dir, s.platform) if err != nil { return nil, err } return ctr.UpdateImageConfig(ctx, func(specs.ImageConfig) specs.ImageConfig { return imgSpec.Config
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
}) } func (s *containerSchema) withFS(ctx *router.Context, parent *core.Container, arg core.Directory) (*core.Container, error) { ctr, err := parent.WithFS(ctx, &arg, s.platform) if err != nil { return nil, err } return ctr, nil } func (s *containerSchema) fs(ctx *router.Context, parent *core.Container, args any) (*core.Directory, error) { return parent.FS(ctx) } type containerExecArgs struct { Args *[]string Opts core.ContainerExecOpts } func (s *containerSchema) exec(ctx *router.Context, parent *core.Container, args containerExecArgs) (*core.Container, error) { return parent.Exec(ctx, s.gw, args.Args, args.Opts) } func (s *containerSchema) exitCode(ctx *router.Context, parent *core.Container, args any) (*int, error) { return parent.ExitCode(ctx, s.gw) } func (s *containerSchema) stdout(ctx *router.Context, parent *core.Container, args any) (*core.File, error) { return parent.MetaFile(ctx, s.gw, "stdout") } func (s *containerSchema) stderr(ctx *router.Context, parent *core.Container, args any) (*core.File, error) { return parent.MetaFile(ctx, s.gw, "stderr") } type containerWithEntrypointArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Args []string } func (s *containerSchema) withEntrypoint(ctx *router.Context, parent *core.Container, args containerWithEntrypointArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.Entrypoint = args.Args return cfg }) } func (s *containerSchema) entrypoint(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Entrypoint, nil } type containerWithDefaultArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Args *[]string } func (s *containerSchema) withDefaultArgs(ctx *router.Context, parent *core.Container, args containerWithDefaultArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { if args.Args == nil { cfg.Cmd = []string{} return cfg } cfg.Cmd = *args.Args return cfg }) } func (s *containerSchema) defaultArgs(ctx *router.Context, parent *core.Container, args any) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Cmd, nil } type containerWithUserArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Name string } func (s *containerSchema) withUser(ctx *router.Context, parent *core.Container, args containerWithUserArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.User = args.Name return cfg }) } func (s *containerSchema) user(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.User, nil } type containerWithWorkdirArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Path string } func (s *containerSchema) withWorkdir(ctx *router.Context, parent *core.Container, args containerWithWorkdirArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.WorkingDir = absPath(cfg.WorkingDir, args.Path) return cfg }) } func (s *containerSchema) workdir(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.WorkingDir, nil } type containerWithVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Name string Value string } func (s *containerSchema) withEnvVariable(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { newEnv := []string{} prefix := args.Name + "=" for _, env := range cfg.Env { if !strings.HasPrefix(env, prefix) { newEnv = append(newEnv, env) } } newEnv = append(newEnv, fmt.Sprintf("%s=%s", args.Name, args.Value)) cfg.Env = newEnv return cfg }) } type containerWithoutVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Name string } func (s *containerSchema) withoutEnvVariable(ctx *router.Context, parent *core.Container, args containerWithoutVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { removedEnv := []string{} prefix := args.Name + "=" for _, env := range cfg.Env { if !strings.HasPrefix(env, prefix) { removedEnv = append(removedEnv, env) } } cfg.Env = removedEnv return cfg }) } type EnvVariable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Name string `json:"name"` Value string `json:"value"` } func (s *containerSchema) envVariables(ctx *router.Context, parent *core.Container, args any) ([]EnvVariable, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } vars := make([]EnvVariable, 0, len(cfg.Env)) for _, v := range cfg.Env { name, value, _ := strings.Cut(v, "=") e := EnvVariable{ Name: name, Value: value, } vars = append(vars, e) } return vars, nil } type containerVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Name string } func (s *containerSchema) envVariable(ctx *router.Context, parent *core.Container, args containerVariableArgs) (*string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } for _, env := range cfg.Env { name, val, ok := strings.Cut(env, "=") if ok && name == args.Name { return &val, nil } } return nil, nil } type containerWithMountedDirectoryArgs struct { Path string Source core.DirectoryID } func (s *containerSchema) withMountedDirectory(ctx *router.Context, parent *core.Container, args containerWithMountedDirectoryArgs) (*core.Container, error) { return parent.WithMountedDirectory(ctx, args.Path, &core.Directory{ID: args.Source}) } type containerPublishArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Address core.ContainerAddress } func (s *containerSchema) publish(ctx *router.Context, parent *core.Container, args containerPublishArgs) (core.ContainerAddress, error) { return parent.Publish(ctx, args.Address, s.bkClient, s.solveOpts, s.solveCh) } type containerWithMountedFileArgs struct { Path string Source core.FileID } func (s *containerSchema) withMountedFile(ctx *router.Context, parent *core.Container, args containerWithMountedFileArgs) (*core.Container, error) { return parent.WithMountedFile(ctx, args.Path, &core.File{ID: args.Source}) } type containerWithMountedCacheArgs struct { Path string Cache core.CacheID Source core.DirectoryID } func (s *containerSchema) withMountedCache(ctx *router.Context, parent *core.Container, args containerWithMountedCacheArgs) (*core.Container, error) { var dir *core.Directory if args.Source != "" { dir = &core.Directory{ID: args.Source} } return parent.WithMountedCache(ctx, args.Path, args.Cache, dir) } type containerWithMountedTempArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Path string } func (s *containerSchema) withMountedTemp(ctx *router.Context, parent *core.Container, args containerWithMountedTempArgs) (*core.Container, error) { return parent.WithMountedTemp(ctx, args.Path) } type containerWithoutMountArgs struct { Path string } func (s *containerSchema) withoutMount(ctx *router.Context, parent *core.Container, args containerWithoutMountArgs) (*core.Container, error) { return parent.WithoutMount(ctx, args.Path) } func (s *containerSchema) mounts(ctx *router.Context, parent *core.Container, _ any) ([]string, error) { return parent.Mounts(ctx) } type containerDirectoryArgs struct { Path string } func (s *containerSchema) directory(ctx *router.Context, parent *core.Container, args containerDirectoryArgs) (*core.Directory, error) { return parent.Directory(ctx, s.gw, args.Path) } type containerFileArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
core/schema/container.go
Path string } func (s *containerSchema) file(ctx *router.Context, parent *core.Container, args containerFileArgs) (*core.File, error) { return parent.File(ctx, s.gw, args.Path) } func absPath(workDir string, containerPath string) string { if path.IsAbs(containerPath) { return containerPath } if workDir == "" { workDir = "/" } return path.Join(workDir, containerPath) } type containerWithSecretVariableArgs struct { Name string Secret core.SecretID } func (s *containerSchema) withSecretVariable(ctx *router.Context, parent *core.Container, args containerWithSecretVariableArgs) (*core.Container, error) { return parent.WithSecretVariable(ctx, args.Name, &core.Secret{ID: args.Secret}) } type containerWithMountedSecretArgs struct { Path string Source core.SecretID } func (s *containerSchema) withMountedSecret(ctx *router.Context, parent *core.Container, args containerWithMountedSecretArgs) (*core.Container, error) { return parent.WithMountedSecret(ctx, args.Path, core.NewSecret(args.Source)) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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{ 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"
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
sdk/go/dagger/api/api.gen.go
} 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 } 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) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
sdk/go/dagger/api/api.gen.go
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 ExecOpts struct { RedirectStderr string `json:"redirectStderr"` RedirectStdout string `json:"redirectStdout"` Stdin string `json:"stdin"` } type CacheVolume struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
sdk/go/dagger/api/api.gen.go
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) 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
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
sdk/go/dagger/api/api.gen.go
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 { Args []string Opts ExecOpts } 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 } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
sdk/go/dagger/api/api.gen.go
for i := len(opts) - 1; i >= 0; i-- { if !querybuilder.IsZeroValue(opts[i].Opts) { q = q.Arg("opts", opts[i].Opts) 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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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,340
API: inline ExecOpts in exec
Would it make sense to move that stuff as optional arguments to `exec`, rather than wrapped in a `ExecOpts` input? Otherwise it ends up double wrapped: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Opts: dagger.ExecOpts { Stdin: "foo", } } ``` vs: ```go Exec(dagger.ContainerExecOpts{ Args: []string{"ls"}, Stdin: "foo", } ``` /cc @vito @shykes
https://github.com/dagger/dagger/issues/3340
https://github.com/dagger/dagger/pull/3402
1d9236da031514e3c5f8dbcfb186eb87ea3af5d6
1cc6d7b558c44d2512f582e4fa6ce447b327cd3c
2022-10-12T20:15:16Z
go
2022-10-18T20:20:37Z
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
core/directory.go
package core import ( "context" "fmt" "path" "reflect" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" specs "github.com/opencontainers/image-spec/specs-go/v1" fstypes "github.com/tonistiigi/fsutil/types" ) type Directory struct { ID DirectoryID `json:"id"` } type DirectoryID string type directoryIDPayload struct { LLB *pb.Definition `json:"llb"` Dir string `json:"dir"` Platform specs.Platform `json:"platform"` } func (id DirectoryID) Decode() (*directoryIDPayload, error) { if id == "" { return &directoryIDPayload{}, 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
core/directory.go
var payload directoryIDPayload if err := decodeID(&payload, id); err != nil { return nil, err } return &payload, nil } func (payload *directoryIDPayload) State() (llb.State, error) { if payload.LLB == nil { return llb.Scratch(), nil } return defToState(payload.LLB) } func (payload *directoryIDPayload) SetState(ctx context.Context, st llb.State) error { def, err := st.Marshal(ctx, llb.Platform(payload.Platform)) if err != nil { return nil } payload.LLB = def.ToPB() return nil } func (payload *directoryIDPayload) ToDirectory() (*Directory, error) { id, err := encodeID(payload) if err != nil { return nil, err } return &Directory{ ID: DirectoryID(id), }, nil } func NewDirectory(ctx context.Context, st llb.State, cwd string, platform specs.Platform) (*Directory, error) {
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/directory.go
payload := directoryIDPayload{ Dir: cwd, Platform: platform, } def, err := st.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, err } payload.LLB = def.ToPB() return payload.ToDirectory() } func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error) { payload, err := dir.ID.Decode() if err != nil { return nil, err } src = path.Join(payload.Dir, src) if payload.LLB == nil { if path.Clean(src) == "." { return &fstypes.Stat{Path: src}, nil } return nil, fmt.Errorf("%s: no such file or directory", src) } res, err := gw.Solve(ctx, bkgw.SolveRequest{
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/directory.go
Definition: payload.LLB, }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } stat, err := ref.StatFile(ctx, bkgw.StatRequest{ Path: src, }) if err != nil { return nil, err } return stat, nil } func (dir *Directory) Contents(ctx context.Context, gw bkgw.Client, src string) ([]string, error) { payload, err := dir.ID.Decode() if err != nil { return nil, err } src = path.Join(payload.Dir, src) if payload.LLB == nil { if path.Clean(src) == "." { return []string{}, nil } return nil, fmt.Errorf("%s: no such file or directory", src) }
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/directory.go
res, err := gw.Solve(ctx, bkgw.SolveRequest{ Definition: payload.LLB, }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } entries, err := ref.ReadDir(ctx, bkgw.ReadDirRequest{ Path: src, }) if err != nil { return nil, err } paths := []string{} for _, entry := range entries { paths = append(paths, entry.GetPath()) } return paths, nil } func (dir *Directory) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte) (*Directory, error) { payload, err := dir.ID.Decode() if err != nil { return nil, err } dest = path.Join(payload.Dir, dest) st, err := payload.State()
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/directory.go
if err != nil { return nil, err } parent, _ := path.Split(dest) if parent != "" { st = st.File(llb.Mkdir(parent, 0755, llb.WithParents(true))) } st = st.File( llb.Mkfile( dest, 0644, content, ), ) err = payload.SetState(ctx, st) if err != nil { return nil, err } return payload.ToDirectory() } func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error) { payload, err := dir.ID.Decode() if err != nil { return nil, err } payload.Dir = path.Join(payload.Dir, subdir) return payload.ToDirectory() } func (dir *Directory) File(ctx context.Context, file string) (*File, error) { payload, err := dir.ID.Decode()
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/directory.go
if err != nil { return nil, err } return (&fileIDPayload{ LLB: payload.LLB, File: path.Join(payload.Dir, file), Platform: payload.Platform, }).ToFile() } func (dir *Directory) WithDirectory(ctx context.Context, subdir string, src *Directory) (*Directory, error) { destPayload, err := dir.ID.Decode() if err != nil { return nil, err } srcPayload, err := src.ID.Decode() if err != nil { return nil, err } st, err := destPayload.State() if err != nil { return nil, err } srcSt, err := srcPayload.State() if err != nil { return nil, err } st = st.File(llb.Copy(srcSt, srcPayload.Dir, path.Join(destPayload.Dir, subdir), &llb.CopyInfo{ CreateDestPath: true, })) err = destPayload.SetState(ctx, st)
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/directory.go
if err != nil { return nil, err } return destPayload.ToDirectory() } func (dir *Directory) WithCopiedFile(ctx context.Context, subdir string, src *File) (*Directory, error) { destPayload, err := dir.ID.Decode() if err != nil { return nil, err } srcPayload, err := src.ID.decode() if err != nil { return nil, err } st, err := destPayload.State() if err != nil { return nil, err } srcSt, err := srcPayload.State() if err != nil { return nil, err } st = st.File(llb.Copy(srcSt, srcPayload.File, path.Join(destPayload.Dir, subdir))) err = destPayload.SetState(ctx, st) if err != nil { return nil, err } return destPayload.ToDirectory() } func MergeDirectories(ctx context.Context, dirs []*Directory, platform specs.Platform) (*Directory, error) {
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/directory.go
states := make([]llb.State, 0, len(dirs)) for _, fs := range dirs { payload, err := fs.ID.Decode() 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
core/directory.go
} if !reflect.DeepEqual(platform, payload.Platform) { return nil, fmt.Errorf("TODO: cannot merge across platforms: %+v != %+v", platform, payload.Platform) } state, err := payload.State() if err != nil { return nil, err } states = append(states, state) } return NewDirectory(ctx, llb.Merge(states), "", platform) } func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error) { lowerPayload, err := dir.ID.Decode() if err != nil { return nil, err } upperPayload, err := other.ID.Decode() if err != nil { return nil, err } if lowerPayload.Dir != upperPayload.Dir { return nil, fmt.Errorf("TODO: cannot diff with different relative paths: %q != %q", lowerPayload.Dir, upperPayload.Dir) } if !reflect.DeepEqual(lowerPayload.Platform, upperPayload.Platform) { return nil, fmt.Errorf("TODO: cannot diff across platforms: %+v != %+v", lowerPayload.Platform, upperPayload.Platform) }
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/directory.go
lowerSt, err := lowerPayload.State() if err != nil { return nil, err } upperSt, err := upperPayload.State() if err != nil { return nil, err } err = lowerPayload.SetState(ctx, llb.Diff(lowerSt, upperSt)) if err != nil { return nil, err } return lowerPayload.ToDirectory() } func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error) { payload, err := dir.ID.Decode() if err != nil { return nil, err } st, err := payload.State() if err != nil { return nil, err } err = payload.SetState(ctx, st.File(llb.Rm(path))) if err != nil { return nil, err } return payload.ToDirectory() }
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
package core import ( "context" "strings" "testing" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" "go.dagger.io/dagger/core" "go.dagger.io/dagger/core/schema" "go.dagger.io/dagger/internal/testutil" "go.dagger.io/dagger/sdk/go/dagger" "go.dagger.io/dagger/sdk/go/dagger/api" ) func TestContainerScratch(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { ID string Fs struct { Contents []string } } }{} err := testutil.Query( `{ container { id fs { contents } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.ID) require.Empty(t, res.Container.Fs.Contents) } func TestContainerFrom(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { Fs struct { File struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { fs { file(path: "/etc/alpine-release") { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Fs.File.Contents, "3.16.2\n") } func TestContainerWithFS(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() ctx := context.Background() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() core := c.Core() alpine316 := core.Container().From("alpine:3.16.2") alpine316ReleaseStr, err := alpine316.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) alpine316ReleaseStr = strings.TrimSpace(alpine316ReleaseStr) dirID, err := alpine316.FS().ID(ctx) require.NoError(t, err) exitCode, err := core.Container().WithEnvVariable("ALPINE_RELEASE", alpine316ReleaseStr).WithFS(dirID).Exec(api.ContainerExecOpts{ Args: []string{ "/bin/sh", "-c", "test -f /etc/alpine-release && test \"$(head -n 1 /etc/alpine-release)\" = \"$ALPINE_RELEASE\"", }, }).ExitCode(ctx) require.NoError(t, err) require.NotEmpty(t, dirID) require.Equal(t, exitCode, 0) alpine315 := core.Container().From("alpine:3.15.6") varVal := "testing123" alpine315WithVar := alpine315.WithEnvVariable("DAGGER_TEST", varVal) varValResp, err := alpine315WithVar.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) alpine315ReplacedFS := alpine315WithVar.WithFS(dirID)
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
varValResp, err = alpine315ReplacedFS.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) releaseStr, err := alpine315ReplacedFS.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) require.Equal(t, "3.16.2\n", releaseStr) } func TestContainerExecExitCode(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Exec struct { ExitCode *int } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["true"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.Exec.ExitCode)
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
require.Equal(t, 0, *res.Container.From.Exec.ExitCode) /* It's not currently possible to get a nonzero exit code back because Buildkit raises an error. We could perhaps have the shim mask the exit status and always exit 0, but we would have to be careful not to let that happen in a big chained LLB since it would prevent short-circuiting. We could only do it when the user requests the exitCode, but then we would actually need to run the command _again_ since we'd need some way to tell the shim what to do. Hmm... err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["false"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.ExitCode, 1) */ } func TestContainerExecStdoutStderr(t *testing.T) { t.Parallel() res := 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
Exec struct { Stdout, Stderr struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) { stdout { contents } stderr { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello\n") require.Equal(t, res.Container.From.Exec.Stderr.Contents, "goodbye\n") } func TestContainerExecStdin(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { Exec struct { Stdout struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["cat"], stdin: "hello") { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello") } func TestContainerExecRedirectStdoutStderr(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { Exec struct { Out, Err struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec( args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"], redirectStdout: "out", redirectStderr: "err" ) { out: file(path: "out") { contents } err: file(path: "err") { contents } } } } }`, &res, 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
core/integration/container_test.go
require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Out.Contents, "hello\n") require.Equal(t, res.Container.From.Exec.Err.Contents, "goodbye\n") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec( args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"], redirectStdout: "out", redirectStderr: "err" ) { stdout { contents } stderr { contents } } } } }`, &res, nil) require.Error(t, err) require.Contains(t, err.Error(), "stdout: no such file or directory") require.Contains(t, err.Error(), "stderr: no such file or directory") } func TestContainerNullStdoutStderr(t *testing.T) { t.Parallel() res := 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 { Stdout, Stderr *struct { Contents string } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { stdout { contents } stderr { contents } } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.Stdout) require.Nil(t, res.Container.From.Stderr) } func TestContainerExecWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir 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 { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withWorkdir(path: "/usr") { exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerExecWithUser(t *testing.T) { t.Parallel() res := 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 { User string WithUser struct { User string Exec struct { Stdout struct { Contents string } } } } } }{} t.Run("user name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, 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
core/integration/container_test.go
require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon:floppy") { user exec(args: ["sh", "-c", "whoami; groups"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon:floppy", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user ID", func(t *testing.T) { err := testutil.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
core/integration/container_test.go
container { from(address: "alpine:3.16.2") { user withUser(name: "2") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group ID", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "2:11") { user exec(args: ["sh", "-c", "whoami; groups"]) { 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
} } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2:11", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) } func TestContainerExecWithEntrypoint(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Entrypoint []string WithEntrypoint struct { Entrypoint []string Exec struct { Stdout struct { Contents string } } WithEntrypoint struct { Entrypoint []string } } }
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
} }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint withEntrypoint(args: ["sh", "-c"]) { entrypoint exec(args: ["echo $HOME"]) { stdout { contents } } withEntrypoint(args: []) { entrypoint } } } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) require.Empty(t, res.Container.From.WithEntrypoint.WithEntrypoint.Entrypoint) } func TestContainerWithDefaultArgs(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string } WithEntrypoint struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } }
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
} } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint defaultArgs withDefaultArgs { entrypoint defaultArgs } withEntrypoint(args: ["sh", "-c"]) { entrypoint defaultArgs exec(args: ["echo $HOME"]) { stdout { contents } } withDefaultArgs(args: ["id"]) { entrypoint defaultArgs exec(args: []) { 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
} } } } }`, &res, nil) t.Run("default alpine (no entrypoint)", func(t *testing.T) { require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.DefaultArgs) }) t.Run("with nil default args", func(t *testing.T) { require.Empty(t, res.Container.From.WithDefaultArgs.Entrypoint) require.Empty(t, res.Container.From.WithDefaultArgs.DefaultArgs) }) t.Run("with entrypoint set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.WithEntrypoint.DefaultArgs) }) t.Run("with exec args", func(t *testing.T) { require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) }) t.Run("with default args set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.WithDefaultArgs.Entrypoint) require.Equal(t, []string{"id"}, res.Container.From.WithEntrypoint.WithDefaultArgs.DefaultArgs) require.Equal(t, "uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)\n", res.Container.From.WithEntrypoint.WithDefaultArgs.Exec.Stdout.Contents) }) } func TestContainerExecWithEnvVariable(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { WithEnvVariable struct { Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withEnvVariable(name: "FOO", value: "bar") { exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "FOO=bar\n") } func TestContainerVariables(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() res := struct { Container struct { From struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } }
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
} }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariables { name value } exec(args: ["env"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOLANG_VERSION", Value: "1.18.2"}, {Name: "GOPATH", Value: "/go"}, }, res.Container.From.EnvVariables) require.Contains(t, res.Container.From.Exec.Stdout.Contents, "GOPATH=/go\n") } func TestContainerVariable(t *testing.T) { t.Parallel() res := 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 { EnvVariable *string } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariable(name: "GOLANG_VERSION") } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.EnvVariable) require.Equal(t, "1.18.2", *res.Container.From.EnvVariable) err = testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariable(name: "UNKNOWN") } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.EnvVariable) } func TestContainerWithoutVariable(t *testing.T) { t.Parallel() 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/container_test.go
Container struct { From struct { WithoutEnvVariable struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withoutEnvVariable(name: "GOLANG_VERSION") { envVariables { name value } exec(args: ["env"]) { 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
} } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithoutEnvVariable.EnvVariables, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOPATH", Value: "/go"}, }) require.NotContains(t, res.Container.From.WithoutEnvVariable.Exec.Stdout.Contents, "GOLANG_VERSION") } func TestContainerEnvVariablesReplace(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithEnvVariable struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ 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
core/integration/container_test.go
from(address: "golang:1.18.2-alpine") { withEnvVariable(name: "GOPATH", value: "/gone") { envVariables { name value } exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithEnvVariable.EnvVariables, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOLANG_VERSION", Value: "1.18.2"}, {Name: "GOPATH", Value: "/gone"}, }) require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "GOPATH=/gone\n") } func TestContainerWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Workdir 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
Stdout struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { workdir exec(args: ["pwd"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Workdir, "/go") require.Equal(t, res.Container.From.Exec.Stdout.Contents, "/go\n") } func TestContainerWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir 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
Workdir string Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withWorkdir(path: "/usr") { workdir exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Workdir, "/usr") require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerWithMountedDirectory(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 { 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 {
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 { Stdout struct { Contents string } Exec struct { Stdout struct { Contents string } } } } } }
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
}{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { stdout { contents } exec(args: ["cat", "/mnt/some-dir/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := 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/container_test.go
WithNewFile struct { WithNewFile struct { Directory struct { ID string } } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { directory(path: "some-dir") { id } } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct { Exec struct { Stdout 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
Contents string } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) { exec(args: ["cat", "/mnt/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectoryPropagation(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 { 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 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 { Stdout struct { Contents string } Exec struct { Exec struct { Stdout struct { Contents string } WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Stdout 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
Contents string } } } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # original content stdout { contents } exec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) { exec(args: ["cat", "/mnt/some-file"]) { # modified content should propagate stdout { contents } withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # should be back to the original content stdout { contents } exec(args: ["cat", "/mnt/some-file"]) { # original content override should propagate
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 } } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedFile(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 { File struct { ID core.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { file(path: "some-dir/sub-file") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.File.ID execRes := struct { Container struct { From struct { WithMountedFile struct { Exec struct { Stdout 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
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": id, }}) require.NoError(t, err) require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents) } func TestContainerWithMountedCache(t *testing.T) { t.Parallel() cacheID := newCache(t) 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 { WithEnvVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!) { container { from(address: "alpine:3.16.2") {
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
withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) { stdout { contents } } } } } } }` rand1 := identity.NewID() err := testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand1, }}) require.NoError(t, err) require.Equal(t, rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand2, }}) require.NoError(t, err) require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedCacheFromDirectory(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.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "initial-content\n") { directory(path: "some-dir") { id } } } }`, &dirRes, nil) require.NoError(t, err) initialID := dirRes.Directory.WithNewFile.Directory.ID cacheID := newCache(t) 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 { WithEnvVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) { container { from(address: "alpine:3.16.2") { withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) {