Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.12 KB

configuration.mdx

File metadata and controls

53 lines (36 loc) · 2.12 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 linters enabled by your configuration use:

golangci-lint linters

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.reference.yml file with all supported options, their description, and default values. This file is a neither a working example nor recommended configuration, it's just a reference to display all the configuration options.

{ .ConfigurationExample }

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.

Cache

GolangCI-Lint stores its cache in the default user cache directory.

You can override the default cache directory with the environment variable GOLANGCI_LINT_CACHE; the path must be absolute.