Skip to content

Allow removal of specific attributes from builtin module #445

Open
@lhopcroft123

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions