Skip to content

text/template: should eq permit comparison of signed and unsigned integers #7489

@robpike

Description

@robpike
Consider this example: 

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

import "os"
import "text/template"

func main() {
    template.Must(template.New("test").Parse(`{{printf "%T %T" (index . 0) 'a'}}`)).Execute(os.Stdout, "abc")
}


It prints uint8 int, which prevents using eq from comparing a byte to a rune constant,
so one can't do
    {{eq (index . 0) 'a'}}
Perhaps comparisons between signed and unsigned integer values should be OK if the sign
is positive, or maybe even always.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions