VS Code doesn't detect unhandled errors written in GO

287 Views Asked by At

VSCode doesn't show a warning on unhandled error.

I've got this line of code:

defer resp.Body.Close()

which is market as unhandled error in GOLAND IDE but in VSCode I don't get similar nice warning as in GOLAND.

I've got golangci-lint as my linter, go extension installed, confugured linter in settings, got my linter file in the root directory of my project:

linters:
  enable:
    - errcheck
    - gofmt
    - govet
    - golint
    - gocyclo
    - ineffassign
    - structcheck
    - varcheck
    - deadcode
    - unconvert

linters-settings:
  errcheck:
    check-type-assertions: false
    check-blank: true

Got these settings in settings.json:

  "gopls": {
    "ui.semanticTokens": true
  },
  "[go]": {
    "editor.formatOnSave": true
    // "editor.defaultFormatter": "golang.go"
  },
  "go.lintTool": "golangci-lint",
  "go.lintFlags": ["--fast"]

Running golangci-lint run -v command also throws errors but not the one which I am expecting.

Only thing I could find is this issue on github, which I couldn't understand https://github.com/solo-io/gloo/issues/6686

0

There are 0 best solutions below