Skip to content

runtime: avoid use of goprintf #8614

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

Closed
rsc opened this issue Aug 29, 2014 · 3 comments
Closed

runtime: avoid use of goprintf #8614

rsc opened this issue Aug 29, 2014 · 3 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Aug 29, 2014

goprintf is used for 'defer print'. It's not completely safe. See comment in print1.go
(introduced in CL 135930043).
@griesemer
Copy link
Contributor

Comment 1:

Labels changed: added repo-main.

@gopherbot
Copy link
Contributor

Comment 2:

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

@rsc
Copy link
Contributor Author

rsc commented Oct 29, 2014

Comment 3:

This issue was closed by revision 5e56854.

Status changed to Fixed.

@rsc rsc added fixed labels Oct 29, 2014
@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@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
goprintf is a printf-like print for Go.
It is used in the code generated by 'defer print(...)' and 'go print(...)'.

Normally print(1, 2, 3) turns into

        printint(1)
        printint(2)
        printint(3)

but defer and go need a single function call to give the runtime;
they give the runtime something like goprintf("%d%d%d", 1, 2, 3).

Variadic functions like goprintf cannot be described in the new
type information world, so we have to replace it.

Replace with a custom function, so that defer print(1, 2, 3) turns
into

        defer func(a1, a2, a3 int) {
                print(a1, a2, a3)
        }(1, 2, 3)

(and then the print becomes three different printints as usual).

Fixes golang#8614.

LGTM=austin
R=austin
CC=golang-codereviews, r
https://golang.org/cl/159700043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
goprintf is a printf-like print for Go.
It is used in the code generated by 'defer print(...)' and 'go print(...)'.

Normally print(1, 2, 3) turns into

        printint(1)
        printint(2)
        printint(3)

but defer and go need a single function call to give the runtime;
they give the runtime something like goprintf("%d%d%d", 1, 2, 3).

Variadic functions like goprintf cannot be described in the new
type information world, so we have to replace it.

Replace with a custom function, so that defer print(1, 2, 3) turns
into

        defer func(a1, a2, a3 int) {
                print(a1, a2, a3)
        }(1, 2, 3)

(and then the print becomes three different printints as usual).

Fixes golang#8614.

LGTM=austin
R=austin
CC=golang-codereviews, r
https://golang.org/cl/159700043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
goprintf is a printf-like print for Go.
It is used in the code generated by 'defer print(...)' and 'go print(...)'.

Normally print(1, 2, 3) turns into

        printint(1)
        printint(2)
        printint(3)

but defer and go need a single function call to give the runtime;
they give the runtime something like goprintf("%d%d%d", 1, 2, 3).

Variadic functions like goprintf cannot be described in the new
type information world, so we have to replace it.

Replace with a custom function, so that defer print(1, 2, 3) turns
into

        defer func(a1, a2, a3 int) {
                print(a1, a2, a3)
        }(1, 2, 3)

(and then the print becomes three different printints as usual).

Fixes golang#8614.

LGTM=austin
R=austin
CC=golang-codereviews, r
https://golang.org/cl/159700043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 20, 2018
goprintf is a printf-like print for Go.
It is used in the code generated by 'defer print(...)' and 'go print(...)'.

Normally print(1, 2, 3) turns into

        printint(1)
        printint(2)
        printint(3)

but defer and go need a single function call to give the runtime;
they give the runtime something like goprintf("%d%d%d", 1, 2, 3).

Variadic functions like goprintf cannot be described in the new
type information world, so we have to replace it.

Replace with a custom function, so that defer print(1, 2, 3) turns
into

        defer func(a1, a2, a3 int) {
                print(a1, a2, a3)
        }(1, 2, 3)

(and then the print becomes three different printints as usual).

Fixes golang#8614.

LGTM=austin
R=austin
CC=golang-codereviews, r
https://golang.org/cl/159700043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
goprintf is a printf-like print for Go.
It is used in the code generated by 'defer print(...)' and 'go print(...)'.

Normally print(1, 2, 3) turns into

        printint(1)
        printint(2)
        printint(3)

but defer and go need a single function call to give the runtime;
they give the runtime something like goprintf("%d%d%d", 1, 2, 3).

Variadic functions like goprintf cannot be described in the new
type information world, so we have to replace it.

Replace with a custom function, so that defer print(1, 2, 3) turns
into

        defer func(a1, a2, a3 int) {
                print(a1, a2, a3)
        }(1, 2, 3)

(and then the print becomes three different printints as usual).

Fixes golang#8614.

LGTM=austin
R=austin
CC=golang-codereviews, r
https://golang.org/cl/159700043
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