goplsgolint

How to disable unusedparam lint warning in vscode for my Golang project?


This is my warning details:

[{
    "resource": "/home/user/study/stduylint/main.go",
    "owner": "_generated_diagnostic_collection_name_#1",
    "code": {
        "value": "unusedparam",
        "target": {
            "$mid": 1,
            "external": "https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/unusedparams#unusedparam",
            "path": "/golang.org/x/tools/gopls/internal/analysis/unusedparams",
            "scheme": "https",
            "authority": "pkg.go.dev",
            "fragment": "unusedparam"
        }
    },
    "severity": 4,
    "message": "unused parameter: s1",
    "source": "unusedparams",
    "startLineNumber": 5,
    "startColumn": 12,
    "endLineNumber": 5,
    "endColumn": 14
}]

I just want to disable it in my project.


Solution

  • {
        "gopls": {
            "ui.diagnostic.analyses": { "unusedparams": false }
        }
    }