#What name convention does dagger use to export function names

1 messages · Page 1 of 1 (latest)

civic stone
#

Created a dagger module with a single function named TcpService(https://github.com/jalvarezit/daggerverse/blob/bda7c65efec79a5ae6253f8a5d0683f7dec9b15d/podman/dagger/main.go#L8)

From the docs (https://docs.dagger.io/manuals/developer/go/172964/dependencies) seems like PascalCase. However had to inspect the generated type because instead of accesing it like dag.Podman().TcpService It was generated as TCPService. I am using it in here https://github.com/jalvarezit/daggerverse/blob/bda7c65efec79a5ae6253f8a5d0683f7dec9b15d/container-structure-test/dagger/main.go#L10C19-L10C42

Not sure if this is the expected behaviour or a bug 😅

#

What name convention does dagger use to export function names

split aurora
#

@civic stone thanks for pointing this out. I suspect it might be the codegen trying to make certain keywords or acronyms consistent and thus using TCP instead of Tcp. We need to look into that, ensure we know and like the behavior, and document it. My suspicion seems to be confirmed when I use Foo instead of protocol names.

#

In this module, I have a dependency module that consists of simple functions with protocols in their names using PascalCase. Those that are protocol names get uppercased while my FooTest does not.

#
package main

type Dep struct{}

func (m *Dep) TcpTest() string {
    return "TcpTest"
}
func (m *Dep) UdpTest() string {
    return "UdpTest"
}
func (m *Dep) IpTest() string {
    return "IpTest"
}
func (m *Dep) HttpTest() string {
    return "HttpTest"
}
func (m *Dep) HttpsTest() string {
    return "HttpsTest"
}
func (m *Dep) FooTest() string {
    return "HttpsTest"
}
split aurora
split aurora
#

Looking like it's the graphQL -> golang library and its set of initialisms. See in issue 👆

civic stone