Benjamin Barrois
Benjamin Barrois

Reputation: 2686

Stricter lint of Golang in VSCode

I'm using VSCode for my Golang projects with the default lint settings, and I can't find a way to have a strict lint of my Go files, underlining the problems in the code, that would allow me to abide strictly to official Go guidelines, such as:

How to get strict linting behaviour in VSCode?

Upvotes: 3

Views: 1841

Answers (1)

fedonev
fedonev

Reputation: 25669

Yes you can. staticcheck is VSCode's default go linter.

Staticcheck's default configuration ignores certain rules. You can opt back in to all rules with your own staticcheck.conf with a checks=["all"] entry.

# https://staticcheck.io/docs/configuration

# checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023"]
checks = ["all"]
initialisms = ["ACL", "API", "ASCII", "CPU", "CSS", "DNS",
    "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID",
    "IP", "JSON", "QPS", "RAM", "RPC", "SLA",
    "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL",
    "UDP", "UI", "GID", "UID", "UUID", "URI",
    "URL", "UTF8", "VM", "XML", "XMPP", "XSRF",
    "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
dot_import_whitelist = []
http_status_code_whitelist = ["200", "400", "404", "500"]

Upvotes: 3

Related Questions