Last active
September 18, 2015 09:35
-
-
Save taji-taji/5f100e0e0b29a0879f87 to your computer and use it in GitHub Desktop.
【Go】 go fmt でコード整形 ref: http://qiita.com/taji-taji/items/6d286bf4483a4c6ceed6
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
go fmt test.go |
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
「import(」->「import (」 | |
「func main(){」->「func main() {」 |
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( | |
"strings" | |
"fmt" | |
) | |
type T struct{ | |
name string // オブジェクトの名前 | |
value int // その値 | |
} | |
func main(){ | |
sum := 0 | |
for i:=1;i<=10;i++{ | |
if (i > 5) { | |
s := "iが6以上です" | |
fmt.Printf("%d\n", s) | |
fmt.Printf("%v\n", strings.Fields(s)) | |
} | |
sum += i | |
} | |
fmt.Printf("%d\n", sum) | |
} |
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" | |
"strings" | |
) | |
type T struct { | |
name string // オブジェクトの名前 | |
value int // その値 | |
} | |
func main() { | |
sum := 0 | |
for i := 1; i <= 10; i++ { | |
if i > 5 { | |
s := "iが6以上です" | |
fmt.Printf("%d\n", s) | |
fmt.Printf("%v\n", strings.Fields(s)) | |
} | |
sum += i | |
} | |
fmt.Printf("%d\n", sum) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment