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

fmt: no padding applied to nil pointer for %v #14714

Closed
martisch opened this issue Mar 8, 2016 · 1 comment
Closed

fmt: no padding applied to nil pointer for %v #14714

martisch opened this issue Mar 8, 2016 · 1 comment
Milestone

Comments

@martisch
Copy link
Contributor

martisch commented Mar 8, 2016

go 1.6 (tip)

https://play.golang.org/p/2Uj0ZHSSLr

package main

import (
    "fmt"
)

func main() {
    fmt.Printf("|%12.8v|\n", (*int)(nil))
    fmt.Printf("|%12.8v|\n", nil)
    fmt.Printf("|%12.8v|\n", new(int))
}

Output:

|<nil>|
|       <nil>|
|  0x10434130|

would have expected padding also applies to (*int)(nil) as does with a non nil pointer.

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Mar 8, 2016
@gopherbot
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Mar 13, 2017
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