#Initializing a new Dagger Module fails (Go)

1 messages · Page 1 of 1 (latest)

gritty saddle
#

Hi,

When running dagger init --sdk=go potato I get the following error:

✘ ModuleSource.asModule: Module! 0.8s
  ✘ Module.withSource(
      source: ✔ ModuleSource.resolveFromCaller: ModuleSource! 0.0s
    ): Module! 0.8s
    ✘ Container.directory(path: "/src"): Directory! 0.7s
      ✘ exec /usr/local/bin/codegen --module-context /src --module-name potato --propagate-logs=true --introspection-json-path /schema.json 0.7s
      ┃ Error: generate code: template: alias.go.tmpl:56:3: executing "_dagger.gen.go/alias.go.tmpl" at <ModuleMainSrc>: error cal
      ┃ uleMainSrc: cannot find default codegen DaggerObject interface
      ✘ generating go module: potato 0.5s
      ┃ writing internal/querybuilder/querybuilder.go
      ┃ writing main.go
      ┃ needs another pass...

Error: failed to generate code: input: moduleSource.withContextDirectory.withName.withSDK.withSourceSubpath.asModule resolve: failed to create module: select: failed to update codegen and runtime: failed to generate code: failed to get modified source directory for go module sdk codegen: select: process "/usr/local/bin/codegen --module-context /src --module-name potato --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1

Stderr:
Error: generate code: template: alias.go.tmpl:56:3: executing "_dagger.gen.go/alias.go.tmpl" at <ModuleMainSrc>: error calling ModuleMainSrc: cannot find default codegen DaggerObject interface
#
dagger version
dagger v0.10.3 (registry.dagger.io/engine) darwin/arm64
frozen steeple
#

Hey @gritty saddle, we chatted on Twitter yesterday, great to see you here! I am looking into this now. Thanks for reporting the issue.

#

Hm, this is very strange, I am not able to reproduce. Could you tell me about where you are running this command and if there are any other go related things in that same directory, sometimes there have been issues with other go modules or workspaces.

gritty saddle
#

Thanks for the hint, Lev! I think the issue happens when running the command in an empty directory that lives within a Go project.