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, Date: date,
} }
if buildInfo, available := debug.ReadBuildInfo(); available { buildInfo, available := debug.ReadBuildInfo()
if !available {
return info
}
info.GoVersion = buildInfo.GoVersion info.GoVersion = buildInfo.GoVersion
if date == "" { if date != "" {
return info
}
info.Version = buildInfo.Main.Version info.Version = buildInfo.Main.Version
var revision string var revision string
var modified string var modified string
for _, setting := range buildInfo.Settings { for _, setting := range buildInfo.Settings {
// The `vcs.xxx` information is only available with `go build`. // 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 { switch setting.Key {
case "vcs.time": case "vcs.time":
info.Date = setting.Value 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) info.Commit = fmt.Sprintf("(%s, modified: %s, mod sum: %q)", revision, modified, buildInfo.Main.Sum)
}
}
return info return info
} }

View File

@ -167,7 +167,7 @@ Each phase corresponds to a minor version:
- v1.1.0 -> error message - v1.1.0 -> error message
- v1.2.0 -> linter removed - 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. 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 { if c.cfg.Run.Concurrency == 0 {
backup := runtime.GOMAXPROCS(0)
// Automatically set GOMAXPROCS to match Linux container CPU quota. // 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 { } else {
runtime.GOMAXPROCS(c.cfg.Run.Concurrency) 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 { func (p *Severity) transform(issue *result.Issue) *result.Issue {
for _, rule := range p.rules { for _, rule := range p.rules {
if rule.match(issue, p.files, p.log) { 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 return issue
} }