*: misc fixes for go1.23 (#3663)

- skip staticcheck on go1.23 for now
- fix reading interface values in go1.23
- sync list of waitreasons from go1.23
This commit is contained in:
Alessandro Arzilli 2024-02-22 20:35:15 +01:00 committed by GitHub
parent ff2f69343e
commit 5bd835a801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 12 deletions

@ -45,14 +45,10 @@ type hmap struct {
}
type iface struct {
tab *itab
tab *itab|*internal/abi.ITab
data unsafe.Pointer
}
type itab struct {
_type *_type|*internal/abi.Type
}
type moduledata struct {
text uintptr
types uintptr

@ -459,7 +459,9 @@ func addCheckVarType(V, T string, pos token.Pos) {
}
func addCheckFieldType(S, F, T string, opt bool, pos token.Pos) {
checkFieldTypeRules[S] = append(checkFieldTypeRules[S], &checkFieldType{S, F, T, opt, pos})
if !strings.Contains(S, "|") {
checkFieldTypeRules[S] = append(checkFieldTypeRules[S], &checkFieldType{S, F, T, opt, pos})
}
}
func addCheckConstVal(C string, V constant.Value, pos token.Pos) {
@ -547,7 +549,6 @@ func check() {
allok := true
for _, rule := range checkVarTypeRules {
//TODO: implement
pos := fset.Position(rule.pos)
def := lookupPackage(pkgmap, "runtime").Types.Scope().Lookup(rule.V)
if def == nil {

@ -1303,6 +1303,9 @@ func TestVersion(t *testing.T) {
}
func TestStaticcheck(t *testing.T) {
if goversion.VersionAfterOrEqual(runtime.Version(), 1, 23) {
t.Skip("staticcheck does not support go1.23 yet")
}
_, err := exec.LookPath("staticcheck")
if err != nil {
t.Skip("staticcheck not installed")

@ -2272,7 +2272,7 @@ func (v *Variable) readInterface() (_type, data *Variable, isnil bool) {
ityp := resolveTypedef(&v.RealType.(*godwarf.InterfaceType).TypedefType).(*godwarf.StructType)
// +rtype -field iface.tab *itab
// +rtype -field iface.tab *itab|*internal/abi.ITab
// +rtype -field iface.data unsafe.Pointer
// +rtype -field eface._type *_type|*internal/abi.Type
// +rtype -field eface.data unsafe.Pointer
@ -2280,15 +2280,18 @@ func (v *Variable) readInterface() (_type, data *Variable, isnil bool) {
for _, f := range ityp.Field {
switch f.Name {
case "tab": // for runtime.iface
tab, _ := v.toField(f) // +rtype *itab
tab, _ := v.toField(f) // +rtype *itab|*internal/abi.ITab
tab = tab.maybeDereference()
isnil = tab.Addr == 0
if !isnil {
var err error
_type, err = tab.structMember("_type") // +rtype *_type|*internal/abi.Type
_type, err = tab.structMember("Type") // +rtype *internal/abi.Type
if err != nil {
v.Unreadable = fmt.Errorf("invalid interface type: %v", err)
return
_type, err = tab.structMember("_type") // +rtype *_type|*internal/abi.Type
if err != nil {
v.Unreadable = fmt.Errorf("invalid interface type: %v", err)
return
}
}
}
case "_type": // for runtime.eface

@ -1164,6 +1164,13 @@ var waitReasonStrings = [...]string{
"GC worker (idle)",
"preempted",
"debug call",
"GC mark termination",
"stopping the world",
"flushing proc caches",
"trace goroutine status",
"trace proc status",
"page trace flush",
"coroutine",
}
func writeGoroutineLong(t *Term, w io.Writer, g *api.Goroutine, prefix string) {