Skip to content

Commit d8ca5ee

Browse files
committed
feat: add an option
1 parent 0516e59 commit d8ca5ee

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.golangci.next.reference.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4740,6 +4740,10 @@ run:
47404740
# Default: ""
47414741
modules-download-mode: readonly
47424742

4743+
# Uses version control information during the loading of the package.
4744+
# Default: false (implies `-buildvcs=false`)
4745+
enable-build-vcs: true
4746+
47434747
# Allow multiple parallel golangci-lint instances running.
47444748
# If false, golangci-lint acquires file lock on start.
47454749
# Default: false

jsonschema/golangci.next.jsonschema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4618,6 +4618,10 @@
46184618
"description": "Option to pass to \"go list -mod={option}\".\nSee \"go help modules\" for more information.",
46194619
"enum": ["mod", "readonly", "vendor"]
46204620
},
4621+
"enable-build-vcs": {
4622+
"type": "boolean",
4623+
"default": false
4624+
},
46214625
"allow-parallel-runners": {
46224626
"description": "Allow multiple parallel golangci-lint instances running. If disabled, golangci-lint acquires file lock on start.",
46234627
"type": "boolean",

pkg/config/run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Run struct {
2121

2222
BuildTags []string `mapstructure:"build-tags"`
2323
ModulesDownloadMode string `mapstructure:"modules-download-mode"`
24+
EnableBuildVCS bool `mapstructure:"enable-build-vcs"`
2425

2526
ExitCodeIfIssuesFound int `mapstructure:"issues-exit-code"`
2627
AnalyzeTests bool `mapstructure:"tests"`

pkg/lint/package.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ func (l *PackageLoader) makeBuildFlags() []string {
230230
buildFlags = append(buildFlags, fmt.Sprintf("-mod=%s", l.cfg.Run.ModulesDownloadMode))
231231
}
232232

233-
// disable collecting VCS information
234-
buildFlags = append(buildFlags, "-buildvcs=false")
233+
if !l.cfg.Run.EnableBuildVCS {
234+
// disable collecting VCS information
235+
buildFlags = append(buildFlags, "-buildvcs=false")
236+
}
235237

236238
return buildFlags
237239
}

0 commit comments

Comments
 (0)