Skip to content

Commit

Permalink
[nogo] match regexp againts relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
scaiper committed Mar 20, 2024
1 parent aeb83e8 commit f42b52a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/tools/builders/nogo_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"io/ioutil"
"log"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
Expand Down Expand Up @@ -442,6 +443,10 @@ func checkAnalysisResults(actions []*action, pkg *goPackage) string {
}
var diagnostics []entry
var errs []error
cwd, err := os.Getwd()
if cwd == "" || err != nil {
errs = append(errs, fmt.Errorf("nogo failed to get CWD: %w", err))
}
for _, act := range actions {
if act.err != nil {
// Analyzer failed.
Expand Down Expand Up @@ -485,6 +490,11 @@ func checkAnalysisResults(actions []*action, pkg *goPackage) string {
if p.IsValid() {
filename = p.Filename
}
if cwd != "" {
if relname, err := filepath.Rel(cwd, filename); err == nil {
filename = relname
}
}
include := true
if len(currentConfig.onlyFiles) > 0 {
// This analyzer emits diagnostics for only a set of files.
Expand Down

0 comments on commit f42b52a

Please sign in to comment.