Skip to content

go: enable user to configure the package name for generated types #1494

@asteurer

Description

@asteurer

It would be really nice to be able to run a command like wit-bindgen go --pkg github.com/foo/bar/v1 and have the generated types prepend the custom package to the wit_component path:

import "github.com/foo/bar/v1/wit_component/wasi_http_0_2_0_types"

As part of this, we will probably want to alter the wit_bindings.go file:

// Instead of "package main"
package wit_component

This would be helpful for cases where an SDK wants to make use of the bindings, but doesn't want to expose the bindings to a user (see this version of the spin-go-sdk as an example).

If there's a better way to do this, I'm also open to other suggestions.

@dicej if this is something you would like to move forward with, will you assign this to me, please?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions