correctly mark new actors as "important"

This commit is contained in:
Steven Allen 2020-10-13 22:10:37 -07:00
parent 0c2ec04c09
commit 9d15a08d27

View File

@ -3,6 +3,7 @@ package types
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"regexp"
"runtime" "runtime"
"strings" "strings"
"time" "time"
@ -68,11 +69,10 @@ func (l Loc) String() string {
return fmt.Sprintf("%s@%s:%d", fnpkg, file[len(file)-1], l.Line) return fmt.Sprintf("%s@%s:%d", fnpkg, file[len(file)-1], l.Line)
} }
var importantRegex = regexp.MustCompile(`github.com/filecoin-project/specs-actors/(v\d+/)?actors/builtin`)
func (l Loc) Important() bool { func (l Loc) Important() bool {
if strings.HasPrefix(l.Function, "github.com/filecoin-project/specs-actors/actors/builtin") { return importantRegex.MatchString(l.Function)
return true
}
return false
} }
func (gt *GasTrace) MarshalJSON() ([]byte, error) { func (gt *GasTrace) MarshalJSON() ([]byte, error) {