# Go
# Configuration - .deepsource.toml
This section covers configuration specific to the go
analyzer. Please make sure to read the general configuration guide first.
# name
- Type: String (opens new window)
- Presence: mandatory
- Description: Shortcode of the analyzer.
- Example:
name = "go"
# enabled
- Type: Boolean (opens new window)
- Presence: mandatory
- Description: Toggle whether this analyzer should be run.
- Example:
enabled = true
# meta
- Type: Table (opens new window)
- Presence: mandatory
- Description: Any supported metadata to pass to the analyzer.
- Example:
[analyzers.meta]
import_paths = ["github.com/coreos/rkt"]
# import_paths
- Type: Array (opens new window)
- Presence: mandatory
- Description: All the import paths in the repository should be mentioned in this array. If a repository is a monorepo with multiple Go projects, each project's import path must be mentioned.
- Available Value: None. Expects the project's import paths.
- Default Value: None.
- Example:
import_paths = ["github.com/deepsourcelabs/web-app/backend"]
# import_root
- Type: String (opens new window)
- Presence: optional
- Description: Repository source code will be placed in GOPATH/src/{import-root}.
- Available Value: None.
- Default Value: If only one import path is provided in the
import_paths
array, the import path is taken to be the import root. If multiple import paths are provided, or the import root is not the same as the import path, import root must be provided. - Example:
import_root = "github.com/deepsourcelabs/web-app"
# skip_doc_coverage
- Type: Array (opens new window)
- Presence: optional
- Description: Specify which artifacts to skip when calculating documentation coverage. Available values are
file
. - Available Value:
file
file
- Do not include file docs while calculating documentation coverage.
- Default Value: None.
- Example:
skip_doc_coverage = ["file"]
# dependencies_vendored
- Type: Boolean (opens new window)
- Presence: optional
- Description: If
true
, instructs the analyzer not to install dependencies, since they are already available in thevendor/
directory of the repository. - Available Values:
true
,false
- Default Value:
false
- Example:
[analyzers.meta]
dependencies_vendored = true
# build_tags
- Type: Array (opens new window)
- Presence: optional
- Description: Specify the build tags with which packages can be compiled. This prevents compilation-related issues due to inclusion/excusion of files based on tags.
- Default Value: None.
- Example:
build_tags = ["darwin"]
# cgo_enabled
- Type: Boolean (opens new window)
- Presence: optional
- Description: Whether the packages should be loaded with CGo modules. If the C code relies on external C libraries, they may not be present in the container that the analysis runs in. In that case, analysis may fail. If so, this flag can be set to
false
. - Available Values:
true
,false
- Default Value:
true
- Example:
cgo_enabled = false
# [DEPRECATED] import_path
- Type: String (opens new window)
- Presence: mandatory if
import_paths
is empty - Description: The import path of the repository should be mentioned in this string.
- Available Value: None. Expects the project's import path.
- Default Value: None.
- Example:
import_path = "github.com/deepsourcelabs/web-app/backend"
TIP
import_path
is now deprecated. It will still be used if import_paths
array is empty, for backward-compatibility. However, import_paths
should be used for all new configs, and it is highly recommended to remove this field and use import_paths
instead.
# Sample config
version = 1
test_patterns = [
"tests/*_test.go",
"**/*_test.go"
]
[[analyzers]]
name = "go"
enabled = true
[analyzers.meta]
import_paths = ["github.com/deepsourcelabs/web-app/backend"]
import_root = "github.com/deepsourcelabs/web-app"
dependencies_vendored = true
build_tags = ["darwin"]
cgo_enabled = false
# Package managers
We need to install your dependencies in order to get a full picture of your code for in-depth analysis. We detect the package manager from the file used for vendor versioning. We support the following package managers:
Filename | Package Manager |
---|---|
go.mod | go get |
Gopkg.lock | dep |
GLOCKFILE | glock |
Godeps/Godeps.json | godep |
dependencies.tsv | godeps |
glide.lock | glide |
vendor.conf | trash |
vendor.yml | trash |
vendor/manifest | gvt |
vendor/vendor.json | govendor |
No dependency file | No deps installed |
If the meta property dependencies_vendored
is set to true
, package installation is skipped.