runtime
is a Starlark module provides Go and app runtime information.
Returns the uptime of the current process in time.duration
.
basic
Returns the uptime of the current process immediately.
load("runtime", "uptime")
print(uptime())
# Output: 883.583µs
Returns the value of the environment variable key as a string if it exists, or default if it doesn't.
basic
Returns the value of the environment variable PATH if it exists, or None if it doesn't.
load("runtime", "getenv")
print(getenv("PATH"))
# Output: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Sets the value of the environment variable named by the key, returning an error if any.
basic
Sets the environment variable STARLET_TEST
to the value 123456
.
load("runtime", "putenv")
putenv("STARLET_TEST", 123456)
Sets the value of the environment variable named by the key, returning an error if any.
Alias of putenv
.
basic
Sets the environment variable STARLET_TEST
to the value ABC
.
load("runtime", "setenv")
setenv("STARLET_TEST", "ABC")
Unsets a single environment variable.
basic
Unsets the environment variable STARLET_TEST.
load("runtime", "unsetenv")
unsetenv("STARLET_TEST")