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 | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | @function
def potato_%d() -> str:
return "potato #%d"
`, i, i)
}
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("./src/main.py", dagger.ContainerWithNewFileOpts{
Contents: mainSrc,
}).
With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=python"))
var eg errgroup.Group
for i := 0; i < funcCount; i++ {
i := i
if i%10 != 0 {
continue
}
eg.Go(func() error {
_, err := modGen.
With(daggerCall(fmt.Sprintf("potato%d", i))).
Sync(ctx)
return err
})
}
require.NoError(t, eg.Wait())
})
}
func TestModuleNamespacing(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
moduleSrcPath, err := filepath.Abs("./testdata/modules/go/namespacing")
require.NoError(t, err)
ctr := c.Container().From(alpineImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithMountedDirectory("/work", c.Host().Directory(moduleSrcPath)).
WithWorkdir("/work")
out, err := ctr.
With(daggerQuery(`{test{fn(s:"yo")}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"test":{"fn":"1:yo 2:yo"}}`, out)
}
func TestEnvCmd(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | environmentPath string
expectedSDK string
expectedName string
expectedRoot string
}
for _, tc := range []testCase{
{
environmentPath: "core/integration/testdata/environments/go/basic",
expectedSDK: "go",
expectedName: "basic",
expectedRoot: "../../../../../../",
},
} {
tc := tc
for _, testGitEnv := range []bool{false, true} {
testGitEnv := testGitEnv
testName := "local environment"
if testGitEnv {
testName = "git environment" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | }
testName += "/" + tc.environmentPath
t.Run(testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
stderr, err := CLITestContainer(ctx, t, c).
WithLoadedEnv(tc.environmentPath, testGitEnv).
CallEnv().
Stderr(ctx)
require.NoError(t, err)
require.Contains(t, stderr, fmt.Sprintf(`"root": %q`, tc.expectedRoot))
require.Contains(t, stderr, fmt.Sprintf(`"name": %q`, tc.expectedName))
require.Contains(t, stderr, fmt.Sprintf(`"sdk": %q`, tc.expectedSDK))
})
}
}
}
func TestEnvCmdHelps(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
c, ctx := connect(t)
baseCtr := CLITestContainer(ctx, t, c).WithHelpArg(true)
noEnvCtr := baseCtr
validLocalEnvCtr := baseCtr.WithLoadedEnv("core/integration/testdata/environments/go/basic", false)
brokenLocalEnvCtr := baseCtr.WithLoadedEnv("core/integration/testdata/environments/go/broken", false)
for _, ctr := range []*DaggerCLIContainer{noEnvCtr, validLocalEnvCtr, brokenLocalEnvCtr} {
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | testName string
cmdCtr *DaggerCLIContainer
expectedOutput string
}
for _, tc := range []testCase{
{
testName: "dagger env/" + ctr.EnvArg,
cmdCtr: ctr.CallEnv(),
expectedOutput: "Usage:\n dagger environment [flags]\n\nAliases:\n environment, env",
},
{
testName: "dagger env init/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvInit(),
expectedOutput: "Usage:\n dagger environment init",
},
{
testName: "dagger env sync/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvSync(),
expectedOutput: "Usage:\n dagger environment sync",
},
{
testName: "dagger env extend/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvExtend("./fake/dep"),
expectedOutput: "Usage:\n dagger environment extend",
}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | {
testName: "dagger checks/" + ctr.EnvArg,
cmdCtr: ctr.CallChecks(),
expectedOutput: "Usage:\n dagger checks",
},
} {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
t.Parallel()
stdout, err := tc.cmdCtr.Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, tc.expectedOutput)
})
}
}
}
func TestEnvCmdInit(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
type testCase struct {
testName string
environmentPath string
sdk string
name string
root string
expectedErrorMessage string
}
for _, tc := range []testCase{
{
testName: "explicit environment dir/go", |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | environmentPath: "/var/testenvironment/subdir",
sdk: "go",
name: identity.NewID(),
root: "../",
},
{
testName: "explicit environment dir/python",
environmentPath: "/var/testenvironment/subdir",
sdk: "python",
name: identity.NewID(),
root: "../..",
},
{
testName: "explicit environment file",
environmentPath: "/var/testenvironment/subdir/dagger.json",
sdk: "python",
name: identity.NewID(),
},
{
testName: "implicit environment",
sdk: "go",
name: identity.NewID(),
},
{
testName: "implicit environment with root",
environmentPath: "/var/testenvironment",
sdk: "python",
name: identity.NewID(),
root: "..",
}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | {
testName: "invalid sdk",
environmentPath: "/var/testenvironment",
sdk: "c++--",
name: identity.NewID(),
expectedErrorMessage: "unsupported environment SDK",
},
{
testName: "error on git",
environmentPath: "git://github.com/dagger/dagger.git",
sdk: "go",
name: identity.NewID(),
expectedErrorMessage: "environment init is not supported for git environments",
},
} {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
ctr := CLITestContainer(ctx, t, c).
WithEnvArg(tc.environmentPath).
WithSDKArg(tc.sdk).
WithNameArg(tc.name).
CallEnvInit()
if tc.expectedErrorMessage != "" {
_, err := ctr.Sync(ctx)
require.ErrorContains(t, err, tc.expectedErrorMessage)
return
}
expectedConfigPath := tc.environmentPath |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | if !strings.HasSuffix(expectedConfigPath, "dagger.json") {
expectedConfigPath = filepath.Join(expectedConfigPath, "dagger.json")
}
_, err := ctr.File(expectedConfigPath).Contents(ctx)
require.NoError(t, err)
if tc.sdk == "go" {
codegenFile := filepath.Join(filepath.Dir(expectedConfigPath), "dagger.gen.go")
_, err := ctr.File(codegenFile).Contents(ctx)
require.NoError(t, err)
}
stderr, err := ctr.CallEnv().Stderr(ctx)
require.NoError(t, err)
require.Contains(t, stderr, fmt.Sprintf(`"name": %q`, tc.name))
require.Contains(t, stderr, fmt.Sprintf(`"sdk": %q`, tc.sdk))
})
}
t.Run("error on existing environment", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
_, err := CLITestContainer(ctx, t, c).
WithLoadedEnv("core/integration/testdata/environments/go/basic", false).
WithSDKArg("go").
WithNameArg("foo").
CallEnvInit().
Sync(ctx)
require.ErrorContains(t, err, "environment init config path already exists")
})
}
func TestEnvChecks(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | t.Skip("pending conversion to modules")
t.Parallel()
allChecks := []string{
"cool-static-check",
"sad-static-check",
"cool-container-check",
"sad-container-check",
"cool-composite-check",
"sad-composite-check",
"another-cool-static-check",
"another-sad-static-check",
"cool-composite-check-from-explicit-dep",
"sad-composite-check-from-explicit-dep",
"cool-composite-check-from-dynamic-dep",
"sad-composite-check-from-dynamic-dep",
"cool-check-only-return",
"cool-check-result-only-return",
"cool-string-only-return",
"cool-error-only-return",
"sad-error-only-return",
"cool-string-error-return",
"sad-string-error-return",
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | compositeCheckToSubcheckNames := map[string][]string{
"cool-composite-check": {
"cool-subcheck-a",
"cool-subcheck-b",
},
"sad-composite-check": {
"sad-subcheck-a",
"sad-subcheck-b",
},
"cool-composite-check-from-explicit-dep": {
"another-cool-static-check",
"another-cool-container-check",
"another-cool-composite-check",
},
"sad-composite-check-from-explicit-dep": {
"another-sad-static-check",
"another-sad-container-check",
"another-sad-composite-check",
},
"cool-composite-check-from-dynamic-dep": {
"yet-another-cool-static-check",
"yet-another-cool-container-check",
"yet-another-cool-composite-check",
},
"sad-composite-check-from-dynamic-dep": {
"yet-another-sad-static-check",
"yet-another-sad-container-check",
"yet-another-sad-composite-check",
},
"another-cool-composite-check": { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | "another-cool-subcheck-a",
"another-cool-subcheck-b",
},
"another-sad-composite-check": {
"another-sad-subcheck-a",
"another-sad-subcheck-b",
},
"yet-another-cool-composite-check": {
"yet-another-cool-subcheck-a",
"yet-another-cool-subcheck-b",
},
"yet-another-sad-composite-check": {
"yet-another-sad-subcheck-a",
"yet-another-sad-subcheck-b",
},
}
checkOutput := func(name string) string {
return "WE ARE RUNNING CHECK " + strcase.ToKebab(name)
}
type testCase struct {
name string
environmentPath string
selectedChecks []string
expectFailure bool
}
for _, tc := range []testCase{
{
name: "happy-path",
environmentPath: "core/integration/testdata/environments/go/basic", |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | selectedChecks: []string{
"cool-static-check",
"cool-container-check",
"cool-composite-check",
"another-cool-static-check",
"cool-composite-check-from-explicit-dep",
"cool-composite-check-from-dynamic-dep",
"cool-check-only-return",
"cool-check-result-only-return",
"cool-string-only-return",
"cool-error-only-return",
"cool-string-error-return",
},
},
{
name: "sad-path",
expectFailure: true,
environmentPath: "core/integration/testdata/environments/go/basic",
selectedChecks: []string{
"sad-static-check",
"sad-container-check",
"sad-composite-check",
"another-sad-static-check",
"sad-composite-check-from-explicit-dep",
"sad-composite-check-from-dynamic-dep",
"sad-error-only-return",
"sad-string-error-return",
},
},
{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | name: "mixed-path",
expectFailure: true,
environmentPath: "core/integration/testdata/environments/go/basic",
},
} {
tc := tc
for _, testGitEnv := range []bool{false, true} {
testGitEnv := testGitEnv
testName := tc.name
testName += "/gitenv=" + strconv.FormatBool(testGitEnv)
testName += "/" + tc.environmentPath
t.Run(testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
stderr, err := CLITestContainer(ctx, t, c).
WithLoadedEnv(tc.environmentPath, testGitEnv).
CallChecks(tc.selectedChecks...).
Stderr(ctx)
if tc.expectFailure {
require.Error(t, err)
execErr := new(dagger.ExecError)
require.True(t, errors.As(err, &execErr))
stderr = execErr.Stderr
} else {
require.NoError(t, err)
}
selectedChecks := tc.selectedChecks
if len(selectedChecks) == 0 {
selectedChecks = allChecks |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | }
curChecks := selectedChecks
for len(curChecks) > 0 {
var nextChecks []string
for _, checkName := range curChecks {
subChecks, ok := compositeCheckToSubcheckNames[checkName]
if ok {
nextChecks = append(nextChecks, subChecks...)
} else {
if checkName == "cool-error-only-return" {
continue
}
require.Contains(t, stderr, checkOutput(checkName))
}
}
curChecks = nextChecks
}
})
}
}
}
func daggerExec(args ...string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
return c.WithExec(append([]string{"dagger", "--debug"}, args...), dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerQuery(query string) dagger.WithContainerFunc { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | return func(c *dagger.Container) *dagger.Container {
return c.WithExec([]string{"dagger", "--debug", "query"}, dagger.ContainerWithExecOpts{
Stdin: query,
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerCall(fnName string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
return c.WithExec([]string{"dagger", "--debug", "call", fnName}, dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func goGitBase(t *testing.T, c *dagger.Client) *dagger.Container {
t.Helper()
return c.Container().From(golangImage).
WithExec([]string{"apk", "add", "git"}).
WithExec([]string{"git", "config", "--global", "user.email", "dagger@example.com"}).
WithExec([]string{"git", "config", "--global", "user.name", "Dagger Tests"}).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithExec([]string{"git", "init"})
}
func logGen(ctx context.Context, t *testing.T, modSrc *dagger.Directory) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,971 | π `runtime error: index out of range` error when generating `go` modules | ### What is the issue?
Using common parameter types like following code block causing `runtime error: index out of range` while generating module code.
```go
func (ar *ActionRun) WithInput(name, value string) *ActionRun {
ar.Config.With = append(ar.Config.With, fmt.Sprintf("%s=%s", name, value))
return ar
}
```
### Log output
```shell
dagger mod sync
β asModule(sourceSubpath: "daggerverse/actions/runtime") ERROR [3.18s]
β exec /usr/local/bin/codegen --module . --propagate-logs=true ERROR [0.39s]
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β Usage:
β codegen [flags]
β
β Flags:
β -h, --help help for codegen
β --lang string language to generate (default "go")
β --module string module to load and codegen dependency code
β -o, --output string output directory (default ".")
β --propagate-logs propagate logs directly to progrock.sock
β
β Error: generate code: template: module:56:3: executing "module" at <Modu
β MainSrc>: error calling ModuleMainSrc: runtime error: index out of range
β 1] with length 1
β generating go module: actions-runtime ERROR [0.28s]
β’ Engine: d8c37de1d5af (version devel ())
β§ 4.89s β 238 β
2 β 3
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "actions-runtime" to get functions: failed to get function output directory: process "/usr/local/bin/codegen --module . --propagate-logs=true" did not complete successfully: exit code: 1
```
### Steps to reproduce
- Create a go module
- Add command to module using shared type parameter like `func (ar *ActionRun) WithInput(name, value string) *ActionRun`
- Run `dagger mod sync`
### SDK version
Go SDK v0.9.1, Dagger CLI v0.9.1
### OS version
macOS 14.0 | https://github.com/dagger/dagger/issues/5971 | https://github.com/dagger/dagger/pull/5972 | c8990707600e665638707f19c12d4ecb80ef3e3a | 35442c542873fd260cddbcbed2ece93ce4b5a79f | 2023-10-26T15:48:07Z | go | 2023-10-26T17:53:44Z | core/integration/module_test.go | t.Helper()
generated, err := modSrc.File("dagger.gen.go").Contents(ctx)
require.NoError(t, err)
t.Cleanup(func() {
t.Name()
fileName := filepath.Join(
os.TempDir(),
t.Name(),
fmt.Sprintf("dagger.gen.%d.go", time.Now().Unix()),
)
if err := os.MkdirAll(filepath.Dir(fileName), 0o755); err != nil {
t.Logf("failed to create temp dir for generated code: %v", err)
return
}
if err := os.WriteFile(fileName, []byte(generated), 0644); err != nil {
t.Logf("failed to write generated code to %s: %v", fileName, err)
} else {
t.Logf("wrote generated code to %s", fileName)
}
})
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | package gogenerator
import (
"bytes"
"context"
"fmt"
"go/format"
"go/token"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"dagger.io/dagger"
"github.com/dagger/dagger/cmd/codegen/generator"
"github.com/dagger/dagger/cmd/codegen/generator/go/templates"
"github.com/dagger/dagger/cmd/codegen/introspection"
"github.com/dschmidt/go-layerfs"
"github.com/iancoleman/strcase"
"github.com/psanford/memfs"
"golang.org/x/mod/modfile"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/imports"
)
const ClientGenFile = "dagger.gen.go"
const StarterTemplateFile = "main.go"
type GoGenerator struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | Config generator.Config
}
func (g *GoGenerator) Generate(ctx context.Context, schema *introspection.Schema) (*generator.GeneratedState, error) {
generator.SetSchema(schema)
mfs := memfs.New()
genSt := &generator.GeneratedState{
Overlay: layerfs.New(mfs, dagger.QueryBuilder),
PostCommands: []*exec.Cmd{
exec.Command("go", "mod", "tidy"),
},
}
pkgInfo, partial, err := g.bootstrapMod(ctx, mfs)
if err != nil {
return nil, fmt.Errorf("bootstrap package: %w", err)
}
outDir := g.Config.OutputDir
initialGoFiles, err := filepath.Glob(filepath.Join(outDir, "*.go"))
if err != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | return nil, fmt.Errorf("glob go files: %w", err)
}
genFile := filepath.Join(outDir, ClientGenFile)
if _, err := os.Stat(genFile); err != nil {
pkgInfo.PackageName = "main"
baseCfg := g.Config
baseCfg.ModuleConfig = nil
if err := generateCode(ctx, baseCfg, schema, mfs, pkgInfo, nil, nil); err != nil {
return nil, fmt.Errorf("generate code: %w", err)
}
partial = true
}
if len(initialGoFiles) == 0 {
if err := mfs.WriteFile(StarterTemplateFile, []byte(g.baseModuleSource()), 0600); err != nil {
return nil, err
}
partial = true
}
if partial {
genSt.NeedRegenerate = true
return genSt, nil
}
pkg, fset, err := loadPackage(ctx, outDir)
if err != nil {
return nil, fmt.Errorf("load package %q: %w", outDir, err)
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | pkgInfo.PackageName = pkg.Name
if err := generateCode(ctx, g.Config, schema, mfs, pkgInfo, pkg, fset); err != nil {
return nil, fmt.Errorf("generate code: %w", err)
}
return genSt, nil
}
type PackageInfo struct {
PackageName string
PackageImport string
}
func (g *GoGenerator) bootstrapMod(ctx context.Context, mfs *memfs.FS) (*PackageInfo, bool, error) {
var needsRegen bool
outDir := g.Config.OutputDir
info := &PackageInfo{}
sdkMod, err := modfile.Parse("go.mod", dagger.GoMod, nil)
if err != nil {
return nil, false, fmt.Errorf("parse embedded go.mod: %w", err)
}
newMod := new(modfile.File)
if content, err := os.ReadFile(filepath.Join(outDir, "go.mod")); err == nil {
currentMod, err := modfile.Parse("go.mod", content, nil)
if err != nil {
return nil, false, fmt.Errorf("parse go.mod: %w", err)
}
newMod = currentMod
for _, req := range sdkMod.Require {
newMod.AddRequire(req.Mod.Path, req.Mod.Version) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | }
info.PackageImport = currentMod.Module.Mod.Path
} else {
if g.Config.ModuleConfig != nil {
rootDir, subdirRelPath, err := g.Config.ModuleConfig.RootAndSubpath(outDir)
if err != nil {
return nil, false, fmt.Errorf("failed to get module root: %w", err)
}
if pkg, _, err := loadPackage(ctx, rootDir); err == nil {
return &PackageInfo{
PackageImport: path.Join(pkg.Module.Path, subdirRelPath),
}, false, nil
}
newModName := strcase.ToKebab(g.Config.ModuleConfig.Name)
newMod.AddModuleStmt(newModName)
newMod.SetRequire(sdkMod.Require)
info.PackageImport = newModName
needsRegen = true
} else {
if pkg, _, err := loadPackage(ctx, outDir); err == nil {
return &PackageInfo{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | PackageName: pkg.Name,
PackageImport: pkg.Module.Path,
}, false, nil
}
return nil, false, fmt.Errorf("no module name configured and no existing package found")
}
}
modBody, err := newMod.Format()
if err != nil {
return nil, false, fmt.Errorf("format go.mod: %w", err)
}
if err := mfs.WriteFile("go.mod", modBody, 0600); err != nil {
return nil, false, err
}
if err := mfs.WriteFile("go.sum", dagger.GoSum, 0600); err != nil {
return nil, false, err
}
return info, needsRegen, nil
}
func generateCode(
ctx context.Context,
cfg generator.Config,
schema *introspection.Schema,
mfs *memfs.FS,
pkgInfo *PackageInfo,
pkg *packages.Package,
fset *token.FileSet,
) error {
funcs := templates.GoTemplateFuncs(ctx, schema, cfg.ModuleConfig, pkg, fset)
headerData := struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | *PackageInfo
Schema *introspection.Schema
}{
PackageInfo: pkgInfo,
Schema: schema,
}
var render []string
var header bytes.Buffer
if err := templates.Header(funcs).Execute(&header, headerData); err != nil {
return err
}
render = append(render, header.String())
err := schema.Visit(introspection.VisitHandlers{
Scalar: func(t *introspection.Type) error {
var out bytes.Buffer
if err := templates.Scalar(funcs).Execute(&out, t); err != nil {
return err
}
render = append(render, out.String())
return nil
},
Object: func(t *introspection.Type) error {
var out bytes.Buffer
if err := templates.Object(funcs).Execute(&out, struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | *introspection.Type
IsModuleCode bool
}{
Type: t,
IsModuleCode: cfg.ModuleConfig != nil,
}); err != nil {
return err
}
render = append(render, out.String())
return nil
},
Enum: func(t *introspection.Type) error {
var out bytes.Buffer
if err := templates.Enum(funcs).Execute(&out, t); err != nil {
return err
}
render = append(render, out.String())
return nil
},
Input: func(t *introspection.Type) error {
var out bytes.Buffer
if err := templates.Input(funcs).Execute(&out, t); err != nil {
return err
}
render = append(render, out.String())
return nil
},
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | if err != nil {
return err
}
if cfg.ModuleConfig != nil {
moduleData := struct {
Schema *introspection.Schema
}{
Schema: schema,
}
var moduleMain bytes.Buffer
if err := templates.Module(funcs).Execute(&moduleMain, moduleData); err != nil {
return err
}
render = append(render, moduleMain.String())
}
source := strings.Join(render, "\n")
formatted, err := format.Source([]byte(source))
if err != nil {
return fmt.Errorf("error formatting generated code: %T %+v %w\nsource:\n%s", err, err, err, source)
}
formatted, err = imports.Process(filepath.Join(cfg.OutputDir, "dummy.go"), formatted, nil)
if err != nil {
return fmt.Errorf("error formatting generated code: %T %+v %w\nsource:\n%s", err, err, err, source)
}
if err := mfs.WriteFile(ClientGenFile, formatted, 0600); err != nil {
return err
}
return nil
}
func loadPackage(ctx context.Context, dir string) (*packages.Package, *token.FileSet, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | fset := token.NewFileSet()
pkgs, err := packages.Load(&packages.Config{
Context: ctx,
Dir: dir,
Tests: false,
Fset: fset,
Mode: packages.NeedName |
packages.NeedTypes |
packages.NeedSyntax |
packages.NeedTypesInfo |
packages.NeedModule,
}, ".")
if err != nil {
return nil, nil, err
}
switch len(pkgs) {
case 0:
return nil, nil, fmt.Errorf("no packages found in %s", dir)
case 1:
if pkgs[0].Name == "" {
return nil, nil, fmt.Errorf("package name is empty") |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | cmd/codegen/generator/go/generator.go | }
return pkgs[0], fset, nil
default:
return nil, nil, fmt.Errorf("expected 1 package, got %d", len(pkgs))
}
}
func (g *GoGenerator) baseModuleSource() string {
moduleStructName := strcase.ToCamel(g.Config.ModuleConfig.Name)
return fmt.Sprintf(`package main
import (
"context"
)
type %s struct {}
example usage: "dagger call container-echo --string-arg yo"
func (m *%s) ContainerEcho(stringArg string) *Container {
return dag.Container().From("alpine:latest").WithExec([]string{"echo", stringArg})
}
example usage: "dagger call grep-dir --directory-arg . --pattern GrepDir"
func (m *%s) GrepDir(ctx context.Context, directoryArg *Directory, pattern string) (string, error) {
return dag.Container().
From("alpine:latest").
WithMountedDirectory("/mnt", directoryArg).
WithWorkdir("/mnt").
WithExec([]string{"grep", "-R", pattern, "."}).
Stdout(ctx)
}
`, moduleStructName, moduleStructName, moduleStructName)
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | package core
import (
"context"
_ "embed"
"errors"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"
"dagger.io/dagger"
"github.com/iancoleman/strcase"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
"github.com/tidwall/gjson"
"golang.org/x/sync/errgroup"
)
/* TODO: add coverage for
* dagger mod use
* dagger mod sync
* that the codegen of the testdata envs are up to date (or incorporate that into a cli command)
* if a dependency changes, then checks should re-run
*/
func TestModuleGoInit(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Run("from scratch", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=bare", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out)
})
t.Run("kebab-cases Go module name, camel-cases Dagger module name", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=My-Module", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen. |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | With(daggerQuery(`{myModule{containerEcho(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"myModule":{"containerEcho":{"stdout":"hello\n"}}}`, out)
generated, err := modGen.File("go.mod").Contents(ctx)
require.NoError(t, err)
require.Contains(t, generated, "module my-module")
})
t.Run("creates go.mod beneath an existing go.mod if root points beneath it", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/go.mod", dagger.ContainerWithNewFileOpts{
Contents: "module example.com/test\n",
}).
WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{
Contents: "package foo\n",
}).
WithWorkdir("/work/ci").
With(daggerExec("mod", "init", "--name=beneathGoMod", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{beneathGoMod{containerEcho(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"beneathGoMod":{"containerEcho":{"stdout":"hello\n"}}}`, out)
t.Run("names Go module after Dagger module", func(t *testing.T) {
generated, err := modGen.File("go.mod").Contents(ctx) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.NoError(t, err)
require.Contains(t, generated, "module beneath-go-mod")
})
})
t.Run("respects existing go.mod", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithExec([]string{"go", "mod", "init", "example.com/test"}).
With(daggerExec("mod", "init", "--name=hasGoMod", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{hasGoMod{containerEcho(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasGoMod":{"containerEcho":{"stdout":"hello\n"}}}`, out)
t.Run("preserves module name", func(t *testing.T) {
generated, err := modGen.File("go.mod").Contents(ctx)
require.NoError(t, err)
require.Contains(t, generated, "module example.com/test")
})
})
t.Run("respects parent go.mod if root points to it", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work"). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | WithExec([]string{"go", "mod", "init", "example.com/test"}).
WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{
Contents: "package foo\n",
}).
WithWorkdir("/work/child").
With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")).
WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{
Contents: `
package main
import "os"
type Child struct{}
func (m *Child) Root() *Directory {
wd, err := os.Getwd()
if err != nil {
panic(err)
}
return dag.Host().Directory(wd+"/..")
}
`,
})
generated := modGen.
With(daggerExec("mod", "sync")).
Directory(".")
logGen(ctx, t, generated)
out, err := modGen.
With(daggerQuery(`{child{root{entries}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod","go.sum"]}}}`, out) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | childEntries, err := generated.Entries(ctx)
require.NoError(t, err)
require.NotContains(t, childEntries, "go.mod")
t.Run("preserves parent module name", func(t *testing.T) {
generated, err := modGen.File("/work/go.mod").Contents(ctx)
require.NoError(t, err)
require.Contains(t, generated, "module example.com/test")
})
})
t.Run("respects existing go.mod even if root points to parent that has go.mod", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithExec([]string{"go", "mod", "init", "example.com/test"}).
WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{
Contents: "package foo\n",
}).
WithWorkdir("/work/child").
WithExec([]string{"go", "mod", "init", "my-mod"}).
With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")).
WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{
Contents: `
package main
import "os"
type Child struct{}
func (m *Child) Root() *Directory {
wd, err := os.Getwd()
if err != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | panic(err)
}
return dag.Host().Directory(wd+"/..")
}
`,
})
generated := modGen.
With(daggerExec("mod", "sync")).
Directory(".")
logGen(ctx, t, generated)
out, err := modGen.
With(daggerQuery(`{child{root{entries}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod"]}}}`, out)
childEntries, err := generated.Entries(ctx)
require.NoError(t, err)
require.Contains(t, childEntries, "go.mod")
require.Contains(t, childEntries, "go.sum")
})
t.Run("respects existing main.go", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: ` |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | package main
type HasMainGo struct {}
func (m *HasMainGo) Hello() string { return "Hello, world!" }
`,
}).
With(daggerExec("mod", "init", "--name=hasMainGo", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{hasMainGo{hello}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasMainGo":{"hello":"Hello, world!"}}`, out)
})
t.Run("respects existing main.go even if it uses types not generated yet", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `
package main
type HasDaggerTypes struct {}
func (m *HasDaggerTypes) Hello() *Container {
return dag.Container().
From("` + alpineImage + `").
WithExec([]string{"echo", "Hello, world!"})
}
`,
}). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | With(daggerExec("mod", "init", "--name=hasDaggerTypes", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{hasDaggerTypes{hello{stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasDaggerTypes":{"hello":{"stdout":"Hello, world!\n"}}}`, out)
})
t.Run("respects existing package without creating main.go", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/notmain.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type HasNotMainGo struct {}
func (m *HasNotMainGo) Hello() string { return "Hello, world!" }
`,
}).
With(daggerExec("mod", "init", "--name=hasNotMainGo", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{hasNotMainGo{hello}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasNotMainGo":{"hello":"Hello, world!"}}`, out)
})
}
func TestModuleInitLICENSE(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Run("bootstraps Apache-2.0 LICENSE file if none found", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go"))
content, err := modGen.File("LICENSE").Contents(ctx)
require.NoError(t, err)
require.Contains(t, content, "Apache License, Version 2.0")
})
t.Run("creates LICENSE file in the directory specified by -m", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "-m", "./mymod", "--name=licensed-to-ill", "--sdk=go"))
content, err := modGen.File("mymod/LICENSE").Contents(ctx)
require.NoError(t, err)
require.Contains(t, content, "Apache License, Version 2.0")
})
t.Run("does not bootstrap LICENSE file if it exists in the parent dir", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/LICENSE", dagger.ContainerWithNewFileOpts{
Contents: "doesnt matter",
}).
WithWorkdir("/work/sub").
With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go"))
_, err := modGen.File("LICENSE").Contents(ctx)
require.Error(t, err)
})
t.Run("bootstraps a LICENSE file when requested, even if it exists in the parent dir", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/LICENSE", dagger.ContainerWithNewFileOpts{
Contents: "doesnt matter",
}).
WithWorkdir("/work/sub").
With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go", "--license=MIT"))
content, err := modGen.File("LICENSE").Contents(ctx)
require.NoError(t, err)
require.Contains(t, content, "MIT License")
})
}
func TestModuleGit(t *testing.T) {
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | sdk string
gitignores []string
gitattributes string
}
for _, tc := range []testCase{
{
sdk: "go",
gitignores: []string{
"/dagger.gen.go\n",
"/querybuilder/\n",
},
},
{
sdk: "python",
gitignores: []string{
"/sdk\n",
},
},
} {
tc := tc |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Run(fmt.Sprintf("module %s git", tc.sdk), func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := goGitBase(t, c).
With(daggerExec("mod", "init", "--name=bare", "--sdk="+tc.sdk))
if tc.sdk == "go" {
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.
With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out)
} else {
out, err := modGen.
With(daggerQuery(`{bare{myFunction(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"bare":{"myFunction":{"stdout":"hello\n"}}}`, out)
}
t.Run("configures .gitignore", func(t *testing.T) {
ignore, err := modGen.File(".gitignore").Contents(ctx)
require.NoError(t, err)
for _, gitignore := range tc.gitignores {
require.Contains(t, ignore, gitignore)
}
})
})
}
}
func TestModuleGoGitRemovesIgnored(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
committedModGen := goGitBase(t, c).
With(daggerExec("mod", "init", "--name=bare", "--sdk=go")).
WithExec([]string{"rm", ".gitignore"}).
WithExec([]string{"mkdir", "./internal"}).
WithExec([]string{"cp", "-a", "./querybuilder", "./internal/querybuilder"}).
WithExec([]string{"git", "add", "."}).
WithExec([]string{"git", "commit", "-m", "init with generated files"})
changedAfterSync, err := committedModGen.
With(daggerExec("mod", "sync")).
WithExec([]string{"git", "diff"}).
WithExec([]string{"git", "status", "--short"}).
Stdout(ctx)
require.NoError(t, err)
t.Logf("changed after sync:\n%s", changedAfterSync)
require.Contains(t, changedAfterSync, "D dagger.gen.go\n")
require.Contains(t, changedAfterSync, "D querybuilder/marshal.go\n")
require.Contains(t, changedAfterSync, "D querybuilder/querybuilder.go\n")
require.Contains(t, changedAfterSync, "D internal/querybuilder/marshal.go\n")
require.Contains(t, changedAfterSync, "D internal/querybuilder/querybuilder.go\n")
}
func TestModulePythonGitRemovesIgnored(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
committedModGen := goGitBase(t, c).
With(daggerExec("mod", "init", "--name=bare", "--sdk=python")).
WithExec([]string{"rm", ".gitignore"}).
WithExec([]string{"git", "add", "."}).
WithExec([]string{"git", "commit", "-m", "init with generated files"})
changedAfterSync, err := committedModGen.
With(daggerExec("mod", "sync")).
WithExec([]string{"git", "diff"}).
WithExec([]string{"git", "status", "--short"}).
Stdout(ctx)
require.NoError(t, err)
t.Logf("changed after sync:\n%s", changedAfterSync)
require.Contains(t, changedAfterSync, "D sdk/pyproject.toml\n")
require.Contains(t, changedAfterSync, "D sdk/src/dagger/__init__.py\n")
}
var goSignatures string
func TestModuleGoSignatures(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: goSignatures,
})
logGen(ctx, t, modGen.Directory("."))
t.Run("func Hello() string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx)
require.NoError(t, err) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.JSONEq(t, `{"minimal":{"hello":"hello"}}`, out)
})
t.Run("func Echo(string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echo(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echo":"hello...hello...hello..."}}`, out)
})
t.Run("func EchoPointer(*string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoPointer(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoPointer":"hello...hello...hello..."}}`, out)
})
t.Run("func EchoPointerPointer(**string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoPointerPointer(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoPointerPointer":"hello...hello...hello..."}}`, out)
})
t.Run("func EchoOptional(string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptional(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptional":"hello...hello...hello..."}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptional}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptional":"default...default...default..."}}`, out)
})
t.Run("func EchoOptionalPointer(string) string", func(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptionalPointer(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptionalPointer":"hello...hello...hello..."}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptionalPointer}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptionalPointer":"default...default...default..."}}`, out)
})
t.Run("func Echoes([]string) []string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoes(msgs: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoes":["hello...hello...hello..."]}}`, out)
})
t.Run("func EchoesVariadic(...string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoesVariadic(msgs: "hello")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoesVariadic":"hello...hello...hello..."}}`, out)
})
t.Run("func HelloContext(context.Context) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{helloContext}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"helloContext":"hello context"}}`, out)
})
t.Run("func EchoContext(context.Context, string) string", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoContext(msg: "hello")}}`)).Stdout(ctx)
require.NoError(t, err) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.JSONEq(t, `{"minimal":{"echoContext":"ctx.hello...ctx.hello...ctx.hello..."}}`, out)
})
t.Run("func HelloStringError() (string, error)", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{helloStringError}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"helloStringError":"hello i worked"}}`, out)
})
t.Run("func HelloVoid()", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{helloVoid}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"helloVoid":null}}`, out)
})
t.Run("func HelloVoidError() error", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{helloVoidError}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"helloVoidError":null}}`, out)
})
t.Run("func EchoOpts(string, string, int) error", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOpts":"hi"}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOpts":"hi!hi!"}}`, out)
})
t.Run("func EchoOptsInline(struct{string, string, int}) error", func(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi"}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi!hi!"}}`, out)
})
t.Run("func EchoOptsInlinePointer(*struct{string, string, int}) error", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlinePointer(msg: "hi")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInlinePointer":"hi"}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlinePointer(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInlinePointer":"hi!hi!"}}`, out)
})
t.Run("func EchoOptsInlineCtx(ctx, struct{string, string, int}) error", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlineCtx(msg: "hi")}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInlineCtx":"hi"}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlineCtx(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInlineCtx":"hi!hi!"}}`, out)
})
t.Run("func EchoOptsInlineTags(struct{string, string, int}) error", func(t *testing.T) {
t.Parallel()
out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlineTags(msg: "hi")}}`)).Stdout(ctx)
require.NoError(t, err) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.JSONEq(t, `{"minimal":{"echoOptsInlineTags":"hi"}}`, out)
out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlineTags(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"minimal":{"echoOptsInlineTags":"hi!hi!"}}`, out)
})
}
var inspectModule = daggerQuery(`
query {
host {
directory(path: ".") {
asModule {
objects {
asObject {
name
functions {
name
description
args {
name
description
}
}
}
}
}
}
}
}
`)
func TestModuleGoDocs(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: goSignatures,
})
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(inspectModule).Stdout(ctx)
require.NoError(t, err)
obj := gjson.Get(out, "host.directory.asModule.objects.0.asObject")
require.Equal(t, "Minimal", obj.Get("name").String())
hello := obj.Get(`functions.#(name="hello")`)
require.Equal(t, "hello", hello.Get("name").String())
require.Empty(t, hello.Get("description").String())
require.Empty(t, hello.Get("args").Array()) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | echoOpts := obj.Get(`functions.#(name="echoOpts")`)
require.Equal(t, "echoOpts", echoOpts.Get("name").String())
require.Equal(t, "EchoOpts does some opts things", echoOpts.Get("description").String())
require.Len(t, echoOpts.Get("args").Array(), 3)
require.Equal(t, "msg", echoOpts.Get("args.0.name").String())
require.Equal(t, "the message to echo", echoOpts.Get("args.0.description").String())
require.Equal(t, "suffix", echoOpts.Get("args.1.name").String())
require.Equal(t, "String to append to the echoed message", echoOpts.Get("args.1.description").String())
require.Equal(t, "times", echoOpts.Get("args.2.name").String())
require.Equal(t, "Number of times to repeat the message", echoOpts.Get("args.2.description").String())
echoOpts = obj.Get(`functions.#(name="echoOptsInline")`)
require.Equal(t, "echoOptsInline", echoOpts.Get("name").String())
require.Equal(t, "EchoOptsInline does some opts things", echoOpts.Get("description").String())
require.Len(t, echoOpts.Get("args").Array(), 3)
require.Equal(t, "msg", echoOpts.Get("args.0.name").String())
require.Equal(t, "the message to echo", echoOpts.Get("args.0.description").String())
require.Equal(t, "suffix", echoOpts.Get("args.1.name").String())
require.Equal(t, "String to append to the echoed message", echoOpts.Get("args.1.description").String())
require.Equal(t, "times", echoOpts.Get("args.2.name").String())
require.Equal(t, "Number of times to repeat the message", echoOpts.Get("args.2.description").String())
}
func TestModuleGoDocsEdgeCases(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Minimal struct {}
// some docs
func (m *Minimal) Hello(foo string, bar string,
// hello
baz string, qux string, x string, // lol
) string {
return foo + bar
}
func (m *Minimal) HelloMore(
// foo here
foo,
// bar here
bar string,
) string {
return foo + bar
}
func (m *Minimal) HelloAgain(
foo string, // docs for foo
bar string,
) string {
return foo + bar
}
`,
})
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(inspectModule).Stdout(ctx)
require.NoError(t, err)
obj := gjson.Get(out, "host.directory.asModule.objects.0.asObject") |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.Equal(t, "Minimal", obj.Get("name").String())
hello := obj.Get(`functions.#(name="hello")`)
require.Equal(t, "hello", hello.Get("name").String())
require.Len(t, hello.Get("args").Array(), 5)
require.Equal(t, "foo", hello.Get("args.0.name").String())
require.Equal(t, "", hello.Get("args.0.description").String())
require.Equal(t, "bar", hello.Get("args.1.name").String())
require.Equal(t, "", hello.Get("args.1.description").String())
require.Equal(t, "baz", hello.Get("args.2.name").String())
require.Equal(t, "hello", hello.Get("args.2.description").String())
require.Equal(t, "qux", hello.Get("args.3.name").String())
require.Equal(t, "", hello.Get("args.3.description").String())
require.Equal(t, "x", hello.Get("args.4.name").String())
require.Equal(t, "lol", hello.Get("args.4.description").String())
hello = obj.Get(`functions.#(name="helloMore")`)
require.Equal(t, "helloMore", hello.Get("name").String())
require.Len(t, hello.Get("args").Array(), 2)
require.Equal(t, "foo", hello.Get("args.0.name").String())
require.Equal(t, "foo here", hello.Get("args.0.description").String())
require.Equal(t, "bar", hello.Get("args.1.name").String())
require.Equal(t, "bar here", hello.Get("args.1.description").String())
}
func TestModuleGoSignaturesUnexported(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Minimal struct {}
type Foo struct {}
type bar struct {}
func (m *Minimal) Hello(name string) string {
return name
}
func (f *Foo) Hello(name string) string {
return name
}
func (b *bar) Hello(name string) string {
return name
}
`,
})
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(inspectModule).Stdout(ctx)
require.NoError(t, err)
objs := gjson.Get(out, "host.directory.asModule.objects")
require.Equal(t, 2, len(objs.Array()))
minimal := objs.Get(`0.asObject`) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | require.Equal(t, "Minimal", minimal.Get("name").String())
foo := objs.Get(`1.asObject`)
require.Equal(t, "MinimalFoo", foo.Get("name").String())
modGen = c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Minimal struct {}
type Foo struct {
Bar bar
}
type bar struct {}
func (m *Minimal) Hello(name string) string {
return name
}
func (f *Foo) Hello(name string) string {
return name
}
func (b *bar) Hello(name string) string {
return name
}
`,
})
logGen(ctx, t, modGen.Directory("."))
_, err = modGen.With(inspectModule).Stderr(ctx)
require.Error(t, err)
}
func TestModuleGoSignaturesMixMatch(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Minimal struct {}
func (m *Minimal) Hello(name string, opts struct{}, opts2 struct{}) string {
return name
}
`,
})
logGen(ctx, t, modGen.Directory("."))
_, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx)
require.Error(t, err)
}
func TestModuleGoSignaturesIDable(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Minimal struct {}
type Custom struct {
Data string
}
func (m *Minimal) Hello() string {
return "hello"
}
func (m *Minimal) UseCustom(custom *Custom) string {
return custom.Data
}
`,
})
logGen(ctx, t, modGen.Directory("."))
_, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "Undefined type MinimalCustomID")
}
var goExtend string
func TestModuleGoExtendCore(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
var logs safeBuffer
c, ctx := connect(t, dagger.WithLogOutput(&logs))
_, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=test", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: goExtend,
}).
With(daggerExec("mod", "sync")).
Sync(ctx)
require.Error(t, err)
require.NoError(t, c.Close())
require.Contains(t, logs.String(), "cannot define methods on objects from outside this module")
}
var customTypes string
func TestModuleGoCustomTypes(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=test", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: customTypes,
})
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(daggerQuery(`{test{repeater(msg:"echo!", times: 3){render}}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"test":{"repeater":{"render":"echo!echo!echo!"}}}`, out)
}
func TestModuleGoReturnTypeDetection(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=foo", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Foo struct {}
type X struct {
Message string ` + "`json:\"message\"`" + `
}
func (m *Foo) MyFunction() X {
return X{Message: "foo"}
}
`,
})
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(daggerQuery(`{foo{myFunction{message}}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"foo":{"myFunction":{"message":"foo"}}}`, out)
}
var useInner string
var useOuter string
func TestModuleGoUseLocal(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dep").
With(daggerExec("mod", "init", "--name=dep", "--sdk=go")).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=use", "--sdk=go")).
WithNewFile("/work/dep/main.go", dagger.ContainerWithNewFileOpts{
Contents: useInner,
}).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: useOuter,
}).
With(daggerExec("mod", "use", "./dep")).
WithEnvVariable("BUST", identity.NewID())
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out)
_, err = modGen.With(daggerQuery(`{dep{hello}}`)).Stdout(ctx)
require.Error(t, err)
require.ErrorContains(t, err, `Cannot query field "dep" on type "Query".`)
}
func TestModuleGoUseLocalMulti(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/foo").
WithNewFile("/work/foo/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Foo struct {}
func (m *Foo) Name() string { return "foo" }
`,
}).
With(daggerExec("mod", "init", "--name=foo", "--sdk=go")).
WithWorkdir("/work/bar").
WithNewFile("/work/bar/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Bar struct {}
func (m *Bar) Name() string { return "bar" }
`,
}).
With(daggerExec("mod", "init", "--name=bar", "--sdk=go")). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=use", "--sdk=go")).
With(daggerExec("mod", "use", "./foo")).
With(daggerExec("mod", "use", "./bar")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import "context"
import "fmt"
type Use struct {}
func (m *Use) Names(ctx context.Context) ([]string, error) {
fooName, err := dag.Foo().Name(ctx)
if err != nil {
return nil, fmt.Errorf("foo.name: %w", err)
}
barName, err := dag.Bar().Name(ctx)
if err != nil {
return nil, fmt.Errorf("bar.name: %w", err)
}
return []string{fooName, barName}, nil
}
`,
}).
WithEnvVariable("BUST", identity.NewID())
logGen(ctx, t, modGen.Directory("."))
out, err := modGen.With(daggerQuery(`{use{names}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"use":{"names":["foo", "bar"]}}`, out)
}
var wrapper string
func TestModuleGoWrapping(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=wrapper", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: wrapper,
})
logGen(ctx, t, modGen.Directory("."))
id := identity.NewID()
out, err := modGen.With(daggerQuery(
fmt.Sprintf(`{wrapper{container{echo(msg:%q){unwrap{stdout}}}}}`, id),
)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t,
fmt.Sprintf(`{"wrapper":{"container":{"echo":{"unwrap":{"stdout":%q}}}}}`, id),
out)
}
func TestModuleConfigAPI(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
moduleDir := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/subdir").
With(daggerExec("mod", "init", "--name=test", "--sdk=go", "--root=..")).
Directory("/work")
cfg := c.ModuleConfig(moduleDir, dagger.ModuleConfigOpts{Subpath: "subdir"})
name, err := cfg.Name(ctx)
require.NoError(t, err)
require.Equal(t, "test", name)
sdk, err := cfg.SDK(ctx)
require.NoError(t, err)
require.Equal(t, "go", sdk)
root, err := cfg.Root(ctx)
require.NoError(t, err)
require.Equal(t, "..", root)
}
func TestModulePythonInit(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Run("from scratch", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("mod", "init", "--name=bare", "--sdk=python"))
out, err := modGen.
With(daggerQuery(`{bare{myFunction(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"bare":{"myFunction":{"stdout":"hello\n"}}}`, out)
})
t.Run("respects existing pyproject.toml", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work"). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | WithNewFile("pyproject.toml", dagger.ContainerWithNewFileOpts{
Contents: `[project]
name = "has-pyproject"
version = "0.0.0"
`,
}).
With(daggerExec("mod", "init", "--name=hasPyproject", "--sdk=python"))
out, err := modGen.
With(daggerQuery(`{hasPyproject{myFunction(stringArg:"hello"){stdout}}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasPyproject":{"myFunction":{"stdout":"hello\n"}}}`, out)
t.Run("preserves module name", func(t *testing.T) {
generated, err := modGen.File("pyproject.toml").Contents(ctx)
require.NoError(t, err)
require.Contains(t, generated, `name = "has-pyproject"`)
})
})
t.Run("respects existing main.py", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/src/main/__init__.py", dagger.ContainerWithNewFileOpts{
Contents: "from . import notmain\n",
}).
WithNewFile("/work/src/main/notmain.py", dagger.ContainerWithNewFileOpts{
Contents: `from dagger.mod import function
@function |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | def hello() -> str:
return "Hello, world!"
`,
}).
With(daggerExec("mod", "init", "--name=hasMainPy", "--sdk=python"))
out, err := modGen.
With(daggerQuery(`{hasMainPy{hello}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"hasMainPy":{"hello":"Hello, world!"}}`, out)
})
}
func TestModuleLotsOfFunctions(t *testing.T) {
t.Parallel()
const funcCount = 100
t.Run("go sdk", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
mainSrc := `
package main
type PotatoSack struct {}
`
for i := 0; i < funcCount; i++ {
mainSrc += fmt.Sprintf(`
func (m *PotatoSack) Potato%d() string {
return "potato #%d"
}
`, i, i)
}
modGen := c.Container().From(golangImage). |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: mainSrc,
}).
With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=go"))
logGen(ctx, t, modGen.Directory("."))
var eg errgroup.Group
for i := 0; i < funcCount; i++ {
i := i
if i%10 != 0 {
continue
}
eg.Go(func() error {
_, err := modGen.
With(daggerCall(fmt.Sprintf("potato%d", i))).
Sync(ctx)
return err
})
}
require.NoError(t, eg.Wait())
})
t.Run("python sdk", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
mainSrc := `from dagger.mod import function
`
for i := 0; i < funcCount; i++ {
mainSrc += fmt.Sprintf(` |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | @function
def potato_%d() -> str:
return "potato #%d"
`, i, i)
}
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithNewFile("./src/main.py", dagger.ContainerWithNewFileOpts{
Contents: mainSrc,
}).
With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=python"))
var eg errgroup.Group
for i := 0; i < funcCount; i++ {
i := i
if i%10 != 0 {
continue
}
eg.Go(func() error {
_, err := modGen.
With(daggerCall(fmt.Sprintf("potato%d", i))).
Sync(ctx)
return err
})
}
require.NoError(t, eg.Wait())
})
}
func TestModuleNamespacing(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
moduleSrcPath, err := filepath.Abs("./testdata/modules/go/namespacing")
require.NoError(t, err)
ctr := c.Container().From(alpineImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithMountedDirectory("/work", c.Host().Directory(moduleSrcPath)).
WithWorkdir("/work")
out, err := ctr.
With(daggerQuery(`{test{fn(s:"yo")}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"test":{"fn":"1:yo 2:yo"}}`, out)
}
func TestEnvCmd(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | environmentPath string
expectedSDK string
expectedName string
expectedRoot string
}
for _, tc := range []testCase{
{
environmentPath: "core/integration/testdata/environments/go/basic",
expectedSDK: "go",
expectedName: "basic",
expectedRoot: "../../../../../../",
},
} {
tc := tc
for _, testGitEnv := range []bool{false, true} {
testGitEnv := testGitEnv
testName := "local environment"
if testGitEnv {
testName = "git environment" |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | }
testName += "/" + tc.environmentPath
t.Run(testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
stderr, err := CLITestContainer(ctx, t, c).
WithLoadedEnv(tc.environmentPath, testGitEnv).
CallEnv().
Stderr(ctx)
require.NoError(t, err)
require.Contains(t, stderr, fmt.Sprintf(`"root": %q`, tc.expectedRoot))
require.Contains(t, stderr, fmt.Sprintf(`"name": %q`, tc.expectedName))
require.Contains(t, stderr, fmt.Sprintf(`"sdk": %q`, tc.expectedSDK))
})
}
}
}
func TestEnvCmdHelps(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
c, ctx := connect(t)
baseCtr := CLITestContainer(ctx, t, c).WithHelpArg(true)
noEnvCtr := baseCtr
validLocalEnvCtr := baseCtr.WithLoadedEnv("core/integration/testdata/environments/go/basic", false)
brokenLocalEnvCtr := baseCtr.WithLoadedEnv("core/integration/testdata/environments/go/broken", false)
for _, ctr := range []*DaggerCLIContainer{noEnvCtr, validLocalEnvCtr, brokenLocalEnvCtr} {
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | testName string
cmdCtr *DaggerCLIContainer
expectedOutput string
}
for _, tc := range []testCase{
{
testName: "dagger env/" + ctr.EnvArg,
cmdCtr: ctr.CallEnv(),
expectedOutput: "Usage:\n dagger environment [flags]\n\nAliases:\n environment, env",
},
{
testName: "dagger env init/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvInit(),
expectedOutput: "Usage:\n dagger environment init",
},
{
testName: "dagger env sync/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvSync(),
expectedOutput: "Usage:\n dagger environment sync",
},
{
testName: "dagger env extend/" + ctr.EnvArg,
cmdCtr: ctr.CallEnvExtend("./fake/dep"),
expectedOutput: "Usage:\n dagger environment extend",
}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | {
testName: "dagger checks/" + ctr.EnvArg,
cmdCtr: ctr.CallChecks(),
expectedOutput: "Usage:\n dagger checks",
},
} {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
t.Parallel()
stdout, err := tc.cmdCtr.Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, tc.expectedOutput)
})
}
}
}
func TestEnvCmdInit(t *testing.T) {
t.Skip("pending conversion to modules")
t.Parallel()
type testCase struct {
testName string
environmentPath string
sdk string
name string
root string
expectedErrorMessage string
}
for _, tc := range []testCase{
{
testName: "explicit environment dir/go", |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | environmentPath: "/var/testenvironment/subdir",
sdk: "go",
name: identity.NewID(),
root: "../",
},
{
testName: "explicit environment dir/python",
environmentPath: "/var/testenvironment/subdir",
sdk: "python",
name: identity.NewID(),
root: "../..",
},
{
testName: "explicit environment file",
environmentPath: "/var/testenvironment/subdir/dagger.json",
sdk: "python",
name: identity.NewID(),
},
{
testName: "implicit environment",
sdk: "go",
name: identity.NewID(),
},
{
testName: "implicit environment with root",
environmentPath: "/var/testenvironment",
sdk: "python",
name: identity.NewID(),
root: "..",
}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | {
testName: "invalid sdk",
environmentPath: "/var/testenvironment",
sdk: "c++--",
name: identity.NewID(),
expectedErrorMessage: "unsupported environment SDK",
},
{
testName: "error on git",
environmentPath: "git://github.com/dagger/dagger.git",
sdk: "go",
name: identity.NewID(),
expectedErrorMessage: "environment init is not supported for git environments",
},
} {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
ctr := CLITestContainer(ctx, t, c).
WithEnvArg(tc.environmentPath).
WithSDKArg(tc.sdk).
WithNameArg(tc.name).
CallEnvInit()
if tc.expectedErrorMessage != "" {
_, err := ctr.Sync(ctx)
require.ErrorContains(t, err, tc.expectedErrorMessage)
return
}
expectedConfigPath := tc.environmentPath |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | if !strings.HasSuffix(expectedConfigPath, "dagger.json") {
expectedConfigPath = filepath.Join(expectedConfigPath, "dagger.json")
}
_, err := ctr.File(expectedConfigPath).Contents(ctx)
require.NoError(t, err)
if tc.sdk == "go" {
codegenFile := filepath.Join(filepath.Dir(expectedConfigPath), "dagger.gen.go")
_, err := ctr.File(codegenFile).Contents(ctx)
require.NoError(t, err)
}
stderr, err := ctr.CallEnv().Stderr(ctx)
require.NoError(t, err)
require.Contains(t, stderr, fmt.Sprintf(`"name": %q`, tc.name))
require.Contains(t, stderr, fmt.Sprintf(`"sdk": %q`, tc.sdk))
})
}
t.Run("error on existing environment", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
_, err := CLITestContainer(ctx, t, c).
WithLoadedEnv("core/integration/testdata/environments/go/basic", false).
WithSDKArg("go").
WithNameArg("foo").
CallEnvInit().
Sync(ctx)
require.ErrorContains(t, err, "environment init config path already exists")
})
}
func TestEnvChecks(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Skip("pending conversion to modules")
t.Parallel()
allChecks := []string{
"cool-static-check",
"sad-static-check",
"cool-container-check",
"sad-container-check",
"cool-composite-check",
"sad-composite-check",
"another-cool-static-check",
"another-sad-static-check",
"cool-composite-check-from-explicit-dep",
"sad-composite-check-from-explicit-dep",
"cool-composite-check-from-dynamic-dep",
"sad-composite-check-from-dynamic-dep",
"cool-check-only-return",
"cool-check-result-only-return",
"cool-string-only-return",
"cool-error-only-return",
"sad-error-only-return",
"cool-string-error-return",
"sad-string-error-return",
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | compositeCheckToSubcheckNames := map[string][]string{
"cool-composite-check": {
"cool-subcheck-a",
"cool-subcheck-b",
},
"sad-composite-check": {
"sad-subcheck-a",
"sad-subcheck-b",
},
"cool-composite-check-from-explicit-dep": {
"another-cool-static-check",
"another-cool-container-check",
"another-cool-composite-check",
},
"sad-composite-check-from-explicit-dep": {
"another-sad-static-check",
"another-sad-container-check",
"another-sad-composite-check",
},
"cool-composite-check-from-dynamic-dep": {
"yet-another-cool-static-check",
"yet-another-cool-container-check",
"yet-another-cool-composite-check",
},
"sad-composite-check-from-dynamic-dep": {
"yet-another-sad-static-check",
"yet-another-sad-container-check",
"yet-another-sad-composite-check",
},
"another-cool-composite-check": { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | "another-cool-subcheck-a",
"another-cool-subcheck-b",
},
"another-sad-composite-check": {
"another-sad-subcheck-a",
"another-sad-subcheck-b",
},
"yet-another-cool-composite-check": {
"yet-another-cool-subcheck-a",
"yet-another-cool-subcheck-b",
},
"yet-another-sad-composite-check": {
"yet-another-sad-subcheck-a",
"yet-another-sad-subcheck-b",
},
}
checkOutput := func(name string) string {
return "WE ARE RUNNING CHECK " + strcase.ToKebab(name)
}
type testCase struct {
name string
environmentPath string
selectedChecks []string
expectFailure bool
}
for _, tc := range []testCase{
{
name: "happy-path",
environmentPath: "core/integration/testdata/environments/go/basic", |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | selectedChecks: []string{
"cool-static-check",
"cool-container-check",
"cool-composite-check",
"another-cool-static-check",
"cool-composite-check-from-explicit-dep",
"cool-composite-check-from-dynamic-dep",
"cool-check-only-return",
"cool-check-result-only-return",
"cool-string-only-return",
"cool-error-only-return",
"cool-string-error-return",
},
},
{
name: "sad-path",
expectFailure: true,
environmentPath: "core/integration/testdata/environments/go/basic",
selectedChecks: []string{
"sad-static-check",
"sad-container-check",
"sad-composite-check",
"another-sad-static-check",
"sad-composite-check-from-explicit-dep",
"sad-composite-check-from-dynamic-dep",
"sad-error-only-return",
"sad-string-error-return",
},
},
{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | name: "mixed-path",
expectFailure: true,
environmentPath: "core/integration/testdata/environments/go/basic",
},
} {
tc := tc
for _, testGitEnv := range []bool{false, true} {
testGitEnv := testGitEnv
testName := tc.name
testName += "/gitenv=" + strconv.FormatBool(testGitEnv)
testName += "/" + tc.environmentPath
t.Run(testName, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
stderr, err := CLITestContainer(ctx, t, c).
WithLoadedEnv(tc.environmentPath, testGitEnv).
CallChecks(tc.selectedChecks...).
Stderr(ctx)
if tc.expectFailure {
require.Error(t, err)
execErr := new(dagger.ExecError)
require.True(t, errors.As(err, &execErr))
stderr = execErr.Stderr
} else {
require.NoError(t, err)
}
selectedChecks := tc.selectedChecks
if len(selectedChecks) == 0 {
selectedChecks = allChecks |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | }
curChecks := selectedChecks
for len(curChecks) > 0 {
var nextChecks []string
for _, checkName := range curChecks {
subChecks, ok := compositeCheckToSubcheckNames[checkName]
if ok {
nextChecks = append(nextChecks, subChecks...)
} else {
if checkName == "cool-error-only-return" {
continue
}
require.Contains(t, stderr, checkOutput(checkName))
}
}
curChecks = nextChecks
}
})
}
}
}
func daggerExec(args ...string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
return c.WithExec(append([]string{"dagger", "--debug"}, args...), dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerQuery(query string) dagger.WithContainerFunc { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | return func(c *dagger.Container) *dagger.Container {
return c.WithExec([]string{"dagger", "--debug", "query"}, dagger.ContainerWithExecOpts{
Stdin: query,
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerCall(fnName string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
return c.WithExec([]string{"dagger", "--debug", "call", fnName}, dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func goGitBase(t *testing.T, c *dagger.Client) *dagger.Container {
t.Helper()
return c.Container().From(golangImage).
WithExec([]string{"apk", "add", "git"}).
WithExec([]string{"git", "config", "--global", "user.email", "dagger@example.com"}).
WithExec([]string{"git", "config", "--global", "user.name", "Dagger Tests"}).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
WithExec([]string{"git", "init"})
}
func logGen(ctx context.Context, t *testing.T, modSrc *dagger.Directory) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,975 | Zenith: error creating module named "Go" | ```
~/G/g/F/P/go β―β―β― dagger mod init --name Go --sdk go bugfix/prevent-stack-smashing β± βΌ
β asModule(sourceSubpath: ".") ERROR [0.92s]
β .....
β generating go module: Go ERROR [0.09s]
β [0.02s] go mod tidy
β writing dagger.gen.go
β writing go.mod
β writing go.sum
β writing main.go
β creating directory querybuilder
β writing querybuilder/marshal.go
β writing querybuilder/querybuilder.go
β panic: go: internal error: missing go root module
β
β goroutine 1 [running]:
β cmd/go/internal/modload.mustHaveGoRoot(...)
β cmd/go/internal/modload/buildlist.go:104
β cmd/go/internal/modload.newRequirements(0xe0?, {0x4000218b40?, 0x543be0?, 0x40001720f0?}, 0x5aedc0?)
β cmd/go/internal/modload/buildlist.go:118 +0x584
β cmd/go/internal/modload.updateUnprunedRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000f20a0, {0x0, 0x0, 0x3d0f40?})
β cmd/go/internal/modload/buildlist.go:1465 +0x820
β cmd/go/internal/modload.updateRoots({0x71df30?, 0xab31e0?}, 0x0?, 0x40000a80c0?, {0x0?, 0x2?, 0x40000a80c0?}, {0x0?, 0x0?, 0x40000a80d0?}, ...)
β cmd/go/internal/modload/buildlist.go:781 +0x6c
β cmd/go/internal/modload.loadModFile({0x71df30, 0xab31e0}, 0x40000fe280)
β cmd/go/internal/modload/init.go:939 +0x134c
β cmd/go/internal/modload.LoadPackages({0x71df30?, 0xab31e0}, {{0x0, 0x0}, 0x4000119ef0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
β cmd/go/internal/modload/load.go:345 +0x31c
β cmd/go/internal/modcmd.runTidy({0x71df30, 0xab31e0}, 0x40000ea4c8?, {0x400009e1a0?, 0x54c8e0?, 0x10edbc?})
β cmd/go/internal/modcmd/tidy.go:127 +0x204
β main.invoke(0xa70ea0, {0x400009e1a0, 0x1, 0x1})
β cmd/go/main.go:268 +0x4f0
β main.main()
β cmd/go/main.go:186 +0x754
β needs another pass...
β’ Engine: c8919d4606c0 (version v0.9.1)
```
Not immediately sure why this would happen (other names like "Golang" are find); need to dig through stack trace. | https://github.com/dagger/dagger/issues/5975 | https://github.com/dagger/dagger/pull/5983 | dfdb520e16167d2629fb005bfedb20522270e580 | 77600801b2a6bc4552cfc4fc5ae4307826e29334 | 2023-10-26T19:25:12Z | go | 2023-10-27T09:22:51Z | core/integration/module_test.go | t.Helper()
generated, err := modSrc.File("dagger.gen.go").Contents(ctx)
require.NoError(t, err)
t.Cleanup(func() {
t.Name()
fileName := filepath.Join(
os.TempDir(),
t.Name(),
fmt.Sprintf("dagger.gen.%d.go", time.Now().Unix()),
)
if err := os.MkdirAll(filepath.Dir(fileName), 0o755); err != nil {
t.Logf("failed to create temp dir for generated code: %v", err)
return
}
if err := os.WriteFile(fileName, []byte(generated), 0644); err != nil {
t.Logf("failed to write generated code to %s: %v", fileName, err)
} else {
t.Logf("wrote generated code to %s", fileName)
}
})
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | package templates
import (
"encoding/json"
"fmt"
"go/ast"
"go/token"
"go/types"
"os"
"path/filepath"
"runtime/debug"
"sort"
"strings"
. "github.com/dave/jennifer/jen"
"github.com/iancoleman/strcase"
"golang.org/x/tools/go/packages"
)
const (
daggerGenFilename = "dagger.gen.go"
contextTypename = "context.Context"
)
/* TODO:
* Handle types from 3rd party imports in the type signature |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | * Add packages.NeedImports and packages.NeedDependencies to packages.Load opts, ensure performance is okay (or deal with that by lazy loading)
* Fix problem where changing a function signature requires running `dagger mod sync` twice (first one will result in package errors being seen, second one fixes)
* Use Overlays field in packages.Config to provide partial generation of dagger.gen.go, without the unupdated code we generate here
* Handle automatically re-running `dagger mod sync` when invoking functions from CLI, to save users from having to always remember while developing locally
* Support methods defined on non-pointer receivers
*/
/*
moduleMainSrc generates the source code of the main func for Dagger Module code using the Go SDK.
The overall idea is that users just need to create a struct with the same name as their Module and then
add methods to that struct to implement their Module. Methods on that struct become Functions.
They are also free to return custom objects from Functions, which themselves may have methods that become
Functions too. However, only the "top-level" Module struct's Functions will be directly invokable.
This is essentially just the GraphQL execution model.
The implementation works by parsing the user's code and generating a main func that reads function call inputs
from the Engine, calls the relevant function and returns the result. The generated code is mostly a giant switch/case
on the object+function name, with each case doing json deserialization of the input arguments and calling the actual
Go function.
*/
func (funcs goTemplateFuncs) moduleMainSrc() (string, error) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "internal error during module code generation: %v\n", r)
debug.PrintStack()
panic(r)
}
}()
if funcs.modulePkg == nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | return `func main() { panic("no code yet") }`, nil
}
ps := &parseState{
pkg: funcs.modulePkg,
fset: funcs.moduleFset,
methods: make(map[string][]method),
}
pkgScope := funcs.modulePkg.Types.Scope()
objFunctionCases := map[string][]Code{}
createMod := Qual("dag", "CurrentModule").Call()
objs := []types.Object{}
for _, name := range pkgScope.Names() {
obj := pkgScope.Lookup(name)
if obj == nil {
continue
}
objs = append(objs, obj)
}
sort.Slice(objs, func(i, j int) bool {
return objs[i].Pos() < objs[j].Pos()
})
tps := []types.Type{}
for _, obj := range objs {
tps = append(tps, obj.Type())
}
added := map[string]struct{}{} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | topLevel := true
for len(tps) != 0 {
var nextTps []types.Type
for _, tp := range tps {
named, isNamed := tp.(*types.Named)
if !isNamed {
continue
}
obj := named.Obj()
if obj.Pkg() != funcs.modulePkg.Types {
continue
}
if !obj.Exported() {
if !topLevel {
return "", fmt.Errorf("cannot code-generate unexported type %s", obj.Name())
}
continue
}
strct, isStruct := named.Underlying().(*types.Struct)
if !isStruct {
continue
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | if _, ok := added[obj.Name()]; ok {
continue
}
objType, extraTypes, err := ps.goStructToAPIType(strct, named)
if err != nil {
return "", err
}
if objType == nil {
continue
}
if err := ps.fillObjectFunctionCases(named, objFunctionCases); err != nil {
return "", fmt.Errorf("failed to generate function cases for %s: %w", obj.Name(), err)
}
if len(objFunctionCases[obj.Name()]) == 0 {
if topLevel {
continue
}
if ps.isDaggerGenerated(named.Obj()) {
continue
}
}
createMod = dotLine(createMod, "WithObject").Call(Add(Line(), objType))
added[obj.Name()] = struct{}{} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | nextTps = append(nextTps, extraTypes...)
}
tps, nextTps = nextTps, nil
topLevel = false
}
return strings.Join([]string{mainSrc, invokeSrc(objFunctionCases, createMod)}, "\n"), nil
}
func dotLine(a *Statement, id string) *Statement {
return a.Op(".").Line().Id(id)
}
const (
mainSrc = `func main() { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | ctx := context.Background()
fnCall := dag.CurrentFunctionCall()
parentName, err := fnCall.ParentName(ctx)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
fnName, err := fnCall.Name(ctx)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
parentJson, err := fnCall.Parent(ctx)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
fnArgs, err := fnCall.InputArgs(ctx)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
inputArgs := map[string][]byte{}
for _, fnArg := range fnArgs {
argName, err := fnArg.Name(ctx)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
argValue, err := fnArg.Value(ctx) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
inputArgs[argName] = []byte(argValue)
}
result, err := invoke(ctx, []byte(parentJson), parentName, fnName, inputArgs)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
resultBytes, err := json.Marshal(result)
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
_, err = fnCall.ReturnValue(ctx, JSON(resultBytes))
if err != nil {
fmt.Println(err.Error())
os.Exit(2)
}
}
`
parentJSONVar = "parentJSON"
parentNameVar = "parentName"
fnNameVar = "fnName"
inputArgsVar = "inputArgs"
invokeFuncName = "invoke"
)
func invokeSrc(objFunctionCases map[string][]Code, createMod Code) string { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | objCases := []Code{}
for objName, functionCases := range objFunctionCases {
objCases = append(objCases, Case(Lit(objName)).Block(Switch(Id(fnNameVar)).Block(functionCases...)))
}
objCases = append(objCases, Case(Lit("")).Block(
Return(createMod, Nil()),
))
objCases = append(objCases, Default().Block(
Return(Nil(), Qual("fmt", "Errorf").Call(Lit("unknown object %s"), Id(parentNameVar))),
))
objSwitch := Switch(Id(parentNameVar)).Block(objCases...)
invokeFunc := Func().Id(invokeFuncName).Params(
Id("ctx").Qual("context", "Context"),
Id(parentJSONVar).Index().Byte(),
Id(parentNameVar).String(),
Id(fnNameVar).String(),
Id(inputArgsVar).Map(String()).Index().Byte(),
).Params( |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | Id("any"),
Error(),
).Block(objSwitch)
return fmt.Sprintf("%#v", invokeFunc)
}
func renderNameOrStruct(t types.Type) string {
if ptr, ok := t.(*types.Pointer); ok {
return "*" + renderNameOrStruct(ptr.Elem())
}
if sl, ok := t.(*types.Slice); ok {
return "[]" + renderNameOrStruct(sl.Elem())
}
if st, ok := t.(*types.Struct); ok {
result := "struct {\n"
for i := 0; i < st.NumFields(); i++ {
if !st.Field(i).Embedded() {
result += st.Field(i).Name() + " "
}
result += renderNameOrStruct(st.Field(i).Type())
if tag := st.Tag(i); tag != "" {
result += " `" + tag + "`"
}
result += "\n"
}
result += "}"
return result
}
if named, ok := t.(*types.Named); ok { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | base := named.Obj().Name()
if typeArgs := named.TypeArgs(); typeArgs.Len() > 0 {
base += "["
for i := 0; i < typeArgs.Len(); i++ {
if i > 0 {
base += ", "
}
base += renderNameOrStruct(typeArgs.At(i))
}
base += "]"
}
return base
}
return t.String()
}
var checkErrStatement = If(Err().Op("!=").Nil()).Block(
Qual("fmt", "Println").Call(Err().Dot("Error").Call()),
Qual("os", "Exit").Call(Lit(2)),
)
func (ps *parseState) fillObjectFunctionCases(type_ types.Type, cases map[string][]Code) error { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | var objName string
switch x := type_.(type) {
case *types.Pointer:
return ps.fillObjectFunctionCases(x.Elem(), cases)
case *types.Named:
objName = x.Obj().Name()
default:
return nil
}
if existingCases := cases[objName]; len(existingCases) > 0 {
return nil
}
methods := ps.methods[objName]
if len(methods) == 0 {
return nil
}
for _, method := range methods {
fnName, sig := method.fn.Name(), method.fn.Type().(*types.Signature)
statements := []Code{
Var().Id("err").Error(),
}
parentVarName := "parent"
statements = append(statements,
Var().Id(parentVarName).Id(objName),
Err().Op("=").Qual("json", "Unmarshal").Call(Id(parentJSONVar), Op("&").Id(parentVarName)),
checkErrStatement,
)
fnCallArgs := []Code{Op("&").Id(parentVarName)}
vars := map[string]struct{}{} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | for i, spec := range method.paramSpecs {
if i == 0 && spec.paramType.String() == contextTypename {
fnCallArgs = append(fnCallArgs, Id("ctx"))
continue
}
var varName string
var varType types.Type
var target *Statement
if spec.parent == nil {
varName = strcase.ToLowerCamel(spec.name)
varType = spec.paramType
target = Id(varName)
} else {
varName = spec.parent.name
varType = spec.parent.paramType
target = Id(spec.parent.name).Dot(spec.name)
}
if _, ok := vars[varName]; !ok {
vars[varName] = struct{}{} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,860 | Zenith: fix Go struct field json serialization | https://github.com/dagger/dagger/pull/5757#issuecomment-1744739721
Right now if you have something like:
```go
type Foo struct {
Bar `json:"blahblah"`
}
```
The graphql schema for `Foo` will be populated with a field called `Bar`, but when we do json serialization we use `blahblah`, which means that if you try to query for the value of the `Bar` field, our gql server hits the trivial resolver codepath and looks for `bar` in the json object and doesn't find it (since it's been serialized to `blahblah`).
My first thought was that if a json struct tag is present, we should use that as the graphql field name rather than the go name. That would fix this problem I think, but it's more debatable whether it's surprising behavior (or honestly if anyone will really care about this).
---
Possibly related issue from https://github.com/dagger/dagger/pull/5757#issuecomment-1752775608
```golang
package main
import (
"context"
)
type Foo struct{}
type Test struct {
X string
Y int
}
func (t *Test) Void() {}
func (m *Foo) MyFunction(ctx context.Context) Test {
return Test{X: "hello", Y: 1337}
}
```
```bash
$ echo '{foo{myFunction{x}}}' | dagger query -m ""
...
β§ 1.17s β 22 β
20 β 2
Error: make request: input:1: foo.myFunction.x Cannot return null for non-nullable field Test.x.
```
If I modify the struct with JSON field names, the above works:
```golang
type Test struct {
X string `json:"x"`
Y int `json:"y"`
}
```
---
cc @vito @jedevc | https://github.com/dagger/dagger/issues/5860 | https://github.com/dagger/dagger/pull/6057 | 2c554b2ac26c4c6863893bac94d85108cecb48d9 | e1d69edbfd0f94c93489edac4d9d6050c36fc3b7 | 2023-10-10T22:50:32Z | go | 2023-11-14T23:56:25Z | cmd/codegen/generator/go/templates/modules.go | tp, access := findOptsAccessPattern(varType, Id(varName))
statements = append(statements, Var().Id(varName).Id(renderNameOrStruct(tp)))
if spec.variadic {
fnCallArgs = append(fnCallArgs, access.Op("..."))
} else {
fnCallArgs = append(fnCallArgs, access)
}
}
statements = append(statements,
If(Id(inputArgsVar).Index(Lit(spec.graphqlName())).Op("!=").Nil()).Block(
Err().Op("=").Qual("json", "Unmarshal").Call(
Index().Byte().Parens(Id(inputArgsVar).Index(Lit(spec.graphqlName()))),
Op("&").Add(target),
),
checkErrStatement,
))
}
results := sig.Results()
switch results.Len() {
case 2:
if results.At(1).Type().String() != errorTypeName {
return fmt.Errorf("second return value must be error, have %s", results.At(0).Type().String())
}
statements = append(statements, Return(
Parens(Op("*").Id(objName)).Dot(fnName).Call(fnCallArgs...),
))
cases[objName] = append(cases[objName], Case(Lit(fnName)).Block(statements...))
if err := ps.fillObjectFunctionCases(results.At(0).Type(), cases); err != nil { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.