简体   繁体   中英

how skip file in golangci-lint?

I try go1.16

import "embed"

I get

> golangci-lint run ./...
> Can't run linter goanalysis_metalinter: bodyclose: failed prerequisites ... could not import embed

how skip file/package in golangci-lint?

Using a config file

You can customize the behavior with a config file. Docs are here https://golangci-lint.run/usage/configuration/ . Make a .golangci.yml file that looks like this:

run:
  skip-files:
    - main.go

//nolint

You can add //nolint to the top of the file.

//nolint
package foo

See https://golangci-lint.run/usage/false-positives/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM