Use of go fmt tool

The doc says that go fmt will reformat your code.
What does it reformat?
I have tried with a sample file but I did not understand what does it do.

It does reformat your code.

If you have code like this:

package main

import "fmt"

func main() {
fmt.Println(   "foo %s",
"bar",
)
}

Then go fmt will turn it into this:

package main

import "fmt"

func main() {
	fmt.Println("foo %s",
		"bar",
	)
}
2 Likes

Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.