---
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:

```bash
golangci-lint linters
```

To see a list of formatters enabled by your configuration use:

```bash
golangci-lint formatters
```

## 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`](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml) file with all supported options, their description, and default values.
This file is neither a working example nor a recommended configuration, it's just a reference to display all the configuration options.

The configuration file can be validated with the JSON Schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json

{ .ConfigurationExample }

## Command-Line Options

### run

```sh
$ 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](https://github.com/google/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.

### fmt

```sh
$ golangci-lint fmt -h
{.FmtHelpText}
```

## Cache

Golangci-lint stores its cache in the subdirectory `golangci-lint` inside the [default user cache directory](https://pkg.go.dev/os#UserCacheDir).

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