Commit 4949b735 authored by Philippe Lafoucrière's avatar Philippe Lafoucrière

Merge branch 'update-go-code-style-and-format' into 'master'

Use goimports instead of gofmt in go style guide

See merge request gitlab-org/gitlab!20424
parents 2ecb50e8 c5c36565
...@@ -70,8 +70,14 @@ projects: ...@@ -70,8 +70,14 @@ projects:
- Avoid global variables, even in packages. By doing so you will introduce side - Avoid global variables, even in packages. By doing so you will introduce side
effects if the package is included multiple times. effects if the package is included multiple times.
- Use `go fmt` before committing ([Gofmt](https://golang.org/cmd/gofmt/) is a - Use `goimports` before committing.
tool that automatically formats Go source code). [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports)
is a tool that automatically formats Go source code using
[Gofmt](https://golang.org/cmd/gofmt/), in addition to formatting import lines,
adding missing ones and removing unreferenced ones.
Most editors/IDEs will allow you to run commands before/after saving a file, you can set it
up to run `goimports` so that it's applied to every file when saving.
- Place private methods below the first caller method in the source file. - Place private methods below the first caller method in the source file.
### Automatic linting ### Automatic linting
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment