push
github
76 of 97 new or added lines in 4 files covered. (78.35%)
8 existing lines in 3 files now uncovered.7194 of 9658 relevant lines covered (74.49%)
688.4 hits per line
1 |
//go:build go1.23
|
|
2 |
|
|
3 |
package templates
|
|
4 |
|
|
5 |
import (
|
|
6 |
"fmt"
|
|
7 |
"go/types"
|
|
8 |
) |
|
9 |
|
|
|
func TypeIdentifier(t types.Type) string { |
1,222✔ |
|
res := ""
|
1,222✔ |
|
for {
|
3,115✔ |
|
switch it := t.(type) { |
1,893✔ |
|
case *types.Pointer:
|
425✔ |
|
t.Underlying() |
425✔ |
|
res += "ᚖ"
|
425✔ |
|
t = it.Elem() |
425✔ |
|
case *types.Slice:
|
246✔ |
|
res += "ᚕ"
|
246✔ |
|
t = it.Elem() |
246✔ |
|
case *types.Named:
|
535✔ |
|
res += pkgReplacer.Replace(it.Obj().Pkg().Path()) |
535✔ |
|
res += "ᚐ"
|
535✔ |
|
res += it.Obj().Name() |
535✔ |
|
return res
|
535✔ |
|
case *types.Basic:
|
683✔ |
|
res += it.Name() |
683✔ |
|
return res
|
683✔ |
|
case *types.Map:
|
4✔ |
|
res += "map"
|
4✔ |
|
return res
|
4✔ |
NEW
|
case *types.Interface:
|
× |
NEW
|
res += "interface"
|
× |
NEW
|
return res
|
× |
NEW
|
case *types.Alias:
|
× |
NEW
|
return TypeIdentifier(it.Rhs())
|
× |
NEW
|
default:
|
× |
NEW
|
panic(fmt.Errorf("unexpected type %T", it)) |
× |
39 |
} |
|
40 |
} |
|
41 |
} |