dagger / dagger

An engine to run your pipelines in containers

Home Page:https://dagger.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐞 Module names with single-dotted characters cause "main object not found"

SKalt opened this issue Β· comments

What is the issue?

I have a go module with a weird name with single dotted characters in it (e.g. "m.a.s.h"). I was running through the setup script when I encountered a weird error, "unable to find main object". I determined this error only occurs when there are single-dotted characters in the name field of dagger.json. I suspect the culprit is a mismatch between the arguments informing the generated go struct name

moduleStructName := strcase.ToCamel(g.Config.ModuleName)

and the gql object name

func gqlObjectName(name string) string {
	return strcase.ToCamel(name)
}

Dagger version

engine 6cf72caa80eb (version v0.11.2)

Steps to reproduce

Full reproduction script at https://github.com/SKalt/weird.name.repro/blob/main/repro.sh. Relevant excerpt:

dagger init --name=w.eird.name.repro
dagger develop --sdk=go
dagger functions

Log output

Full output logs at https://github.com/SKalt/weird.name.repro/blob/main/output.txt. Relevant excerpt:

Error: main object not found

Yes, that error appears when there's no object in the module's code that match the module's name, taking into consideration naming convention conversions. Safest bet for module names is kebab-case.

However, the error can be improved here.