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: pointers to strings #5802

Closed
robpike opened this issue Jun 27, 2013 · 3 comments
Closed

text/template: pointers to strings #5802

robpike opened this issue Jun 27, 2013 · 3 comments
Milestone

Comments

@robpike
Copy link
Contributor

robpike commented Jun 27, 2013

package main

import (
    "os"
    "text/template"
)

type T struct {
    D *string
}

func main() {
    t, err := template.New("x").Parse("{{html .D}}")
    if err != nil { panic(err) }
    d := "hi\n"
    err = t.Execute(os.Stdout, T{&d})
    if err != nil { panic(err) }
}

One feels this should print "hi" but instead it prints the hex address of the
string. Ugly.

What should be done? Should functions autoindirect their args? Should template provide
an indirection operator? Tread carefully but fix.
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 1:

Labels changed: added go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 2:

Labels changed: added feature.

@robpike
Copy link
Contributor Author

robpike commented Aug 27, 2013

Comment 3:

This issue was closed by revision 1f661fc.

Status changed to Fixed.

@robpike robpike self-assigned this Aug 27, 2013
@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 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