We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Jsonnet's function supports default argument.
https://jsonnet.org/learning/tutorial.html#functions
e.g.
// Default arguments are like Python: local my_function(x, y=10) = x + y;
https://pkg.go.dev/github.com/google/go-jsonnet@v0.20.0#NativeFunction
NativeFunction has a field Params, which a list of Identifier. Identifier represents a variable / parameter / field name. +gen set.
Params
https://pkg.go.dev/github.com/google/go-jsonnet@v0.20.0/ast#Identifier
I want to define a default argument, but is it possible?
I tried to add a default argument named opts, but it didn't work.
opts
Params: ast.Identifiers{"pattern", "s", "opts"},
If I omit the argument, the error RUNTIME ERROR: Missing argument: opts occurred.
RUNTIME ERROR: Missing argument: opts
I tried the following code, but it also didn't work. RUNTIME ERROR: Missing argument: opts={}
RUNTIME ERROR: Missing argument: opts={}
Params: ast.Identifiers{"pattern", "s", "opts={}"},
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Jsonnet's function supports default argument.
https://jsonnet.org/learning/tutorial.html#functions
e.g.
https://pkg.go.dev/github.com/google/go-jsonnet@v0.20.0#NativeFunction
NativeFunction has a field
Params
, which a list of Identifier.Identifier represents a variable / parameter / field name. +gen set.
https://pkg.go.dev/github.com/google/go-jsonnet@v0.20.0/ast#Identifier
I want to define a default argument, but is it possible?
I tried to add a default argument named
opts
, but it didn't work.If I omit the argument, the error
RUNTIME ERROR: Missing argument: opts
occurred.I tried the following code, but it also didn't work.
RUNTIME ERROR: Missing argument: opts={}
The text was updated successfully, but these errors were encountered: