mirror of https://github.com/status-im/consul.git
Merge pull request #12632 from hashicorp/kisunji-patch-1
Add example of goimports -local to contributing docs
This commit is contained in:
commit
fb3a4a5db5
|
@ -85,6 +85,25 @@ To build Consul, run `make dev`. In a few moments, you'll have a working
|
||||||
Go provides [tooling to apply consistent code formatting](https://golang.org/doc/effective_go#formatting).
|
Go provides [tooling to apply consistent code formatting](https://golang.org/doc/effective_go#formatting).
|
||||||
If you make any changes to the code, run `gofmt -s -w` to automatically format the code according to Go standards.
|
If you make any changes to the code, run `gofmt -s -w` to automatically format the code according to Go standards.
|
||||||
|
|
||||||
|
##### Organizing Imports
|
||||||
|
|
||||||
|
Group imports using `goimports -local github.com/hashicorp/consul/` to keep [local packages](https://github.com/golang/tools/commit/ed69e84b1518b5857a9f4e01d1f9cefdcc45246e) in their own section.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/hashicorp/go-cleanhttp"
|
||||||
|
"github.com/mitchellh/mapstructure"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/api"
|
||||||
|
"github.com/hashicorp/consul/lib"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
#### Updating Go Module Dependencies
|
#### Updating Go Module Dependencies
|
||||||
|
|
||||||
If a dependency is added or change, run `go mod tidy` to update `go.mod` and `go.sum`.
|
If a dependency is added or change, run `go mod tidy` to update `go.mod` and `go.sum`.
|
||||||
|
@ -148,4 +167,4 @@ When you're ready to submit a pull request:
|
||||||
|
|
||||||
Some common changes that many PRs require are documented through checklists as
|
Some common changes that many PRs require are documented through checklists as
|
||||||
`checklist-*.md` files in [docs/](../docs/), including:
|
`checklist-*.md` files in [docs/](../docs/), including:
|
||||||
- [Adding config fields](../docs/config/checklist-adding-config-fields.md)
|
- [Adding config fields](../docs/config/checklist-adding-config-fields.md)
|
||||||
|
|
Loading…
Reference in New Issue