palantir / conjure-go-runtime

Go implementation of the Conjure runtime
Apache License 2.0
12 stars 22 forks source link

Errors only allow being registered once despite conjure allowing a package to be generated multiple times #561

Closed splucs closed 11 months ago

splucs commented 11 months ago

What happened?

In conjure-go errors can be registered with https://github.com/palantir/conjure-go-runtime/blob/develop/conjure-go-contract/errors/error_type_registry.go

I have a module G that generates a conjure package from an IR X that registers an error. The module has an exported package E that imports the generated conjure package.

If, in another module H, I generate a new conjure package from IR X and import E, the same error gets registered twice: one from the conjure generated package of X for module H and once in the vendor directory from the conjure generated package of X for module G. This results in a panic.

What did you want to happen?

Vendored packages should be able to use conjure packages that registers errors without conflicts with non-vendored packages. In other words, you should be able to export a package that has an import path to a conjure generated package.

splucs commented 11 months ago

Closing in favor of https://github.com/palantir/conjure-go/issues/415