Created
May 22, 2015 17:30
-
-
Save oconnor663/b7987d336d99d6a17dfe to your computer and use it in GitHub Desktop.
Go's weird treatment of newlines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Foo struct { | |
Bar int | |
} | |
func main() { | |
var myfoo Foo | |
// Fine. | |
myfoo = Foo{5} | |
// Also fine. | |
myfoo = Foo{ | |
5, | |
} | |
// Breaks the build and gofmt. | |
myfoo = Foo{ | |
5 | |
} | |
fmt.Println("%#v", myfoo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/doodlemania2/2454f9ccab7d330f56a8