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

text/template: chained nodes in pipe command arguments cause errors at runtime #8473

Closed
gopherbot opened this issue Aug 5, 2014 · 3 comments

Comments

@gopherbot
Copy link

by walken@google.com:

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

http://play.golang.org/p/AUK0RsmDNu

1. import text/template
2. parse template with a function whose argument is a chained node: {{.F (.G 42).X}}
3. execute that template

What happened?
template parsed without errors, but its Execute() function returned an error.

What should have happened instead?
the template should have printed the function's result - 42 in my example code.

Please provide any additional information below.
In text/template/exec.go, evalArg() needs to handle the parse.ChainNode case:

    case *parse.IdentifierNode:
        return s.evalFunction(dot, arg, arg, nil, zero)
+   case *parse.ChainNode:
+       return s.validateType(s.evalChainNode(dot, arg, nil, zero), typ)
    }
@dsymonds
Copy link
Contributor

dsymonds commented Aug 5, 2014

Comment 1:

Labels changed: added repo-main.

Owner changed to @robpike.

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 2:

CL https://golang.org/cl/142460043 mentions this issue.

@robpike
Copy link
Contributor

robpike commented Sep 23, 2014

Comment 3:

This issue was closed by revision 5d5e73b.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Was just a missing case (literally) in the type checker.

Fixes golang#8473.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/142460043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Was just a missing case (literally) in the type checker.

Fixes golang#8473.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/142460043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
Was just a missing case (literally) in the type checker.

Fixes golang#8473.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/142460043
@rsc rsc unassigned robpike Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants