Skip to content

Commit f641be9

Browse files
committed
package.json: change the default format tool to goimports
Module mode is the default since go1.16. Still left it as an option for users who still work with different build systems that operate in GOPATH mode. Fixes #192 Change-Id: I162e30088fe94d4ea47f2d8d17cb2aaad830b9a5 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/300431 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent ac61291 commit f641be9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Flags to pass to format tool (e.g. ["-s"]). Not applicable when using the langua
235235
Not applicable when using the language server. Choosing 'goimports', 'goreturns', or 'gofumports' will add missing imports and remove unused imports.<br/>
236236
Allowed Options: `gofmt`, `goimports`, `goreturns`, `goformat`, `gofumpt`, `gofumports`
237237

238-
Default: `"goreturns"`
238+
Default: `"goimports"`
239239
### `go.generateTestsFlags`
240240

241241
Additional command line flags to pass to `gotests` for generating tests.

docs/tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ It can also be used to provide the [go to definition](features.md#go-to-definiti
116116

117117
* [`gogetdoc`], [`godef`], [`godoc`]: these are documentation tools used for the [go to definition](features.md#go-to-definition), [signature help](features.md#signature-help), and [quick info on hover](features.md#quick-info-on-hover) in the legacy mode. [`guru`](#guru) can also be used, but only for the [go to definition](features.md#go-to-definition) behavior. Configure this via the [`"go.docsTool"`](settings.md#go.docsTool) setting.
118118

119-
* [`goreturns`], [`gofmt`], [`goimports`]: Formatting tools are used by the [formatting and import organization](features.md#format-and-organize-imports) features. [`goreturns`] is used by default in the legacy mode. It formats the file according to the industry standard [`gofmt`] style, organizes imports, and fills in default return values for functions. Other tools can be used for formatting instead; this can be configured with the [`"go.go.formatTool"`](settings.md#formatTool) setting. Note that [`goreturns`] does not have support for Go modules.
119+
* [`goimports`], [`gofmt`]: Formatting tools are used by the [formatting and import organization](features.md#format-and-organize-imports) features. [`goreturns`] is used by default in the legacy mode. It formats the file according to the industry standard [`gofmt`] style, organizes imports, and fills in default return values for functions. Other tools can be used for formatting instead; this can be configured with the [`"go.go.formatTool"`](settings.md#formatTool) setting.
120120

121-
* [`goimports`], which applies the default `gofmt` style and organizes imports, but without the behavior of filling in default return values
122121
* [`gofmt`] only formats the file, without import organization or filling in return values
123122
* [`goformat`] is a configurable version of [`gofmt`]
123+
* [`goreturns`] fills in default return values for functions, in addition to applying `goimports`-style formatting. This tool does not have support for Go modules.
124124

125125
* Diagnostics tools: By default, [`gotype-live`], [`go vet`], and [`golint`] are used to provide [build](features.md#build-errors), [vet](features.md#vet-errors), and [lint](features.md#lint-errors) errors. [`gotype-live`] provides build errors as you type, while `go build` can be used to show build errors only on save. [`gotype-live`] does not work with modules.
126126

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@
10181018
},
10191019
"go.formatTool": {
10201020
"type": "string",
1021-
"default": "goreturns",
1021+
"default": "goimports",
10221022
"description": "Not applicable when using the language server. Choosing 'goimports', 'goreturns', or 'gofumports' will add missing imports and remove unused imports.",
10231023
"scope": "resource",
10241024
"enum": [

0 commit comments

Comments
 (0)