vscode编辑好go语言代码要怎么运行


当前第2页 返回上一页

启动vscode后选择 文件菜单 -> 首选项 -> 工作区设置
在打开的.vscode/settings.json文件,修改goroot和gopath

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

{

// Go configuration

    // Run 'go build'/'go test -c' on save.

    "go.buildOnSave": true,

    // Flags to `go build`/`go test` used during build-on-save or running tests. (e.g. ['-ldflags="-s"'])

    "go.buildFlags": [],

    // Run Lint tool on save.

    "go.lintOnSave": true,

    // Specifies Lint tool name.

    "go.lintTool": "golint",

    // Flags to pass to Lint tool (e.g. ['-min_confidenc=.8'])

    "go.lintFlags": [],

    // Run 'go tool vet' on save.

    "go.vetOnSave": true,

    // Flags to pass to `go tool vet` (e.g. ['-all', '-shadow'])

    "go.vetFlags": [],

    // Pick 'gofmt', 'goimports' or 'goreturns' to run on format.

    "go.formatTool": "goreturns",

    // Flags to pass to format tool (e.g. ['-s'])

    "go.formatFlags": [],

    // Run the formatting tools with the -d flag

    "go.useDiffForFormatting": true,

    // Complete functions with their parameter signature

    "go.useCodeSnippetsOnFunctionSuggest": false,

    // Specifies the GOPATH to use when no environment variable is set.

    "go.gopath": "//home/chenjianhua/gocode",

    // Specifies the GOROOT to use when no environment variable is set.

    "go.goroot": "/usr/local/go",

    // Run formatting tool on save.

    "go.formatOnSave": true,

    // Run 'go test -coverprofile' on save

    "go.coverOnSave": false,

    // Specifies the timeout for go test in ParseDuration format.

    "go.testTimeout": "30s",

    // Enable gocode's autobuild feature

    "go.gocodeAutoBuild": true,

    // The Go build tags to use for all commands that support a `-tags '...'` argument

    "go.buildTags": "",

    // Environment variables that will passed to the process that runs the Go tests

    "go.testEnvVars": {},

    // Autocomplete members from unimported packages.

    "go.autocompleteUnimportedPackages": true

}

vscode编辑器快捷键

命令面板 Ctrl + Shift + P 或者 F1

转到文件 Ctrl + P

切换终端 Ctrl + `

重命名 F2

调试 F5(continue)F10(step over)F11(step into)

跳到下一个有error或者warning的地方 F8

跳到function定义的地方 F12

缩放整个画面 Cmd +/Ctrl +

推荐学习:vscode教程

以上就是vscode编辑好go语言代码要怎么运行的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

vsCode如何创建代码模板

vsCode中安装和使用python插件

vsCode打开多个窗口的设置

vsCode如何新建css

vsCode提示找不到node路径

vsCode菜单栏与工具栏隐藏之后怎么找回来

vsCode免费吗

vsCode怎么配置git

vsCode打开文件中文乱码解决方法

几个你应该知道的vsCode配置和键绑定

更多相关阅读请进入《vsCode》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...