我正在使用VS代码和来自lukehoban的Go扩展程序:
https://github.com/Microsoft/vscode-go
在保存文件时似乎运行了golint,在我开始输入时,有没有办法让golint运行?通常linting在我们输入其他扩展和语言(例如jslint和VSl上的tslint)时发生。很高兴有选择也可以用golint做到这一点。
我能做些什么来实现这个目标?
答案 0 :(得分:2)
Go的这一面让我发疯...
因此,我找到了一个名为“ go.useLanguageServer”的选项(很可能是我早些时候找到的,但是由于某种原因,找到该选项并不容易)。
library(data.table)
library(tidyverse)
set.seed(100)
dat=data.frame(G1=sample(LETTERS[1:3],200,replace=TRUE),
G2=sample(LETTERS[10:13],200,replace=TRUE),
G3=sample(LETTERS[16:18],200,replace=TRUE),
Month=rep(month.name[1:4],50),
City=rep(c("LA","NYC","Charlotte","Bloomington"),50),
var_1=sample.int(200,200),var_2=sample.int(200,200))
cityWide=dcast(setDT(dat), G1+G2+G3~ City,value.var="var_1",fill = 0L,fun.aggregate = sum)
monthWide=dcast(setDT(dat), G1+G2+G3~ Month,value.var="var_1",fill = 0L,fun.aggregate = sum)
wideData=cityWide %>% inner_join(monthWide,by=c("G1","G2","G3"))
此外,还有以下选项:
"go.useLanguageServer": true,
答案 1 :(得分:1)
似乎根本不可能。
关于golint的唯一可用配置是:
// Run Lint tool on save.
"go.lintOnSave": true,
// Specifies Lint tool name.
"go.lintTool": "golint",
// Flags to pass to Lint tool (e.g. ["-min_confidence=.8"])
"go.lintFlags": [],
也许你可以通过改变这些选项来解决这个问题:
// Controls auto save of dirty files. Accepted values: "off", "afterDelay", "onFocusChange" (editor loses focus), "onWindowChange" (window loses focus). If set to "afterDelay", you can configure the delay in "files.autoSaveDelay".
"files.autoSave": "off",
// Controls the delay in ms after which a dirty file is saved automatically. Only applies when "files.autoSave" is set to "afterDelay"
"files.autoSaveDelay": 1000,
您可以将files.autoSave
设置为afterDelay
,将files.autoSaveDelay
设置为# get counts for entire list and order them
myRanks <- sort(table(unlist(out)), decreasing=TRUE)
。