-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker
Milestone
Description
Sample program:
package main
import (
"log"
"os"
"text/template"
)
const source = "{{(len .FileName) gt 0}}\n"
func main() {
t := template.Must(template.New("x").Parse(source))
s := struct{ FileName string }{"filename"}
if err := t.Execute(os.Stdout, &s); err != nil {
log.Fatal(err)
}
s = struct{ FileName string }{""}
if err := t.Execute(os.Stdout, &s); err != nil {
log.Fatal(err)
}
}Using Go 1.2 through Go 1.13 this prints
8
0
Using tip this fails:
2019/12/04 13:45:36 template: x:1:2: executing "x" at <(len .FileName) gt 0>: can't give argument to non-function len .FileName
This is due to https://golang.org/cl/206124 "text/template: add error check for parenthesized first argument in pipeline", which was written to fix #31810.
Unless this example is somehow incorrect, I think that we need to roll back that CL and try again for Go 1.15.
CC @robpike
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker