forked from kallaway/100-days-of-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84029e2
commit d54f43b
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# go fmt command | ||
|
||
The go fmt command formats your code, which allows a consistent standard of formatting | ||
|
||
The go fmt command and fmt package are two different things | ||
|
||
## Pronounciation | ||
|
||
go fmt is pronounced as "go fumt" | ||
|
||
## Example formatting | ||
|
||
Create a file with strange formatted style: | ||
|
||
``` | ||
$ cat app.go | ||
package main | ||
import "fmt" | ||
func main(){ | ||
fmt.Println("hello") | ||
} | ||
``` | ||
|
||
After we run `go fmt` on our code, we will notice its formatted: | ||
|
||
``` | ||
$ go fmt app.go | ||
app.go | ||
``` | ||
|
||
Verify that the code was formatted: | ||
|
||
``` | ||
$ cat app.go | ||
package main | ||
import "fmt" | ||
func main() { | ||
fmt.Println("hello") | ||
} | ||
``` | ||
|
||
To run this with a bunch of files, in the current working directory: | ||
|
||
``` | ||
$ go fmt ./.. | ||
``` |