Skip to content

Commit

Permalink
day 1 - add go fmt example
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanbekker committed Jun 16, 2020
1 parent 84029e2 commit d54f43b
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions go-detailed-log/day-01/04-go-fmt-package.md
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 ./..
```

0 comments on commit d54f43b

Please sign in to comment.