Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct is not supported ("undefined: struct") #568

Open
wade-arista opened this issue Nov 27, 2024 · 2 comments
Open

struct is not supported ("undefined: struct") #568

wade-arista opened this issue Nov 27, 2024 · 2 comments

Comments

@wade-arista
Copy link

I was trying to load() paths.bzl from skylib:

$ go install go.starlark.net/cmd/starlark@latest
$ starlark paths.bzl
paths.bzl:309:9: undefined: struct
@adonovan
Copy link
Collaborator

It's not part of the standard language, but you can easily add it to your application's set of predeclared symbols with this line:

       predeclared["struct"] = starlark.NewBuiltin("struct", starlarkstruct.Make)

That said, cmd/starlark includes time and json in its default set, so perhaps it should struct too for convenience.

@wade-arista
Copy link
Author

Ah, thanks for that. I was trying to determine this before opening the issue, but I guess I didn't dig deep enough. Agreed that it would be a nice to have, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants