Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.98 KB

configuration.mdx

File metadata and controls

56 lines (40 loc) · 1.98 KB
title
Configuration

The config file has lower priority than command-line options. If the same bool/string/int option is provided on the command-line and in the config file, the option from command-line will be used. Slice options (e.g. list of enabled/disabled linters) are combined from the command-line and config file.

To see a list of enabled by your configuration linters:

golangci-lint linters

Command-Line Options

golangci-lint run -h
{.RunHelpText}

When the --cpu-profile-path or --mem-profile-path arguments are specified, golangci-lint writes runtime profiling data in the format expected by the pprof visualization tool.

When the --trace-path argument is specified, golangci-lint writes runtime tracing data in the format expected by the go tool trace command and visualization tool.

Config File

GolangCI-Lint looks for config files in the following paths from the current working directory:

  • .golangci.yml
  • .golangci.yaml
  • .golangci.toml
  • .golangci.json

GolangCI-Lint also searches for config files in all directories from the directory of the first analyzed path up to the root. If no configuration file has been found, GolangCI-Lint will try to find one in your home directory. To see which config file is being used and where it was sourced from run golangci-lint with -v option.

Config options inside the file are identical to command-line options. You can configure specific linters' options only within the config file (not the command-line).

There is a .golangci.example.yml example config file with all supported options, their description and default value:

{ .GolangciYamlExample }

It's a .golangci.yml config file of this repo: we enable more linters than the default and have more strict settings:

{ .GolangciYaml }