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

Allow removal of specific attributes from builtin module #445

Open
lhopcroft123 opened this issue Apr 23, 2024 · 0 comments · May be fixed by #446
Open

Allow removal of specific attributes from builtin module #445

lhopcroft123 opened this issue Apr 23, 2024 · 0 comments · May be fixed by #446

Comments

@lhopcroft123
Copy link

Similarly to #319 (comment) I'd like to be able to use the "times" module from the stdlib but I don't want to allow script authors to call times.sleep and block the goroutine that is running the script for an arbitrarily long time. At the moment, the only way to do this that I can see is to copy/paste the contents of times.go to my own package and delete the sleep function from the file and module map, and then add that module instead of the stdlib one. Obviously this isn't a great solution.

I think it would be useful to allow removing specific attributes (e.g. functions) from a built in module via the ModuleMap e.g. by changing the .Remove(name string) method to be .Remove(name string, attrNames ...string). This would be a non-breaking change to the API due to the use of variadic args for the attrNames.

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

Successfully merging a pull request may close this issue.

1 participant