dev: minor clean up (#4492)

This commit is contained in:
Ludovic Fernandez 2024-03-12 23:38:14 +01:00 committed by GitHub
parent 331d29bee3
commit 0554536620
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 44 additions and 34 deletions

View File

@ -35,17 +35,24 @@ func createBuildInfo() commands.BuildInfo {
Date: date,
}
if buildInfo, available := debug.ReadBuildInfo(); available {
buildInfo, available := debug.ReadBuildInfo()
if !available {
return info
}
info.GoVersion = buildInfo.GoVersion
if date == "" {
if date != "" {
return info
}
info.Version = buildInfo.Main.Version
var revision string
var modified string
for _, setting := range buildInfo.Settings {
// The `vcs.xxx` information is only available with `go build`.
// This information is are not available with `go install` or `go run`.
// This information is not available with `go install` or `go run`.
switch setting.Key {
case "vcs.time":
info.Date = setting.Value
@ -69,8 +76,6 @@ func createBuildInfo() commands.BuildInfo {
}
info.Commit = fmt.Sprintf("(%s, modified: %s, mod sum: %q)", revision, modified, buildInfo.Main.Sum)
}
}
return info
}

View File

@ -167,7 +167,7 @@ Each phase corresponds to a minor version:
- v1.1.0 -> error message
- v1.2.0 -> linter removed
Otherwise, the deprecated linters are removed from presets immediately when they are deprecated (phase 1).
The deprecated linters are removed from presets immediately when they are deprecated (phase 1).
We will provide clear information about those changes on different supports: changelog, logs, social network, etc.

View File

@ -159,8 +159,13 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, _ []string) error {
}
if c.cfg.Run.Concurrency == 0 {
backup := runtime.GOMAXPROCS(0)
// Automatically set GOMAXPROCS to match Linux container CPU quota.
_, _ = maxprocs.Set(maxprocs.Logger(c.log.Infof))
_, err := maxprocs.Set(maxprocs.Logger(c.log.Infof))
if err != nil {
runtime.GOMAXPROCS(backup)
}
} else {
runtime.GOMAXPROCS(c.cfg.Run.Concurrency)
}

View File

@ -69,7 +69,7 @@ func (p *Severity) Process(issues []result.Issue) ([]result.Issue, error) {
func (p *Severity) transform(issue *result.Issue) *result.Issue {
for _, rule := range p.rules {
if rule.match(issue, p.files, p.log) {
if rule.severity == severityFromLinter || rule.severity == "" && p.defaultSeverity == severityFromLinter {
if rule.severity == severityFromLinter || (rule.severity == "" && p.defaultSeverity == severityFromLinter) {
return issue
}