mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
update to golang.org/x/net/html (slow parsing fixed) and other golang.org/x deps
This commit is contained in:
parent
d082aaada8
commit
aa9a06680f
107 changed files with 4510 additions and 1055 deletions
14
go.mod
14
go.mod
|
@ -14,10 +14,10 @@ require (
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.18.0
|
||||||
github.com/russross/blackfriday/v2 v2.1.0
|
github.com/russross/blackfriday/v2 v2.1.0
|
||||||
go.etcd.io/bbolt v1.3.11
|
go.etcd.io/bbolt v1.3.11
|
||||||
golang.org/x/crypto v0.27.0
|
golang.org/x/crypto v0.31.0
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||||
golang.org/x/net v0.29.0
|
golang.org/x/net v0.33.0
|
||||||
golang.org/x/text v0.18.0
|
golang.org/x/text v0.21.0
|
||||||
rsc.io/qr v0.2.0
|
rsc.io/qr v0.2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ require (
|
||||||
github.com/prometheus/client_model v0.5.0 // indirect
|
github.com/prometheus/client_model v0.5.0 // indirect
|
||||||
github.com/prometheus/common v0.45.0 // indirect
|
github.com/prometheus/common v0.45.0 // indirect
|
||||||
github.com/prometheus/procfs v0.12.0 // indirect
|
github.com/prometheus/procfs v0.12.0 // indirect
|
||||||
golang.org/x/mod v0.21.0 // indirect
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/sync v0.10.0 // indirect
|
||||||
golang.org/x/sys v0.25.0 // indirect
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
golang.org/x/tools v0.25.0 // indirect
|
golang.org/x/tools v0.28.0 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
28
go.sum
28
go.sum
|
@ -73,35 +73,35 @@ go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||||
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||||
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
||||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
|
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
|
||||||
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
|
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
7
vendor/golang.org/x/net/html/doc.go
generated
vendored
7
vendor/golang.org/x/net/html/doc.go
generated
vendored
|
@ -78,16 +78,11 @@ example, to process each anchor node in depth-first order:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
var f func(*html.Node)
|
for n := range doc.Descendants() {
|
||||||
f = func(n *html.Node) {
|
|
||||||
if n.Type == html.ElementNode && n.Data == "a" {
|
if n.Type == html.ElementNode && n.Data == "a" {
|
||||||
// Do something with n...
|
// Do something with n...
|
||||||
}
|
}
|
||||||
for c := n.FirstChild; c != nil; c = c.NextSibling {
|
|
||||||
f(c)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
f(doc)
|
|
||||||
|
|
||||||
The relevant specifications include:
|
The relevant specifications include:
|
||||||
https://html.spec.whatwg.org/multipage/syntax.html and
|
https://html.spec.whatwg.org/multipage/syntax.html and
|
||||||
|
|
2
vendor/golang.org/x/net/html/doctype.go
generated
vendored
2
vendor/golang.org/x/net/html/doctype.go
generated
vendored
|
@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
|
if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
|
||||||
strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {
|
strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
|
||||||
quirks = true
|
quirks = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
vendor/golang.org/x/net/html/foreign.go
generated
vendored
3
vendor/golang.org/x/net/html/foreign.go
generated
vendored
|
@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool {
|
||||||
if n.Data == "annotation-xml" {
|
if n.Data == "annotation-xml" {
|
||||||
for _, a := range n.Attr {
|
for _, a := range n.Attr {
|
||||||
if a.Key == "encoding" {
|
if a.Key == "encoding" {
|
||||||
val := strings.ToLower(a.Val)
|
if strings.EqualFold(a.Val, "text/html") || strings.EqualFold(a.Val, "application/xhtml+xml") {
|
||||||
if val == "text/html" || val == "application/xhtml+xml" {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
56
vendor/golang.org/x/net/html/iter.go
generated
vendored
Normal file
56
vendor/golang.org/x/net/html/iter.go
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.23
|
||||||
|
|
||||||
|
package html
|
||||||
|
|
||||||
|
import "iter"
|
||||||
|
|
||||||
|
// Ancestors returns an iterator over the ancestors of n, starting with n.Parent.
|
||||||
|
//
|
||||||
|
// Mutating a Node or its parents while iterating may have unexpected results.
|
||||||
|
func (n *Node) Ancestors() iter.Seq[*Node] {
|
||||||
|
_ = n.Parent // eager nil check
|
||||||
|
|
||||||
|
return func(yield func(*Node) bool) {
|
||||||
|
for p := n.Parent; p != nil && yield(p); p = p.Parent {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChildNodes returns an iterator over the immediate children of n,
|
||||||
|
// starting with n.FirstChild.
|
||||||
|
//
|
||||||
|
// Mutating a Node or its children while iterating may have unexpected results.
|
||||||
|
func (n *Node) ChildNodes() iter.Seq[*Node] {
|
||||||
|
_ = n.FirstChild // eager nil check
|
||||||
|
|
||||||
|
return func(yield func(*Node) bool) {
|
||||||
|
for c := n.FirstChild; c != nil && yield(c); c = c.NextSibling {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Descendants returns an iterator over all nodes recursively beneath
|
||||||
|
// n, excluding n itself. Nodes are visited in depth-first preorder.
|
||||||
|
//
|
||||||
|
// Mutating a Node or its descendants while iterating may have unexpected results.
|
||||||
|
func (n *Node) Descendants() iter.Seq[*Node] {
|
||||||
|
_ = n.FirstChild // eager nil check
|
||||||
|
|
||||||
|
return func(yield func(*Node) bool) {
|
||||||
|
n.descendants(yield)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *Node) descendants(yield func(*Node) bool) bool {
|
||||||
|
for c := range n.ChildNodes() {
|
||||||
|
if !yield(c) || !c.descendants(yield) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
4
vendor/golang.org/x/net/html/node.go
generated
vendored
4
vendor/golang.org/x/net/html/node.go
generated
vendored
|
@ -38,6 +38,10 @@ var scopeMarker = Node{Type: scopeMarkerNode}
|
||||||
// that it looks like "a<b" rather than "a<b". For element nodes, DataAtom
|
// that it looks like "a<b" rather than "a<b". For element nodes, DataAtom
|
||||||
// is the atom for Data, or zero if Data is not a known tag name.
|
// is the atom for Data, or zero if Data is not a known tag name.
|
||||||
//
|
//
|
||||||
|
// Node trees may be navigated using the link fields (Parent,
|
||||||
|
// FirstChild, and so on) or a range loop over iterators such as
|
||||||
|
// [Node.Descendants].
|
||||||
|
//
|
||||||
// An empty Namespace implies a "http://www.w3.org/1999/xhtml" namespace.
|
// An empty Namespace implies a "http://www.w3.org/1999/xhtml" namespace.
|
||||||
// Similarly, "math" is short for "http://www.w3.org/1998/Math/MathML", and
|
// Similarly, "math" is short for "http://www.w3.org/1998/Math/MathML", and
|
||||||
// "svg" is short for "http://www.w3.org/2000/svg".
|
// "svg" is short for "http://www.w3.org/2000/svg".
|
||||||
|
|
8
vendor/golang.org/x/net/html/parse.go
generated
vendored
8
vendor/golang.org/x/net/html/parse.go
generated
vendored
|
@ -840,6 +840,10 @@ func afterHeadIM(p *parser) bool {
|
||||||
|
|
||||||
p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
|
p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
|
||||||
p.framesetOK = true
|
p.framesetOK = true
|
||||||
|
if p.tok.Type == ErrorToken {
|
||||||
|
// Stop parsing.
|
||||||
|
return true
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,7 +1035,7 @@ func inBodyIM(p *parser) bool {
|
||||||
if p.tok.DataAtom == a.Input {
|
if p.tok.DataAtom == a.Input {
|
||||||
for _, t := range p.tok.Attr {
|
for _, t := range p.tok.Attr {
|
||||||
if t.Key == "type" {
|
if t.Key == "type" {
|
||||||
if strings.ToLower(t.Val) == "hidden" {
|
if strings.EqualFold(t.Val, "hidden") {
|
||||||
// Skip setting framesetOK = false
|
// Skip setting framesetOK = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1459,7 +1463,7 @@ func inTableIM(p *parser) bool {
|
||||||
return inHeadIM(p)
|
return inHeadIM(p)
|
||||||
case a.Input:
|
case a.Input:
|
||||||
for _, t := range p.tok.Attr {
|
for _, t := range p.tok.Attr {
|
||||||
if t.Key == "type" && strings.ToLower(t.Val) == "hidden" {
|
if t.Key == "type" && strings.EqualFold(t.Val, "hidden") {
|
||||||
p.addElement()
|
p.addElement()
|
||||||
p.oe.pop()
|
p.oe.pop()
|
||||||
return true
|
return true
|
||||||
|
|
2
vendor/golang.org/x/net/websocket/websocket.go
generated
vendored
2
vendor/golang.org/x/net/websocket/websocket.go
generated
vendored
|
@ -8,7 +8,7 @@
|
||||||
// This package currently lacks some features found in an alternative
|
// This package currently lacks some features found in an alternative
|
||||||
// and more actively maintained WebSocket package:
|
// and more actively maintained WebSocket package:
|
||||||
//
|
//
|
||||||
// https://pkg.go.dev/nhooyr.io/websocket
|
// https://pkg.go.dev/github.com/coder/websocket
|
||||||
package websocket // import "golang.org/x/net/websocket"
|
package websocket // import "golang.org/x/net/websocket"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
17
vendor/golang.org/x/sys/cpu/asm_darwin_x86_gc.s
generated
vendored
Normal file
17
vendor/golang.org/x/sys/cpu/asm_darwin_x86_gc.s
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_sysctl(SB)
|
||||||
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_sysctlbyname_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_sysctlbyname(SB)
|
||||||
|
GLOBL ·libc_sysctlbyname_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_sysctlbyname_trampoline_addr(SB)/8, $libc_sysctlbyname_trampoline<>(SB)
|
61
vendor/golang.org/x/sys/cpu/cpu_darwin_x86.go
generated
vendored
Normal file
61
vendor/golang.org/x/sys/cpu/cpu_darwin_x86.go
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
// darwinSupportsAVX512 checks Darwin kernel for AVX512 support via sysctl
|
||||||
|
// call (see issue 43089). It also restricts AVX512 support for Darwin to
|
||||||
|
// kernel version 21.3.0 (MacOS 12.2.0) or later (see issue 49233).
|
||||||
|
//
|
||||||
|
// Background:
|
||||||
|
// Darwin implements a special mechanism to economize on thread state when
|
||||||
|
// AVX512 specific registers are not in use. This scheme minimizes state when
|
||||||
|
// preempting threads that haven't yet used any AVX512 instructions, but adds
|
||||||
|
// special requirements to check for AVX512 hardware support at runtime (e.g.
|
||||||
|
// via sysctl call or commpage inspection). See issue 43089 and link below for
|
||||||
|
// full background:
|
||||||
|
// https://github.com/apple-oss-distributions/xnu/blob/xnu-11215.1.10/osfmk/i386/fpu.c#L214-L240
|
||||||
|
//
|
||||||
|
// Additionally, all versions of the Darwin kernel from 19.6.0 through 21.2.0
|
||||||
|
// (corresponding to MacOS 10.15.6 - 12.1) have a bug that can cause corruption
|
||||||
|
// of the AVX512 mask registers (K0-K7) upon signal return. For this reason
|
||||||
|
// AVX512 is considered unsafe to use on Darwin for kernel versions prior to
|
||||||
|
// 21.3.0, where a fix has been confirmed. See issue 49233 for full background.
|
||||||
|
func darwinSupportsAVX512() bool {
|
||||||
|
return darwinSysctlEnabled([]byte("hw.optional.avx512f\x00")) && darwinKernelVersionCheck(21, 3, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure Darwin kernel version is at least major.minor.patch, avoiding dependencies
|
||||||
|
func darwinKernelVersionCheck(major, minor, patch int) bool {
|
||||||
|
var release [256]byte
|
||||||
|
err := darwinOSRelease(&release)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var mmp [3]int
|
||||||
|
c := 0
|
||||||
|
Loop:
|
||||||
|
for _, b := range release[:] {
|
||||||
|
switch {
|
||||||
|
case b >= '0' && b <= '9':
|
||||||
|
mmp[c] = 10*mmp[c] + int(b-'0')
|
||||||
|
case b == '.':
|
||||||
|
c++
|
||||||
|
if c > 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case b == 0:
|
||||||
|
break Loop
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if c != 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return mmp[0] > major || mmp[0] == major && (mmp[1] > minor || mmp[1] == minor && mmp[2] >= patch)
|
||||||
|
}
|
4
vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
generated
vendored
4
vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
generated
vendored
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
// cpuid is implemented in cpu_x86.s for gc compiler
|
// cpuid is implemented in cpu_gc_x86.s for gc compiler
|
||||||
// and in cpu_gccgo.c for gccgo.
|
// and in cpu_gccgo.c for gccgo.
|
||||||
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
|
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
|
||||||
|
|
||||||
// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler
|
// xgetbv with ecx = 0 is implemented in cpu_gc_x86.s for gc compiler
|
||||||
// and in cpu_gccgo.c for gccgo.
|
// and in cpu_gccgo.c for gccgo.
|
||||||
func xgetbv() (eax, edx uint32)
|
func xgetbv() (eax, edx uint32)
|
||||||
|
|
2
vendor/golang.org/x/sys/cpu/cpu_x86.s → vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_x86.s → vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
generated
vendored
|
@ -18,7 +18,7 @@ TEXT ·cpuid(SB), NOSPLIT, $0-24
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// func xgetbv() (eax, edx uint32)
|
// func xgetbv() (eax, edx uint32)
|
||||||
TEXT ·xgetbv(SB),NOSPLIT,$0-8
|
TEXT ·xgetbv(SB), NOSPLIT, $0-8
|
||||||
MOVL $0, CX
|
MOVL $0, CX
|
||||||
XGETBV
|
XGETBV
|
||||||
MOVL AX, eax+0(FP)
|
MOVL AX, eax+0(FP)
|
6
vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go
generated
vendored
6
vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go
generated
vendored
|
@ -23,9 +23,3 @@ func xgetbv() (eax, edx uint32) {
|
||||||
gccgoXgetbv(&a, &d)
|
gccgoXgetbv(&a, &d)
|
||||||
return a, d
|
return a, d
|
||||||
}
|
}
|
||||||
|
|
||||||
// gccgo doesn't build on Darwin, per:
|
|
||||||
// https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76
|
|
||||||
func darwinSupportsAVX512() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
1
vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go
generated
vendored
1
vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go
generated
vendored
|
@ -110,7 +110,6 @@ func doinit() {
|
||||||
ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM)
|
ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM)
|
||||||
ARM64.HasDIT = isSet(hwCap, hwcap_DIT)
|
ARM64.HasDIT = isSet(hwCap, hwcap_DIT)
|
||||||
|
|
||||||
|
|
||||||
// HWCAP2 feature bits
|
// HWCAP2 feature bits
|
||||||
ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2)
|
ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2)
|
||||||
ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM)
|
ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM)
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.20
|
//go:build 386 || amd64p32 || (amd64 && (!darwin || !gc))
|
||||||
// +build go1.20
|
|
||||||
|
|
||||||
package versions
|
package cpu
|
||||||
|
|
||||||
func init() {
|
func darwinSupportsAVX512() bool {
|
||||||
if Compare(toolchain, Go1_20) < 0 {
|
panic("only implemented for gc && amd64 && darwin")
|
||||||
toolchain = Go1_20
|
|
||||||
}
|
|
||||||
}
|
}
|
6
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
6
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
|
@ -92,10 +92,8 @@ func archInit() {
|
||||||
osSupportsAVX = isSet(1, eax) && isSet(2, eax)
|
osSupportsAVX = isSet(1, eax) && isSet(2, eax)
|
||||||
|
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// Darwin doesn't save/restore AVX-512 mask registers correctly across signal handlers.
|
// Darwin requires special AVX512 checks, see cpu_darwin_x86.go
|
||||||
// Since users can't rely on mask register contents, let's not advertise AVX-512 support.
|
osSupportsAVX512 = osSupportsAVX && darwinSupportsAVX512()
|
||||||
// See issue 49233.
|
|
||||||
osSupportsAVX512 = false
|
|
||||||
} else {
|
} else {
|
||||||
// Check if OPMASK and ZMM registers have OS support.
|
// Check if OPMASK and ZMM registers have OS support.
|
||||||
osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
|
osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
|
||||||
|
|
98
vendor/golang.org/x/sys/cpu/syscall_darwin_x86_gc.go
generated
vendored
Normal file
98
vendor/golang.org/x/sys/cpu/syscall_darwin_x86_gc.go
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Minimal copy of x/sys/unix so the cpu package can make a
|
||||||
|
// system call on Darwin without depending on x/sys/unix.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
type _C_int int32
|
||||||
|
|
||||||
|
// adapted from unix.Uname() at x/sys/unix/syscall_darwin.go L419
|
||||||
|
func darwinOSRelease(release *[256]byte) error {
|
||||||
|
// from x/sys/unix/zerrors_openbsd_amd64.go
|
||||||
|
const (
|
||||||
|
CTL_KERN = 0x1
|
||||||
|
KERN_OSRELEASE = 0x2
|
||||||
|
)
|
||||||
|
|
||||||
|
mib := []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||||
|
n := unsafe.Sizeof(*release)
|
||||||
|
|
||||||
|
return sysctl(mib, &release[0], &n, nil, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Errno = syscall.Errno
|
||||||
|
|
||||||
|
var _zero uintptr // Single-word zero for use when we need a valid pointer to 0 bytes.
|
||||||
|
|
||||||
|
// from x/sys/unix/zsyscall_darwin_amd64.go L791-807
|
||||||
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(mib) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&mib[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
if _, _, err := syscall_syscall6(
|
||||||
|
libc_sysctl_trampoline_addr,
|
||||||
|
uintptr(_p0),
|
||||||
|
uintptr(len(mib)),
|
||||||
|
uintptr(unsafe.Pointer(old)),
|
||||||
|
uintptr(unsafe.Pointer(oldlen)),
|
||||||
|
uintptr(unsafe.Pointer(new)),
|
||||||
|
uintptr(newlen),
|
||||||
|
); err != 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
// adapted from internal/cpu/cpu_arm64_darwin.go
|
||||||
|
func darwinSysctlEnabled(name []byte) bool {
|
||||||
|
out := int32(0)
|
||||||
|
nout := unsafe.Sizeof(out)
|
||||||
|
if ret := sysctlbyname(&name[0], (*byte)(unsafe.Pointer(&out)), &nout, nil, 0); ret != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return out > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
var libc_sysctlbyname_trampoline_addr uintptr
|
||||||
|
|
||||||
|
// adapted from runtime/sys_darwin.go in the pattern of sysctl() above, as defined in x/sys/unix
|
||||||
|
func sysctlbyname(name *byte, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
|
||||||
|
if _, _, err := syscall_syscall6(
|
||||||
|
libc_sysctlbyname_trampoline_addr,
|
||||||
|
uintptr(unsafe.Pointer(name)),
|
||||||
|
uintptr(unsafe.Pointer(old)),
|
||||||
|
uintptr(unsafe.Pointer(oldlen)),
|
||||||
|
uintptr(unsafe.Pointer(new)),
|
||||||
|
uintptr(newlen),
|
||||||
|
0,
|
||||||
|
); err != 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_sysctlbyname sysctlbyname "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||||
|
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
|
||||||
|
//go:linkname syscall_syscall6 syscall.syscall6
|
2
vendor/golang.org/x/sys/unix/README.md
generated
vendored
2
vendor/golang.org/x/sys/unix/README.md
generated
vendored
|
@ -156,7 +156,7 @@ from the generated architecture-specific files listed below, and merge these
|
||||||
into a common file for each OS.
|
into a common file for each OS.
|
||||||
|
|
||||||
The merge is performed in the following steps:
|
The merge is performed in the following steps:
|
||||||
1. Construct the set of common code that is idential in all architecture-specific files.
|
1. Construct the set of common code that is identical in all architecture-specific files.
|
||||||
2. Write this common code to the merged file.
|
2. Write this common code to the merged file.
|
||||||
3. Remove the common code from all architecture-specific files.
|
3. Remove the common code from all architecture-specific files.
|
||||||
|
|
||||||
|
|
96
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
96
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
|
@ -58,6 +58,102 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlGetEthtoolTsInfo fetches ethtool timestamping and PHC
|
||||||
|
// association for the network device specified by ifname.
|
||||||
|
func IoctlGetEthtoolTsInfo(fd int, ifname string) (*EthtoolTsInfo, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := EthtoolTsInfo{Cmd: ETHTOOL_GET_TS_INFO}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetHwTstamp retrieves the hardware timestamping configuration
|
||||||
|
// for the network device specified by ifname.
|
||||||
|
func IoctlGetHwTstamp(fd int, ifname string) (*HwTstampConfig, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := HwTstampConfig{}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCGHWTSTAMP, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetHwTstamp updates the hardware timestamping configuration for
|
||||||
|
// the network device specified by ifname.
|
||||||
|
func IoctlSetHwTstamp(fd int, ifname string, cfg *HwTstampConfig) error {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(cfg))
|
||||||
|
return ioctlIfreqData(fd, SIOCSHWTSTAMP, &ifrd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FdToClockID derives the clock ID from the file descriptor number
|
||||||
|
// - see clock_gettime(3), FD_TO_CLOCKID macros. The resulting ID is
|
||||||
|
// suitable for system calls like ClockGettime.
|
||||||
|
func FdToClockID(fd int) int32 { return int32((int(^fd) << 3) | 3) }
|
||||||
|
|
||||||
|
// IoctlPtpClockGetcaps returns the description of a given PTP device.
|
||||||
|
func IoctlPtpClockGetcaps(fd int) (*PtpClockCaps, error) {
|
||||||
|
var value PtpClockCaps
|
||||||
|
err := ioctlPtr(fd, PTP_CLOCK_GETCAPS2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetPrecise returns a description of the clock
|
||||||
|
// offset compared to the system clock.
|
||||||
|
func IoctlPtpSysOffsetPrecise(fd int) (*PtpSysOffsetPrecise, error) {
|
||||||
|
var value PtpSysOffsetPrecise
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_PRECISE2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetExtended returns an extended description of the
|
||||||
|
// clock offset compared to the system clock. The samples parameter
|
||||||
|
// specifies the desired number of measurements.
|
||||||
|
func IoctlPtpSysOffsetExtended(fd int, samples uint) (*PtpSysOffsetExtended, error) {
|
||||||
|
value := PtpSysOffsetExtended{Samples: uint32(samples)}
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_EXTENDED2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinGetfunc returns the configuration of the specified
|
||||||
|
// I/O pin on given PTP device.
|
||||||
|
func IoctlPtpPinGetfunc(fd int, index uint) (*PtpPinDesc, error) {
|
||||||
|
value := PtpPinDesc{Index: uint32(index)}
|
||||||
|
err := ioctlPtr(fd, PTP_PIN_GETFUNC2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinSetfunc updates configuration of the specified PTP
|
||||||
|
// I/O pin.
|
||||||
|
func IoctlPtpPinSetfunc(fd int, pd *PtpPinDesc) error {
|
||||||
|
return ioctlPtr(fd, PTP_PIN_SETFUNC2, unsafe.Pointer(pd))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPeroutRequest configures the periodic output mode of the
|
||||||
|
// PTP I/O pins.
|
||||||
|
func IoctlPtpPeroutRequest(fd int, r *PtpPeroutRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_PEROUT_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpExttsRequest configures the external timestamping mode
|
||||||
|
// of the PTP I/O pins.
|
||||||
|
func IoctlPtpExttsRequest(fd int, r *PtpExttsRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_EXTTS_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||||
// Linux watchdog API. For more information, see:
|
// Linux watchdog API. For more information, see:
|
||||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||||
|
|
16
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
16
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
|
@ -158,6 +158,16 @@ includes_Linux='
|
||||||
#endif
|
#endif
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
// See the description in unix/linux/types.go
|
||||||
|
#if defined(__ARM_EABI__) || \
|
||||||
|
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
|
||||||
|
(defined(__powerpc__) && (!defined(__powerpc64__)))
|
||||||
|
# ifdef _TIME_BITS
|
||||||
|
# undef _TIME_BITS
|
||||||
|
# endif
|
||||||
|
# define _TIME_BITS 32
|
||||||
|
#endif
|
||||||
|
|
||||||
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
||||||
// these structures. We just include them copied from <bits/termios.h>.
|
// these structures. We just include them copied from <bits/termios.h>.
|
||||||
#if defined(__powerpc__)
|
#if defined(__powerpc__)
|
||||||
|
@ -256,6 +266,7 @@ struct ltchars {
|
||||||
#include <linux/nsfs.h>
|
#include <linux/nsfs.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
#include <linux/pps.h>
|
#include <linux/pps.h>
|
||||||
|
#include <linux/ptp_clock.h>
|
||||||
#include <linux/ptrace.h>
|
#include <linux/ptrace.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
|
@ -527,6 +538,7 @@ ccflags="$@"
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
$2 ~ /^PTP_/ ||
|
||||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
$2 ~ /^[US]F_/ ||
|
$2 ~ /^[US]F_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
|
@ -656,7 +668,7 @@ errors=$(
|
||||||
signals=$(
|
signals=$(
|
||||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
||||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||||
sort
|
sort
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -666,7 +678,7 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
sort >_error.grep
|
sort >_error.grep
|
||||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||||
sort >_signal.grep
|
sort >_signal.grep
|
||||||
|
|
||||||
echo '// mkerrors.sh' "$@"
|
echo '// mkerrors.sh' "$@"
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
|
@ -360,7 +360,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
||||||
var status _C_int
|
var status _C_int
|
||||||
var r Pid_t
|
var r Pid_t
|
||||||
err = ERESTART
|
err = ERESTART
|
||||||
// AIX wait4 may return with ERESTART errno, while the processus is still
|
// AIX wait4 may return with ERESTART errno, while the process is still
|
||||||
// active.
|
// active.
|
||||||
for err == ERESTART {
|
for err == ERESTART {
|
||||||
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
||||||
|
|
64
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
64
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
@ -1295,6 +1295,48 @@ func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetsockoptTCPCCVegasInfo returns algorithm specific congestion control information for a socket using the "vegas"
|
||||||
|
// algorithm.
|
||||||
|
//
|
||||||
|
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||||
|
//
|
||||||
|
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||||
|
func GetsockoptTCPCCVegasInfo(fd, level, opt int) (*TCPVegasInfo, error) {
|
||||||
|
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||||
|
vallen := _Socklen(SizeofTCPCCInfo)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||||
|
out := (*TCPVegasInfo)(unsafe.Pointer(&value[0]))
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetsockoptTCPCCDCTCPInfo returns algorithm specific congestion control information for a socket using the "dctp"
|
||||||
|
// algorithm.
|
||||||
|
//
|
||||||
|
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||||
|
//
|
||||||
|
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||||
|
func GetsockoptTCPCCDCTCPInfo(fd, level, opt int) (*TCPDCTCPInfo, error) {
|
||||||
|
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||||
|
vallen := _Socklen(SizeofTCPCCInfo)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||||
|
out := (*TCPDCTCPInfo)(unsafe.Pointer(&value[0]))
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetsockoptTCPCCBBRInfo returns algorithm specific congestion control information for a socket using the "bbr"
|
||||||
|
// algorithm.
|
||||||
|
//
|
||||||
|
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||||
|
//
|
||||||
|
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||||
|
func GetsockoptTCPCCBBRInfo(fd, level, opt int) (*TCPBBRInfo, error) {
|
||||||
|
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||||
|
vallen := _Socklen(SizeofTCPCCInfo)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||||
|
out := (*TCPBBRInfo)(unsafe.Pointer(&value[0]))
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
// GetsockoptString returns the string value of the socket option opt for the
|
// GetsockoptString returns the string value of the socket option opt for the
|
||||||
// socket associated with fd at the given socket level.
|
// socket associated with fd at the given socket level.
|
||||||
func GetsockoptString(fd, level, opt int) (string, error) {
|
func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
|
@ -1818,6 +1860,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
|
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
|
||||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
|
//sys ClockSettime(clockid int32, time *Timespec) (err error)
|
||||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
||||||
|
@ -1959,7 +2002,26 @@ func Getpgrp() (pid int) {
|
||||||
//sysnb Getpid() (pid int)
|
//sysnb Getpid() (pid int)
|
||||||
//sysnb Getppid() (ppid int)
|
//sysnb Getppid() (ppid int)
|
||||||
//sys Getpriority(which int, who int) (prio int, err error)
|
//sys Getpriority(which int, who int) (prio int, err error)
|
||||||
//sys Getrandom(buf []byte, flags int) (n int, err error)
|
|
||||||
|
func Getrandom(buf []byte, flags int) (n int, err error) {
|
||||||
|
vdsoRet, supported := vgetrandom(buf, uint32(flags))
|
||||||
|
if supported {
|
||||||
|
if vdsoRet < 0 {
|
||||||
|
return 0, errnoErr(syscall.Errno(-vdsoRet))
|
||||||
|
}
|
||||||
|
return vdsoRet, nil
|
||||||
|
}
|
||||||
|
var p *byte
|
||||||
|
if len(buf) > 0 {
|
||||||
|
p = &buf[0]
|
||||||
|
}
|
||||||
|
r, _, e := Syscall(SYS_GETRANDOM, uintptr(unsafe.Pointer(p)), uintptr(len(buf)), uintptr(flags))
|
||||||
|
if e != 0 {
|
||||||
|
return 0, errnoErr(e)
|
||||||
|
}
|
||||||
|
return int(r), nil
|
||||||
|
}
|
||||||
|
|
||||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||||
//sysnb Getsid(pid int) (sid int, err error)
|
//sysnb Getsid(pid int) (sid int, err error)
|
||||||
//sysnb Gettid() (tid int)
|
//sysnb Gettid() (tid int)
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
|
@ -182,3 +182,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
|
||||||
}
|
}
|
||||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
generated
vendored
|
@ -214,3 +214,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
|
||||||
}
|
}
|
||||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
|
@ -187,3 +187,5 @@ func RISCVHWProbe(pairs []RISCVHWProbePairs, set *CPUSet, flags uint) (err error
|
||||||
}
|
}
|
||||||
return riscvHWProbe(pairs, setSize, set, flags)
|
return riscvHWProbe(pairs, setSize, set, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||||
|
|
104
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
104
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
|
@ -768,6 +768,15 @@ func Munmap(b []byte) (err error) {
|
||||||
return mapper.Munmap(b)
|
return mapper.Munmap(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) {
|
||||||
|
xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset)
|
||||||
|
return unsafe.Pointer(xaddr), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) {
|
||||||
|
return mapper.munmap(uintptr(addr), length)
|
||||||
|
}
|
||||||
|
|
||||||
//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A
|
//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A
|
||||||
//sysnb Getgid() (gid int)
|
//sysnb Getgid() (gid int)
|
||||||
//sysnb Getpid() (pid int)
|
//sysnb Getpid() (pid int)
|
||||||
|
@ -816,10 +825,10 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
||||||
// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/
|
// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/
|
||||||
func isSpecialPath(path []byte) (v bool) {
|
func isSpecialPath(path []byte) (v bool) {
|
||||||
var special = [4][8]byte{
|
var special = [4][8]byte{
|
||||||
[8]byte{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
||||||
|
|
||||||
var i, j int
|
var i, j int
|
||||||
for i = 0; i < len(special); i++ {
|
for i = 0; i < len(special); i++ {
|
||||||
|
@ -3115,3 +3124,90 @@ func legacy_Mkfifoat(dirfd int, path string, mode uint32) (err error) {
|
||||||
//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT
|
//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT
|
||||||
//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT
|
//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT
|
||||||
//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT
|
//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT
|
||||||
|
|
||||||
|
func fcntlAsIs(fd uintptr, cmd int, arg uintptr) (val int, err error) {
|
||||||
|
runtime.EnterSyscall()
|
||||||
|
r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), arg)
|
||||||
|
runtime.ExitSyscall()
|
||||||
|
val = int(r0)
|
||||||
|
if int64(r0) == -1 {
|
||||||
|
err = errnoErr2(e1, e2)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fcntl(fd uintptr, cmd int, op interface{}) (ret int, err error) {
|
||||||
|
switch op.(type) {
|
||||||
|
case *Flock_t:
|
||||||
|
err = FcntlFlock(fd, cmd, op.(*Flock_t))
|
||||||
|
if err != nil {
|
||||||
|
ret = -1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
case int:
|
||||||
|
return FcntlInt(fd, cmd, op.(int))
|
||||||
|
case *F_cnvrt:
|
||||||
|
return fcntlAsIs(fd, cmd, uintptr(unsafe.Pointer(op.(*F_cnvrt))))
|
||||||
|
case unsafe.Pointer:
|
||||||
|
return fcntlAsIs(fd, cmd, uintptr(op.(unsafe.Pointer)))
|
||||||
|
default:
|
||||||
|
return -1, EINVAL
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
// TODO: use LE call instead if the call is implemented
|
||||||
|
originalOffset, err := Seek(infd, 0, SEEK_CUR)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
//start reading data from in_fd
|
||||||
|
if offset != nil {
|
||||||
|
_, err := Seek(infd, *offset, SEEK_SET)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := make([]byte, count)
|
||||||
|
readBuf := make([]byte, 0)
|
||||||
|
var n int = 0
|
||||||
|
for i := 0; i < count; i += n {
|
||||||
|
n, err := Read(infd, buf)
|
||||||
|
if n == 0 {
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
} else { // EOF
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
readBuf = append(readBuf, buf...)
|
||||||
|
buf = buf[0:0]
|
||||||
|
}
|
||||||
|
|
||||||
|
n2, err := Write(outfd, readBuf)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//When sendfile() returns, this variable will be set to the
|
||||||
|
// offset of the byte following the last byte that was read.
|
||||||
|
if offset != nil {
|
||||||
|
*offset = *offset + int64(n)
|
||||||
|
// If offset is not NULL, then sendfile() does not modify the file
|
||||||
|
// offset of in_fd
|
||||||
|
_, err := Seek(infd, originalOffset, SEEK_SET)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n2, nil
|
||||||
|
}
|
||||||
|
|
13
vendor/golang.org/x/sys/unix/vgetrandom_linux.go
generated
vendored
Normal file
13
vendor/golang.org/x/sys/unix/vgetrandom_linux.go
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build linux && go1.24
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import _ "unsafe"
|
||||||
|
|
||||||
|
//go:linkname vgetrandom runtime.vgetrandom
|
||||||
|
//go:noescape
|
||||||
|
func vgetrandom(p []byte, flags uint32) (ret int, supported bool)
|
|
@ -2,13 +2,10 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.19
|
//go:build !linux || !go1.24
|
||||||
// +build go1.19
|
|
||||||
|
|
||||||
package versions
|
package unix
|
||||||
|
|
||||||
func init() {
|
func vgetrandom(p []byte, flags uint32) (ret int, supported bool) {
|
||||||
if Compare(toolchain, Go1_19) < 0 {
|
return -1, false
|
||||||
toolchain = Go1_19
|
|
||||||
}
|
|
||||||
}
|
}
|
44
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
44
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
|
@ -321,6 +321,9 @@ const (
|
||||||
AUDIT_INTEGRITY_STATUS = 0x70a
|
AUDIT_INTEGRITY_STATUS = 0x70a
|
||||||
AUDIT_IPC = 0x517
|
AUDIT_IPC = 0x517
|
||||||
AUDIT_IPC_SET_PERM = 0x51f
|
AUDIT_IPC_SET_PERM = 0x51f
|
||||||
|
AUDIT_IPE_ACCESS = 0x58c
|
||||||
|
AUDIT_IPE_CONFIG_CHANGE = 0x58d
|
||||||
|
AUDIT_IPE_POLICY_LOAD = 0x58e
|
||||||
AUDIT_KERNEL = 0x7d0
|
AUDIT_KERNEL = 0x7d0
|
||||||
AUDIT_KERNEL_OTHER = 0x524
|
AUDIT_KERNEL_OTHER = 0x524
|
||||||
AUDIT_KERN_MODULE = 0x532
|
AUDIT_KERN_MODULE = 0x532
|
||||||
|
@ -489,12 +492,14 @@ const (
|
||||||
BPF_F_ID = 0x20
|
BPF_F_ID = 0x20
|
||||||
BPF_F_NETFILTER_IP_DEFRAG = 0x1
|
BPF_F_NETFILTER_IP_DEFRAG = 0x1
|
||||||
BPF_F_QUERY_EFFECTIVE = 0x1
|
BPF_F_QUERY_EFFECTIVE = 0x1
|
||||||
|
BPF_F_REDIRECT_FLAGS = 0x19
|
||||||
BPF_F_REPLACE = 0x4
|
BPF_F_REPLACE = 0x4
|
||||||
BPF_F_SLEEPABLE = 0x10
|
BPF_F_SLEEPABLE = 0x10
|
||||||
BPF_F_STRICT_ALIGNMENT = 0x1
|
BPF_F_STRICT_ALIGNMENT = 0x1
|
||||||
BPF_F_TEST_REG_INVARIANTS = 0x80
|
BPF_F_TEST_REG_INVARIANTS = 0x80
|
||||||
BPF_F_TEST_RND_HI32 = 0x4
|
BPF_F_TEST_RND_HI32 = 0x4
|
||||||
BPF_F_TEST_RUN_ON_CPU = 0x1
|
BPF_F_TEST_RUN_ON_CPU = 0x1
|
||||||
|
BPF_F_TEST_SKB_CHECKSUM_COMPLETE = 0x4
|
||||||
BPF_F_TEST_STATE_FREQ = 0x8
|
BPF_F_TEST_STATE_FREQ = 0x8
|
||||||
BPF_F_TEST_XDP_LIVE_FRAMES = 0x2
|
BPF_F_TEST_XDP_LIVE_FRAMES = 0x2
|
||||||
BPF_F_XDP_DEV_BOUND_ONLY = 0x40
|
BPF_F_XDP_DEV_BOUND_ONLY = 0x40
|
||||||
|
@ -1165,6 +1170,7 @@ const (
|
||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
F2FS_SUPER_MAGIC = 0xf2f52010
|
F2FS_SUPER_MAGIC = 0xf2f52010
|
||||||
|
FALLOC_FL_ALLOCATE_RANGE = 0x0
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
FALLOC_FL_INSERT_RANGE = 0x20
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
FALLOC_FL_KEEP_SIZE = 0x1
|
||||||
|
@ -1798,6 +1804,8 @@ const (
|
||||||
LANDLOCK_ACCESS_NET_BIND_TCP = 0x1
|
LANDLOCK_ACCESS_NET_BIND_TCP = 0x1
|
||||||
LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2
|
LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2
|
||||||
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
||||||
|
LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET = 0x1
|
||||||
|
LANDLOCK_SCOPE_SIGNAL = 0x2
|
||||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||||
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
||||||
|
@ -1922,6 +1930,8 @@ const (
|
||||||
MNT_EXPIRE = 0x4
|
MNT_EXPIRE = 0x4
|
||||||
MNT_FORCE = 0x1
|
MNT_FORCE = 0x1
|
||||||
MNT_ID_REQ_SIZE_VER0 = 0x18
|
MNT_ID_REQ_SIZE_VER0 = 0x18
|
||||||
|
MNT_ID_REQ_SIZE_VER1 = 0x20
|
||||||
|
MNT_NS_INFO_SIZE_VER0 = 0x10
|
||||||
MODULE_INIT_COMPRESSED_FILE = 0x4
|
MODULE_INIT_COMPRESSED_FILE = 0x4
|
||||||
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
|
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
|
||||||
MODULE_INIT_IGNORE_VERMAGIC = 0x2
|
MODULE_INIT_IGNORE_VERMAGIC = 0x2
|
||||||
|
@ -2187,7 +2197,7 @@ const (
|
||||||
NFT_REG_SIZE = 0x10
|
NFT_REG_SIZE = 0x10
|
||||||
NFT_REJECT_ICMPX_MAX = 0x3
|
NFT_REJECT_ICMPX_MAX = 0x3
|
||||||
NFT_RT_MAX = 0x4
|
NFT_RT_MAX = 0x4
|
||||||
NFT_SECMARK_CTX_MAXLEN = 0x100
|
NFT_SECMARK_CTX_MAXLEN = 0x1000
|
||||||
NFT_SET_MAXNAMELEN = 0x100
|
NFT_SET_MAXNAMELEN = 0x100
|
||||||
NFT_SOCKET_MAX = 0x3
|
NFT_SOCKET_MAX = 0x3
|
||||||
NFT_TABLE_F_MASK = 0x7
|
NFT_TABLE_F_MASK = 0x7
|
||||||
|
@ -2356,9 +2366,11 @@ const (
|
||||||
PERF_MEM_LVLNUM_IO = 0xa
|
PERF_MEM_LVLNUM_IO = 0xa
|
||||||
PERF_MEM_LVLNUM_L1 = 0x1
|
PERF_MEM_LVLNUM_L1 = 0x1
|
||||||
PERF_MEM_LVLNUM_L2 = 0x2
|
PERF_MEM_LVLNUM_L2 = 0x2
|
||||||
|
PERF_MEM_LVLNUM_L2_MHB = 0x5
|
||||||
PERF_MEM_LVLNUM_L3 = 0x3
|
PERF_MEM_LVLNUM_L3 = 0x3
|
||||||
PERF_MEM_LVLNUM_L4 = 0x4
|
PERF_MEM_LVLNUM_L4 = 0x4
|
||||||
PERF_MEM_LVLNUM_LFB = 0xc
|
PERF_MEM_LVLNUM_LFB = 0xc
|
||||||
|
PERF_MEM_LVLNUM_MSC = 0x6
|
||||||
PERF_MEM_LVLNUM_NA = 0xf
|
PERF_MEM_LVLNUM_NA = 0xf
|
||||||
PERF_MEM_LVLNUM_PMEM = 0xe
|
PERF_MEM_LVLNUM_PMEM = 0xe
|
||||||
PERF_MEM_LVLNUM_RAM = 0xd
|
PERF_MEM_LVLNUM_RAM = 0xd
|
||||||
|
@ -2431,6 +2443,7 @@ const (
|
||||||
PRIO_PGRP = 0x1
|
PRIO_PGRP = 0x1
|
||||||
PRIO_PROCESS = 0x0
|
PRIO_PROCESS = 0x0
|
||||||
PRIO_USER = 0x2
|
PRIO_USER = 0x2
|
||||||
|
PROCFS_IOCTL_MAGIC = 'f'
|
||||||
PROC_SUPER_MAGIC = 0x9fa0
|
PROC_SUPER_MAGIC = 0x9fa0
|
||||||
PROT_EXEC = 0x4
|
PROT_EXEC = 0x4
|
||||||
PROT_GROWSDOWN = 0x1000000
|
PROT_GROWSDOWN = 0x1000000
|
||||||
|
@ -2620,6 +2633,28 @@ const (
|
||||||
PR_UNALIGN_NOPRINT = 0x1
|
PR_UNALIGN_NOPRINT = 0x1
|
||||||
PR_UNALIGN_SIGBUS = 0x2
|
PR_UNALIGN_SIGBUS = 0x2
|
||||||
PSTOREFS_MAGIC = 0x6165676c
|
PSTOREFS_MAGIC = 0x6165676c
|
||||||
|
PTP_CLK_MAGIC = '='
|
||||||
|
PTP_ENABLE_FEATURE = 0x1
|
||||||
|
PTP_EXTTS_EDGES = 0x6
|
||||||
|
PTP_EXTTS_EVENT_VALID = 0x1
|
||||||
|
PTP_EXTTS_V1_VALID_FLAGS = 0x7
|
||||||
|
PTP_EXTTS_VALID_FLAGS = 0x1f
|
||||||
|
PTP_EXT_OFFSET = 0x10
|
||||||
|
PTP_FALLING_EDGE = 0x4
|
||||||
|
PTP_MAX_SAMPLES = 0x19
|
||||||
|
PTP_PEROUT_DUTY_CYCLE = 0x2
|
||||||
|
PTP_PEROUT_ONE_SHOT = 0x1
|
||||||
|
PTP_PEROUT_PHASE = 0x4
|
||||||
|
PTP_PEROUT_V1_VALID_FLAGS = 0x0
|
||||||
|
PTP_PEROUT_VALID_FLAGS = 0x7
|
||||||
|
PTP_PIN_GETFUNC = 0xc0603d06
|
||||||
|
PTP_PIN_GETFUNC2 = 0xc0603d0f
|
||||||
|
PTP_RISING_EDGE = 0x2
|
||||||
|
PTP_STRICT_FLAGS = 0x8
|
||||||
|
PTP_SYS_OFFSET_EXTENDED = 0xc4c03d09
|
||||||
|
PTP_SYS_OFFSET_EXTENDED2 = 0xc4c03d12
|
||||||
|
PTP_SYS_OFFSET_PRECISE = 0xc0403d08
|
||||||
|
PTP_SYS_OFFSET_PRECISE2 = 0xc0403d11
|
||||||
PTRACE_ATTACH = 0x10
|
PTRACE_ATTACH = 0x10
|
||||||
PTRACE_CONT = 0x7
|
PTRACE_CONT = 0x7
|
||||||
PTRACE_DETACH = 0x11
|
PTRACE_DETACH = 0x11
|
||||||
|
@ -2933,15 +2968,17 @@ const (
|
||||||
RUSAGE_SELF = 0x0
|
RUSAGE_SELF = 0x0
|
||||||
RUSAGE_THREAD = 0x1
|
RUSAGE_THREAD = 0x1
|
||||||
RWF_APPEND = 0x10
|
RWF_APPEND = 0x10
|
||||||
|
RWF_ATOMIC = 0x40
|
||||||
RWF_DSYNC = 0x2
|
RWF_DSYNC = 0x2
|
||||||
RWF_HIPRI = 0x1
|
RWF_HIPRI = 0x1
|
||||||
RWF_NOAPPEND = 0x20
|
RWF_NOAPPEND = 0x20
|
||||||
RWF_NOWAIT = 0x8
|
RWF_NOWAIT = 0x8
|
||||||
RWF_SUPPORTED = 0x3f
|
RWF_SUPPORTED = 0x7f
|
||||||
RWF_SYNC = 0x4
|
RWF_SYNC = 0x4
|
||||||
RWF_WRITE_LIFE_NOT_SET = 0x0
|
RWF_WRITE_LIFE_NOT_SET = 0x0
|
||||||
SCHED_BATCH = 0x3
|
SCHED_BATCH = 0x3
|
||||||
SCHED_DEADLINE = 0x6
|
SCHED_DEADLINE = 0x6
|
||||||
|
SCHED_EXT = 0x7
|
||||||
SCHED_FIFO = 0x1
|
SCHED_FIFO = 0x1
|
||||||
SCHED_FLAG_ALL = 0x7f
|
SCHED_FLAG_ALL = 0x7f
|
||||||
SCHED_FLAG_DL_OVERRUN = 0x4
|
SCHED_FLAG_DL_OVERRUN = 0x4
|
||||||
|
@ -3210,6 +3247,7 @@ const (
|
||||||
STATX_ATTR_MOUNT_ROOT = 0x2000
|
STATX_ATTR_MOUNT_ROOT = 0x2000
|
||||||
STATX_ATTR_NODUMP = 0x40
|
STATX_ATTR_NODUMP = 0x40
|
||||||
STATX_ATTR_VERITY = 0x100000
|
STATX_ATTR_VERITY = 0x100000
|
||||||
|
STATX_ATTR_WRITE_ATOMIC = 0x400000
|
||||||
STATX_BASIC_STATS = 0x7ff
|
STATX_BASIC_STATS = 0x7ff
|
||||||
STATX_BLOCKS = 0x400
|
STATX_BLOCKS = 0x400
|
||||||
STATX_BTIME = 0x800
|
STATX_BTIME = 0x800
|
||||||
|
@ -3226,6 +3264,7 @@ const (
|
||||||
STATX_SUBVOL = 0x8000
|
STATX_SUBVOL = 0x8000
|
||||||
STATX_TYPE = 0x1
|
STATX_TYPE = 0x1
|
||||||
STATX_UID = 0x8
|
STATX_UID = 0x8
|
||||||
|
STATX_WRITE_ATOMIC = 0x10000
|
||||||
STATX__RESERVED = 0x80000000
|
STATX__RESERVED = 0x80000000
|
||||||
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
|
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
|
||||||
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
|
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
|
||||||
|
@ -3624,6 +3663,7 @@ const (
|
||||||
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
|
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
|
||||||
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
|
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
|
||||||
XDP_UMEM_REG = 0x4
|
XDP_UMEM_REG = 0x4
|
||||||
|
XDP_UMEM_TX_METADATA_LEN = 0x4
|
||||||
XDP_UMEM_TX_SW_CSUM = 0x2
|
XDP_UMEM_TX_SW_CSUM = 0x2
|
||||||
XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1
|
XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1
|
||||||
XDP_USE_NEED_WAKEUP = 0x8
|
XDP_USE_NEED_WAKEUP = 0x8
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
|
@ -109,6 +109,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -153,9 +154,14 @@ const (
|
||||||
NFDBITS = 0x20
|
NFDBITS = 0x20
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -232,6 +238,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPXREGS = 0x12
|
PTRACE_GETFPXREGS = 0x12
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
|
@ -278,6 +298,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -316,6 +338,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
|
@ -109,6 +109,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -153,9 +154,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -232,6 +238,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_ARCH_PRCTL = 0x1e
|
PTRACE_ARCH_PRCTL = 0x1e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPXREGS = 0x12
|
PTRACE_GETFPXREGS = 0x12
|
||||||
|
@ -279,6 +299,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -317,6 +339,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x20
|
NFDBITS = 0x20
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETCRUNCHREGS = 0x19
|
PTRACE_GETCRUNCHREGS = 0x19
|
||||||
PTRACE_GETFDPIC = 0x1f
|
PTRACE_GETFDPIC = 0x1f
|
||||||
PTRACE_GETFDPIC_EXEC = 0x0
|
PTRACE_GETFDPIC_EXEC = 0x0
|
||||||
|
@ -284,6 +304,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -322,6 +344,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
26
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
|
@ -112,6 +112,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -154,9 +155,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -200,6 +206,7 @@ const (
|
||||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||||
|
POE_MAGIC = 0x504f4530
|
||||||
PPPIOCATTACH = 0x4004743d
|
PPPIOCATTACH = 0x4004743d
|
||||||
PPPIOCATTCHAN = 0x40047438
|
PPPIOCATTCHAN = 0x40047438
|
||||||
PPPIOCBRIDGECHAN = 0x40047435
|
PPPIOCBRIDGECHAN = 0x40047435
|
||||||
|
@ -235,6 +242,20 @@ const (
|
||||||
PROT_BTI = 0x10
|
PROT_BTI = 0x10
|
||||||
PROT_MTE = 0x20
|
PROT_MTE = 0x20
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_PEEKMTETAGS = 0x21
|
PTRACE_PEEKMTETAGS = 0x21
|
||||||
PTRACE_POKEMTETAGS = 0x22
|
PTRACE_POKEMTETAGS = 0x22
|
||||||
PTRACE_SYSEMU = 0x1f
|
PTRACE_SYSEMU = 0x1f
|
||||||
|
@ -275,6 +296,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -313,6 +336,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
|
@ -109,6 +109,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -154,9 +155,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -233,6 +239,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_SYSEMU = 0x1f
|
PTRACE_SYSEMU = 0x1f
|
||||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||||
RLIMIT_AS = 0x9
|
RLIMIT_AS = 0x9
|
||||||
|
@ -271,6 +291,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -309,6 +331,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x100
|
IEXTEN = 0x100
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x20
|
NFDBITS = 0x20
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
@ -277,6 +297,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -315,6 +337,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x1029
|
SO_DOMAIN = 0x1029
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x100
|
IEXTEN = 0x100
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
@ -277,6 +297,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -315,6 +337,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x1029
|
SO_DOMAIN = 0x1029
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x100
|
IEXTEN = 0x100
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
@ -277,6 +297,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -315,6 +337,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x1029
|
SO_DOMAIN = 0x1029
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x100
|
IEXTEN = 0x100
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x20
|
NFDBITS = 0x20
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
@ -277,6 +297,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -315,6 +337,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x1029
|
SO_DOMAIN = 0x1029
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x4000
|
HUPCL = 0x4000
|
||||||
ICANON = 0x100
|
ICANON = 0x100
|
||||||
IEXTEN = 0x400
|
IEXTEN = 0x400
|
||||||
|
@ -152,9 +153,14 @@ const (
|
||||||
NL3 = 0x300
|
NL3 = 0x300
|
||||||
NLDLY = 0x300
|
NLDLY = 0x300
|
||||||
NOFLSH = 0x80000000
|
NOFLSH = 0x80000000
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x4
|
OLCUC = 0x4
|
||||||
ONLCR = 0x2
|
ONLCR = 0x2
|
||||||
|
@ -232,6 +238,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
@ -332,6 +352,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -370,6 +392,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x4000
|
HUPCL = 0x4000
|
||||||
ICANON = 0x100
|
ICANON = 0x100
|
||||||
IEXTEN = 0x400
|
IEXTEN = 0x400
|
||||||
|
@ -152,9 +153,14 @@ const (
|
||||||
NL3 = 0x300
|
NL3 = 0x300
|
||||||
NLDLY = 0x300
|
NLDLY = 0x300
|
||||||
NOFLSH = 0x80000000
|
NOFLSH = 0x80000000
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x4
|
OLCUC = 0x4
|
||||||
ONLCR = 0x2
|
ONLCR = 0x2
|
||||||
|
@ -232,6 +238,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
@ -336,6 +356,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -374,6 +396,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x4000
|
HUPCL = 0x4000
|
||||||
ICANON = 0x100
|
ICANON = 0x100
|
||||||
IEXTEN = 0x400
|
IEXTEN = 0x400
|
||||||
|
@ -152,9 +153,14 @@ const (
|
||||||
NL3 = 0x300
|
NL3 = 0x300
|
||||||
NLDLY = 0x300
|
NLDLY = 0x300
|
||||||
NOFLSH = 0x80000000
|
NOFLSH = 0x80000000
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x4
|
OLCUC = 0x4
|
||||||
ONLCR = 0x2
|
ONLCR = 0x2
|
||||||
|
@ -232,6 +238,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
@ -336,6 +356,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -374,6 +396,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETFDPIC = 0x21
|
PTRACE_GETFDPIC = 0x21
|
||||||
PTRACE_GETFDPIC_EXEC = 0x0
|
PTRACE_GETFDPIC_EXEC = 0x0
|
||||||
PTRACE_GETFDPIC_INTERP = 0x1
|
PTRACE_GETFDPIC_INTERP = 0x1
|
||||||
|
@ -268,6 +288,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -306,6 +328,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
|
@ -108,6 +108,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x80084803
|
HIDIOCGRAWINFO = 0x80084803
|
||||||
HIDIOCGRDESC = 0x90044802
|
HIDIOCGRDESC = 0x90044802
|
||||||
HIDIOCGRDESCSIZE = 0x80044801
|
HIDIOCGRDESCSIZE = 0x80044801
|
||||||
|
HIDIOCREVOKE = 0x4004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -150,9 +151,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x8008b705
|
||||||
NS_GET_NSTYPE = 0xb703
|
NS_GET_NSTYPE = 0xb703
|
||||||
NS_GET_OWNER_UID = 0xb704
|
NS_GET_OWNER_UID = 0xb704
|
||||||
NS_GET_PARENT = 0xb702
|
NS_GET_PARENT = 0xb702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||||
NS_GET_USERNS = 0xb701
|
NS_GET_USERNS = 0xb701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -229,6 +235,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_DISABLE_TE = 0x5010
|
PTRACE_DISABLE_TE = 0x5010
|
||||||
PTRACE_ENABLE_TE = 0x5009
|
PTRACE_ENABLE_TE = 0x5009
|
||||||
PTRACE_GET_LAST_BREAK = 0x5006
|
PTRACE_GET_LAST_BREAK = 0x5006
|
||||||
|
@ -340,6 +360,8 @@ const (
|
||||||
RTC_WIE_ON = 0x700f
|
RTC_WIE_ON = 0x700f
|
||||||
RTC_WKALM_RD = 0x80287010
|
RTC_WKALM_RD = 0x80287010
|
||||||
RTC_WKALM_SET = 0x4028700f
|
RTC_WKALM_SET = 0x4028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x4f
|
||||||
|
SCM_DEVMEM_LINEAR = 0x4e
|
||||||
SCM_TIMESTAMPING = 0x25
|
SCM_TIMESTAMPING = 0x25
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||||
|
@ -378,6 +400,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x35
|
SO_CNX_ADVICE = 0x35
|
||||||
SO_COOKIE = 0x39
|
SO_COOKIE = 0x39
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||||
|
SO_DEVMEM_DMABUF = 0x4f
|
||||||
|
SO_DEVMEM_DONTNEED = 0x50
|
||||||
|
SO_DEVMEM_LINEAR = 0x4e
|
||||||
SO_DOMAIN = 0x27
|
SO_DOMAIN = 0x27
|
||||||
SO_DONTROUTE = 0x5
|
SO_DONTROUTE = 0x5
|
||||||
SO_ERROR = 0x4
|
SO_ERROR = 0x4
|
||||||
|
|
25
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
|
@ -112,6 +112,7 @@ const (
|
||||||
HIDIOCGRAWINFO = 0x40084803
|
HIDIOCGRAWINFO = 0x40084803
|
||||||
HIDIOCGRDESC = 0x50044802
|
HIDIOCGRDESC = 0x50044802
|
||||||
HIDIOCGRDESCSIZE = 0x40044801
|
HIDIOCGRDESCSIZE = 0x40044801
|
||||||
|
HIDIOCREVOKE = 0x8004480d
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
IEXTEN = 0x8000
|
IEXTEN = 0x8000
|
||||||
|
@ -155,9 +156,14 @@ const (
|
||||||
NFDBITS = 0x40
|
NFDBITS = 0x40
|
||||||
NLDLY = 0x100
|
NLDLY = 0x100
|
||||||
NOFLSH = 0x80
|
NOFLSH = 0x80
|
||||||
|
NS_GET_MNTNS_ID = 0x4008b705
|
||||||
NS_GET_NSTYPE = 0x2000b703
|
NS_GET_NSTYPE = 0x2000b703
|
||||||
NS_GET_OWNER_UID = 0x2000b704
|
NS_GET_OWNER_UID = 0x2000b704
|
||||||
NS_GET_PARENT = 0x2000b702
|
NS_GET_PARENT = 0x2000b702
|
||||||
|
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||||
|
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||||
|
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||||
|
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||||
NS_GET_USERNS = 0x2000b701
|
NS_GET_USERNS = 0x2000b701
|
||||||
OLCUC = 0x2
|
OLCUC = 0x2
|
||||||
ONLCR = 0x4
|
ONLCR = 0x4
|
||||||
|
@ -234,6 +240,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPAREGS = 0x14
|
PTRACE_GETFPAREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPREGS64 = 0x19
|
PTRACE_GETFPREGS64 = 0x19
|
||||||
|
@ -331,6 +351,8 @@ const (
|
||||||
RTC_WIE_ON = 0x2000700f
|
RTC_WIE_ON = 0x2000700f
|
||||||
RTC_WKALM_RD = 0x40287010
|
RTC_WKALM_RD = 0x40287010
|
||||||
RTC_WKALM_SET = 0x8028700f
|
RTC_WKALM_SET = 0x8028700f
|
||||||
|
SCM_DEVMEM_DMABUF = 0x58
|
||||||
|
SCM_DEVMEM_LINEAR = 0x57
|
||||||
SCM_TIMESTAMPING = 0x23
|
SCM_TIMESTAMPING = 0x23
|
||||||
SCM_TIMESTAMPING_OPT_STATS = 0x38
|
SCM_TIMESTAMPING_OPT_STATS = 0x38
|
||||||
SCM_TIMESTAMPING_PKTINFO = 0x3c
|
SCM_TIMESTAMPING_PKTINFO = 0x3c
|
||||||
|
@ -417,6 +439,9 @@ const (
|
||||||
SO_CNX_ADVICE = 0x37
|
SO_CNX_ADVICE = 0x37
|
||||||
SO_COOKIE = 0x3b
|
SO_COOKIE = 0x3b
|
||||||
SO_DETACH_REUSEPORT_BPF = 0x47
|
SO_DETACH_REUSEPORT_BPF = 0x47
|
||||||
|
SO_DEVMEM_DMABUF = 0x58
|
||||||
|
SO_DEVMEM_DONTNEED = 0x59
|
||||||
|
SO_DEVMEM_LINEAR = 0x57
|
||||||
SO_DOMAIN = 0x1029
|
SO_DOMAIN = 0x1029
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
|
|
27
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
27
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
|
@ -592,6 +592,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ClockSettime(clockid int32, time *Timespec) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_CLOCK_SETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
|
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
|
||||||
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0)
|
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -971,23 +981,6 @@ func Getpriority(which int, who int) (prio int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Getrandom(buf []byte, flags int) (n int, err error) {
|
|
||||||
var _p0 unsafe.Pointer
|
|
||||||
if len(buf) > 0 {
|
|
||||||
_p0 = unsafe.Pointer(&buf[0])
|
|
||||||
} else {
|
|
||||||
_p0 = unsafe.Pointer(&_zero)
|
|
||||||
}
|
|
||||||
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
|
|
||||||
n = int(r0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Getrusage(who int, rusage *Rusage) (err error) {
|
func Getrusage(who int, rusage *Rusage) (err error) {
|
||||||
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
|
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
generated
vendored
|
@ -341,6 +341,7 @@ const (
|
||||||
SYS_STATX = 332
|
SYS_STATX = 332
|
||||||
SYS_IO_PGETEVENTS = 333
|
SYS_IO_PGETEVENTS = 333
|
||||||
SYS_RSEQ = 334
|
SYS_RSEQ = 334
|
||||||
|
SYS_URETPROBE = 335
|
||||||
SYS_PIDFD_SEND_SIGNAL = 424
|
SYS_PIDFD_SEND_SIGNAL = 424
|
||||||
SYS_IO_URING_SETUP = 425
|
SYS_IO_URING_SETUP = 425
|
||||||
SYS_IO_URING_ENTER = 426
|
SYS_IO_URING_ENTER = 426
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
|
@ -85,7 +85,7 @@ const (
|
||||||
SYS_SPLICE = 76
|
SYS_SPLICE = 76
|
||||||
SYS_TEE = 77
|
SYS_TEE = 77
|
||||||
SYS_READLINKAT = 78
|
SYS_READLINKAT = 78
|
||||||
SYS_FSTATAT = 79
|
SYS_NEWFSTATAT = 79
|
||||||
SYS_FSTAT = 80
|
SYS_FSTAT = 80
|
||||||
SYS_SYNC = 81
|
SYS_SYNC = 81
|
||||||
SYS_FSYNC = 82
|
SYS_FSYNC = 82
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
generated
vendored
|
@ -84,6 +84,8 @@ const (
|
||||||
SYS_SPLICE = 76
|
SYS_SPLICE = 76
|
||||||
SYS_TEE = 77
|
SYS_TEE = 77
|
||||||
SYS_READLINKAT = 78
|
SYS_READLINKAT = 78
|
||||||
|
SYS_NEWFSTATAT = 79
|
||||||
|
SYS_FSTAT = 80
|
||||||
SYS_SYNC = 81
|
SYS_SYNC = 81
|
||||||
SYS_FSYNC = 82
|
SYS_FSYNC = 82
|
||||||
SYS_FDATASYNC = 83
|
SYS_FDATASYNC = 83
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
|
@ -84,7 +84,7 @@ const (
|
||||||
SYS_SPLICE = 76
|
SYS_SPLICE = 76
|
||||||
SYS_TEE = 77
|
SYS_TEE = 77
|
||||||
SYS_READLINKAT = 78
|
SYS_READLINKAT = 78
|
||||||
SYS_FSTATAT = 79
|
SYS_NEWFSTATAT = 79
|
||||||
SYS_FSTAT = 80
|
SYS_FSTAT = 80
|
||||||
SYS_SYNC = 81
|
SYS_SYNC = 81
|
||||||
SYS_FSYNC = 82
|
SYS_FSYNC = 82
|
||||||
|
|
60
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
60
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
|
@ -462,11 +462,14 @@ type FdSet struct {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofIfMsghdr = 0x70
|
SizeofIfMsghdr = 0x70
|
||||||
|
SizeofIfMsghdr2 = 0xa0
|
||||||
SizeofIfData = 0x60
|
SizeofIfData = 0x60
|
||||||
|
SizeofIfData64 = 0x80
|
||||||
SizeofIfaMsghdr = 0x14
|
SizeofIfaMsghdr = 0x14
|
||||||
SizeofIfmaMsghdr = 0x10
|
SizeofIfmaMsghdr = 0x10
|
||||||
SizeofIfmaMsghdr2 = 0x14
|
SizeofIfmaMsghdr2 = 0x14
|
||||||
SizeofRtMsghdr = 0x5c
|
SizeofRtMsghdr = 0x5c
|
||||||
|
SizeofRtMsghdr2 = 0x5c
|
||||||
SizeofRtMetrics = 0x38
|
SizeofRtMetrics = 0x38
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -480,6 +483,20 @@ type IfMsghdr struct {
|
||||||
Data IfData
|
Data IfData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IfMsghdr2 struct {
|
||||||
|
Msglen uint16
|
||||||
|
Version uint8
|
||||||
|
Type uint8
|
||||||
|
Addrs int32
|
||||||
|
Flags int32
|
||||||
|
Index uint16
|
||||||
|
Snd_len int32
|
||||||
|
Snd_maxlen int32
|
||||||
|
Snd_drops int32
|
||||||
|
Timer int32
|
||||||
|
Data IfData64
|
||||||
|
}
|
||||||
|
|
||||||
type IfData struct {
|
type IfData struct {
|
||||||
Type uint8
|
Type uint8
|
||||||
Typelen uint8
|
Typelen uint8
|
||||||
|
@ -512,6 +529,34 @@ type IfData struct {
|
||||||
Reserved2 uint32
|
Reserved2 uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IfData64 struct {
|
||||||
|
Type uint8
|
||||||
|
Typelen uint8
|
||||||
|
Physical uint8
|
||||||
|
Addrlen uint8
|
||||||
|
Hdrlen uint8
|
||||||
|
Recvquota uint8
|
||||||
|
Xmitquota uint8
|
||||||
|
Unused1 uint8
|
||||||
|
Mtu uint32
|
||||||
|
Metric uint32
|
||||||
|
Baudrate uint64
|
||||||
|
Ipackets uint64
|
||||||
|
Ierrors uint64
|
||||||
|
Opackets uint64
|
||||||
|
Oerrors uint64
|
||||||
|
Collisions uint64
|
||||||
|
Ibytes uint64
|
||||||
|
Obytes uint64
|
||||||
|
Imcasts uint64
|
||||||
|
Omcasts uint64
|
||||||
|
Iqdrops uint64
|
||||||
|
Noproto uint64
|
||||||
|
Recvtiming uint32
|
||||||
|
Xmittiming uint32
|
||||||
|
Lastchange Timeval32
|
||||||
|
}
|
||||||
|
|
||||||
type IfaMsghdr struct {
|
type IfaMsghdr struct {
|
||||||
Msglen uint16
|
Msglen uint16
|
||||||
Version uint8
|
Version uint8
|
||||||
|
@ -557,6 +602,21 @@ type RtMsghdr struct {
|
||||||
Rmx RtMetrics
|
Rmx RtMetrics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RtMsghdr2 struct {
|
||||||
|
Msglen uint16
|
||||||
|
Version uint8
|
||||||
|
Type uint8
|
||||||
|
Index uint16
|
||||||
|
Flags int32
|
||||||
|
Addrs int32
|
||||||
|
Refcnt int32
|
||||||
|
Parentflags int32
|
||||||
|
Reserved int32
|
||||||
|
Use int32
|
||||||
|
Inits uint32
|
||||||
|
Rmx RtMetrics
|
||||||
|
}
|
||||||
|
|
||||||
type RtMetrics struct {
|
type RtMetrics struct {
|
||||||
Locks uint32
|
Locks uint32
|
||||||
Mtu uint32
|
Mtu uint32
|
||||||
|
|
60
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
60
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
|
@ -462,11 +462,14 @@ type FdSet struct {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofIfMsghdr = 0x70
|
SizeofIfMsghdr = 0x70
|
||||||
|
SizeofIfMsghdr2 = 0xa0
|
||||||
SizeofIfData = 0x60
|
SizeofIfData = 0x60
|
||||||
|
SizeofIfData64 = 0x80
|
||||||
SizeofIfaMsghdr = 0x14
|
SizeofIfaMsghdr = 0x14
|
||||||
SizeofIfmaMsghdr = 0x10
|
SizeofIfmaMsghdr = 0x10
|
||||||
SizeofIfmaMsghdr2 = 0x14
|
SizeofIfmaMsghdr2 = 0x14
|
||||||
SizeofRtMsghdr = 0x5c
|
SizeofRtMsghdr = 0x5c
|
||||||
|
SizeofRtMsghdr2 = 0x5c
|
||||||
SizeofRtMetrics = 0x38
|
SizeofRtMetrics = 0x38
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -480,6 +483,20 @@ type IfMsghdr struct {
|
||||||
Data IfData
|
Data IfData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IfMsghdr2 struct {
|
||||||
|
Msglen uint16
|
||||||
|
Version uint8
|
||||||
|
Type uint8
|
||||||
|
Addrs int32
|
||||||
|
Flags int32
|
||||||
|
Index uint16
|
||||||
|
Snd_len int32
|
||||||
|
Snd_maxlen int32
|
||||||
|
Snd_drops int32
|
||||||
|
Timer int32
|
||||||
|
Data IfData64
|
||||||
|
}
|
||||||
|
|
||||||
type IfData struct {
|
type IfData struct {
|
||||||
Type uint8
|
Type uint8
|
||||||
Typelen uint8
|
Typelen uint8
|
||||||
|
@ -512,6 +529,34 @@ type IfData struct {
|
||||||
Reserved2 uint32
|
Reserved2 uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IfData64 struct {
|
||||||
|
Type uint8
|
||||||
|
Typelen uint8
|
||||||
|
Physical uint8
|
||||||
|
Addrlen uint8
|
||||||
|
Hdrlen uint8
|
||||||
|
Recvquota uint8
|
||||||
|
Xmitquota uint8
|
||||||
|
Unused1 uint8
|
||||||
|
Mtu uint32
|
||||||
|
Metric uint32
|
||||||
|
Baudrate uint64
|
||||||
|
Ipackets uint64
|
||||||
|
Ierrors uint64
|
||||||
|
Opackets uint64
|
||||||
|
Oerrors uint64
|
||||||
|
Collisions uint64
|
||||||
|
Ibytes uint64
|
||||||
|
Obytes uint64
|
||||||
|
Imcasts uint64
|
||||||
|
Omcasts uint64
|
||||||
|
Iqdrops uint64
|
||||||
|
Noproto uint64
|
||||||
|
Recvtiming uint32
|
||||||
|
Xmittiming uint32
|
||||||
|
Lastchange Timeval32
|
||||||
|
}
|
||||||
|
|
||||||
type IfaMsghdr struct {
|
type IfaMsghdr struct {
|
||||||
Msglen uint16
|
Msglen uint16
|
||||||
Version uint8
|
Version uint8
|
||||||
|
@ -557,6 +602,21 @@ type RtMsghdr struct {
|
||||||
Rmx RtMetrics
|
Rmx RtMetrics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RtMsghdr2 struct {
|
||||||
|
Msglen uint16
|
||||||
|
Version uint8
|
||||||
|
Type uint8
|
||||||
|
Index uint16
|
||||||
|
Flags int32
|
||||||
|
Addrs int32
|
||||||
|
Refcnt int32
|
||||||
|
Parentflags int32
|
||||||
|
Reserved int32
|
||||||
|
Use int32
|
||||||
|
Inits uint32
|
||||||
|
Rmx RtMetrics
|
||||||
|
}
|
||||||
|
|
||||||
type RtMetrics struct {
|
type RtMetrics struct {
|
||||||
Locks uint32
|
Locks uint32
|
||||||
Mtu uint32
|
Mtu uint32
|
||||||
|
|
222
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
222
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
|
@ -87,31 +87,35 @@ type StatxTimestamp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statx_t struct {
|
type Statx_t struct {
|
||||||
Mask uint32
|
Mask uint32
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Attributes uint64
|
Attributes uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
_ [1]uint16
|
_ [1]uint16
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Size uint64
|
Size uint64
|
||||||
Blocks uint64
|
Blocks uint64
|
||||||
Attributes_mask uint64
|
Attributes_mask uint64
|
||||||
Atime StatxTimestamp
|
Atime StatxTimestamp
|
||||||
Btime StatxTimestamp
|
Btime StatxTimestamp
|
||||||
Ctime StatxTimestamp
|
Ctime StatxTimestamp
|
||||||
Mtime StatxTimestamp
|
Mtime StatxTimestamp
|
||||||
Rdev_major uint32
|
Rdev_major uint32
|
||||||
Rdev_minor uint32
|
Rdev_minor uint32
|
||||||
Dev_major uint32
|
Dev_major uint32
|
||||||
Dev_minor uint32
|
Dev_minor uint32
|
||||||
Mnt_id uint64
|
Mnt_id uint64
|
||||||
Dio_mem_align uint32
|
Dio_mem_align uint32
|
||||||
Dio_offset_align uint32
|
Dio_offset_align uint32
|
||||||
Subvol uint64
|
Subvol uint64
|
||||||
_ [11]uint64
|
Atomic_write_unit_min uint32
|
||||||
|
Atomic_write_unit_max uint32
|
||||||
|
Atomic_write_segments_max uint32
|
||||||
|
_ [1]uint32
|
||||||
|
_ [9]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Fsid struct {
|
type Fsid struct {
|
||||||
|
@ -516,6 +520,29 @@ type TCPInfo struct {
|
||||||
Total_rto_time uint32
|
Total_rto_time uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TCPVegasInfo struct {
|
||||||
|
Enabled uint32
|
||||||
|
Rttcnt uint32
|
||||||
|
Rtt uint32
|
||||||
|
Minrtt uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type TCPDCTCPInfo struct {
|
||||||
|
Enabled uint16
|
||||||
|
Ce_state uint16
|
||||||
|
Alpha uint32
|
||||||
|
Ab_ecn uint32
|
||||||
|
Ab_tot uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type TCPBBRInfo struct {
|
||||||
|
Bw_lo uint32
|
||||||
|
Bw_hi uint32
|
||||||
|
Min_rtt uint32
|
||||||
|
Pacing_gain uint32
|
||||||
|
Cwnd_gain uint32
|
||||||
|
}
|
||||||
|
|
||||||
type CanFilter struct {
|
type CanFilter struct {
|
||||||
Id uint32
|
Id uint32
|
||||||
Mask uint32
|
Mask uint32
|
||||||
|
@ -557,6 +584,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0xf8
|
SizeofTCPInfo = 0xf8
|
||||||
|
SizeofTCPCCInfo = 0x14
|
||||||
SizeofCanFilter = 0x8
|
SizeofCanFilter = 0x8
|
||||||
SizeofTCPRepairOpt = 0x8
|
SizeofTCPRepairOpt = 0x8
|
||||||
)
|
)
|
||||||
|
@ -1724,12 +1752,6 @@ const (
|
||||||
IFLA_IPVLAN_UNSPEC = 0x0
|
IFLA_IPVLAN_UNSPEC = 0x0
|
||||||
IFLA_IPVLAN_MODE = 0x1
|
IFLA_IPVLAN_MODE = 0x1
|
||||||
IFLA_IPVLAN_FLAGS = 0x2
|
IFLA_IPVLAN_FLAGS = 0x2
|
||||||
NETKIT_NEXT = -0x1
|
|
||||||
NETKIT_PASS = 0x0
|
|
||||||
NETKIT_DROP = 0x2
|
|
||||||
NETKIT_REDIRECT = 0x7
|
|
||||||
NETKIT_L2 = 0x0
|
|
||||||
NETKIT_L3 = 0x1
|
|
||||||
IFLA_NETKIT_UNSPEC = 0x0
|
IFLA_NETKIT_UNSPEC = 0x0
|
||||||
IFLA_NETKIT_PEER_INFO = 0x1
|
IFLA_NETKIT_PEER_INFO = 0x1
|
||||||
IFLA_NETKIT_PRIMARY = 0x2
|
IFLA_NETKIT_PRIMARY = 0x2
|
||||||
|
@ -1768,6 +1790,7 @@ const (
|
||||||
IFLA_VXLAN_DF = 0x1d
|
IFLA_VXLAN_DF = 0x1d
|
||||||
IFLA_VXLAN_VNIFILTER = 0x1e
|
IFLA_VXLAN_VNIFILTER = 0x1e
|
||||||
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
||||||
|
IFLA_VXLAN_LABEL_POLICY = 0x20
|
||||||
IFLA_GENEVE_UNSPEC = 0x0
|
IFLA_GENEVE_UNSPEC = 0x0
|
||||||
IFLA_GENEVE_ID = 0x1
|
IFLA_GENEVE_ID = 0x1
|
||||||
IFLA_GENEVE_REMOTE = 0x2
|
IFLA_GENEVE_REMOTE = 0x2
|
||||||
|
@ -1797,6 +1820,8 @@ const (
|
||||||
IFLA_GTP_ROLE = 0x4
|
IFLA_GTP_ROLE = 0x4
|
||||||
IFLA_GTP_CREATE_SOCKETS = 0x5
|
IFLA_GTP_CREATE_SOCKETS = 0x5
|
||||||
IFLA_GTP_RESTART_COUNT = 0x6
|
IFLA_GTP_RESTART_COUNT = 0x6
|
||||||
|
IFLA_GTP_LOCAL = 0x7
|
||||||
|
IFLA_GTP_LOCAL6 = 0x8
|
||||||
IFLA_BOND_UNSPEC = 0x0
|
IFLA_BOND_UNSPEC = 0x0
|
||||||
IFLA_BOND_MODE = 0x1
|
IFLA_BOND_MODE = 0x1
|
||||||
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
||||||
|
@ -1829,6 +1854,7 @@ const (
|
||||||
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
||||||
IFLA_BOND_MISSED_MAX = 0x1e
|
IFLA_BOND_MISSED_MAX = 0x1e
|
||||||
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
||||||
|
IFLA_BOND_COUPLED_CONTROL = 0x20
|
||||||
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
||||||
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
||||||
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
||||||
|
@ -1897,6 +1923,7 @@ const (
|
||||||
IFLA_HSR_SEQ_NR = 0x5
|
IFLA_HSR_SEQ_NR = 0x5
|
||||||
IFLA_HSR_VERSION = 0x6
|
IFLA_HSR_VERSION = 0x6
|
||||||
IFLA_HSR_PROTOCOL = 0x7
|
IFLA_HSR_PROTOCOL = 0x7
|
||||||
|
IFLA_HSR_INTERLINK = 0x8
|
||||||
IFLA_STATS_UNSPEC = 0x0
|
IFLA_STATS_UNSPEC = 0x0
|
||||||
IFLA_STATS_LINK_64 = 0x1
|
IFLA_STATS_LINK_64 = 0x1
|
||||||
IFLA_STATS_LINK_XSTATS = 0x2
|
IFLA_STATS_LINK_XSTATS = 0x2
|
||||||
|
@ -1949,6 +1976,15 @@ const (
|
||||||
IFLA_DSA_MASTER = 0x1
|
IFLA_DSA_MASTER = 0x1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
NETKIT_NEXT = -0x1
|
||||||
|
NETKIT_PASS = 0x0
|
||||||
|
NETKIT_DROP = 0x2
|
||||||
|
NETKIT_REDIRECT = 0x7
|
||||||
|
NETKIT_L2 = 0x0
|
||||||
|
NETKIT_L3 = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NF_INET_PRE_ROUTING = 0x0
|
NF_INET_PRE_ROUTING = 0x0
|
||||||
NF_INET_LOCAL_IN = 0x1
|
NF_INET_LOCAL_IN = 0x1
|
||||||
|
@ -2558,8 +2594,8 @@ const (
|
||||||
SOF_TIMESTAMPING_BIND_PHC = 0x8000
|
SOF_TIMESTAMPING_BIND_PHC = 0x8000
|
||||||
SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000
|
SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000
|
||||||
|
|
||||||
SOF_TIMESTAMPING_LAST = 0x10000
|
SOF_TIMESTAMPING_LAST = 0x20000
|
||||||
SOF_TIMESTAMPING_MASK = 0x1ffff
|
SOF_TIMESTAMPING_MASK = 0x3ffff
|
||||||
|
|
||||||
SCM_TSTAMP_SND = 0x0
|
SCM_TSTAMP_SND = 0x0
|
||||||
SCM_TSTAMP_SCHED = 0x1
|
SCM_TSTAMP_SCHED = 0x1
|
||||||
|
@ -3505,7 +3541,7 @@ type Nhmsg struct {
|
||||||
type NexthopGrp struct {
|
type NexthopGrp struct {
|
||||||
Id uint32
|
Id uint32
|
||||||
Weight uint8
|
Weight uint8
|
||||||
Resvd1 uint8
|
High uint8
|
||||||
Resvd2 uint16
|
Resvd2 uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3766,7 +3802,7 @@ const (
|
||||||
ETHTOOL_MSG_PSE_GET = 0x24
|
ETHTOOL_MSG_PSE_GET = 0x24
|
||||||
ETHTOOL_MSG_PSE_SET = 0x25
|
ETHTOOL_MSG_PSE_SET = 0x25
|
||||||
ETHTOOL_MSG_RSS_GET = 0x26
|
ETHTOOL_MSG_RSS_GET = 0x26
|
||||||
ETHTOOL_MSG_USER_MAX = 0x2b
|
ETHTOOL_MSG_USER_MAX = 0x2d
|
||||||
ETHTOOL_MSG_KERNEL_NONE = 0x0
|
ETHTOOL_MSG_KERNEL_NONE = 0x0
|
||||||
ETHTOOL_MSG_STRSET_GET_REPLY = 0x1
|
ETHTOOL_MSG_STRSET_GET_REPLY = 0x1
|
||||||
ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2
|
ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2
|
||||||
|
@ -3806,7 +3842,7 @@ const (
|
||||||
ETHTOOL_MSG_MODULE_NTF = 0x24
|
ETHTOOL_MSG_MODULE_NTF = 0x24
|
||||||
ETHTOOL_MSG_PSE_GET_REPLY = 0x25
|
ETHTOOL_MSG_PSE_GET_REPLY = 0x25
|
||||||
ETHTOOL_MSG_RSS_GET_REPLY = 0x26
|
ETHTOOL_MSG_RSS_GET_REPLY = 0x26
|
||||||
ETHTOOL_MSG_KERNEL_MAX = 0x2b
|
ETHTOOL_MSG_KERNEL_MAX = 0x2e
|
||||||
ETHTOOL_FLAG_COMPACT_BITSETS = 0x1
|
ETHTOOL_FLAG_COMPACT_BITSETS = 0x1
|
||||||
ETHTOOL_FLAG_OMIT_REPLY = 0x2
|
ETHTOOL_FLAG_OMIT_REPLY = 0x2
|
||||||
ETHTOOL_FLAG_STATS = 0x4
|
ETHTOOL_FLAG_STATS = 0x4
|
||||||
|
@ -3814,7 +3850,7 @@ const (
|
||||||
ETHTOOL_A_HEADER_DEV_INDEX = 0x1
|
ETHTOOL_A_HEADER_DEV_INDEX = 0x1
|
||||||
ETHTOOL_A_HEADER_DEV_NAME = 0x2
|
ETHTOOL_A_HEADER_DEV_NAME = 0x2
|
||||||
ETHTOOL_A_HEADER_FLAGS = 0x3
|
ETHTOOL_A_HEADER_FLAGS = 0x3
|
||||||
ETHTOOL_A_HEADER_MAX = 0x3
|
ETHTOOL_A_HEADER_MAX = 0x4
|
||||||
ETHTOOL_A_BITSET_BIT_UNSPEC = 0x0
|
ETHTOOL_A_BITSET_BIT_UNSPEC = 0x0
|
||||||
ETHTOOL_A_BITSET_BIT_INDEX = 0x1
|
ETHTOOL_A_BITSET_BIT_INDEX = 0x1
|
||||||
ETHTOOL_A_BITSET_BIT_NAME = 0x2
|
ETHTOOL_A_BITSET_BIT_NAME = 0x2
|
||||||
|
@ -3951,7 +3987,7 @@ const (
|
||||||
ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17
|
ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17
|
||||||
ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18
|
ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18
|
||||||
ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19
|
ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19
|
||||||
ETHTOOL_A_COALESCE_MAX = 0x1c
|
ETHTOOL_A_COALESCE_MAX = 0x1e
|
||||||
ETHTOOL_A_PAUSE_UNSPEC = 0x0
|
ETHTOOL_A_PAUSE_UNSPEC = 0x0
|
||||||
ETHTOOL_A_PAUSE_HEADER = 0x1
|
ETHTOOL_A_PAUSE_HEADER = 0x1
|
||||||
ETHTOOL_A_PAUSE_AUTONEG = 0x2
|
ETHTOOL_A_PAUSE_AUTONEG = 0x2
|
||||||
|
@ -3995,11 +4031,11 @@ const (
|
||||||
ETHTOOL_A_CABLE_RESULT_UNSPEC = 0x0
|
ETHTOOL_A_CABLE_RESULT_UNSPEC = 0x0
|
||||||
ETHTOOL_A_CABLE_RESULT_PAIR = 0x1
|
ETHTOOL_A_CABLE_RESULT_PAIR = 0x1
|
||||||
ETHTOOL_A_CABLE_RESULT_CODE = 0x2
|
ETHTOOL_A_CABLE_RESULT_CODE = 0x2
|
||||||
ETHTOOL_A_CABLE_RESULT_MAX = 0x2
|
ETHTOOL_A_CABLE_RESULT_MAX = 0x3
|
||||||
ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC = 0x0
|
ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC = 0x0
|
||||||
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 0x1
|
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 0x1
|
||||||
ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 0x2
|
ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 0x2
|
||||||
ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = 0x2
|
ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = 0x3
|
||||||
ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC = 0x0
|
ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC = 0x0
|
||||||
ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED = 0x1
|
ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED = 0x1
|
||||||
ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED = 0x2
|
ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED = 0x2
|
||||||
|
@ -4082,6 +4118,107 @@ type EthtoolDrvinfo struct {
|
||||||
Regdump_len uint32
|
Regdump_len uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EthtoolTsInfo struct {
|
||||||
|
Cmd uint32
|
||||||
|
So_timestamping uint32
|
||||||
|
Phc_index int32
|
||||||
|
Tx_types uint32
|
||||||
|
Tx_reserved [3]uint32
|
||||||
|
Rx_filters uint32
|
||||||
|
Rx_reserved [3]uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type HwTstampConfig struct {
|
||||||
|
Flags int32
|
||||||
|
Tx_type int32
|
||||||
|
Rx_filter int32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
HWTSTAMP_FILTER_NONE = 0x0
|
||||||
|
HWTSTAMP_FILTER_ALL = 0x1
|
||||||
|
HWTSTAMP_FILTER_SOME = 0x2
|
||||||
|
HWTSTAMP_FILTER_PTP_V1_L4_EVENT = 0x3
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_L4_EVENT = 0x6
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_L2_EVENT = 0x9
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_EVENT = 0xc
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
HWTSTAMP_TX_OFF = 0x0
|
||||||
|
HWTSTAMP_TX_ON = 0x1
|
||||||
|
HWTSTAMP_TX_ONESTEP_SYNC = 0x2
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
PtpClockCaps struct {
|
||||||
|
Max_adj int32
|
||||||
|
N_alarm int32
|
||||||
|
N_ext_ts int32
|
||||||
|
N_per_out int32
|
||||||
|
Pps int32
|
||||||
|
N_pins int32
|
||||||
|
Cross_timestamping int32
|
||||||
|
Adjust_phase int32
|
||||||
|
Max_phase_adj int32
|
||||||
|
Rsv [11]int32
|
||||||
|
}
|
||||||
|
PtpClockTime struct {
|
||||||
|
Sec int64
|
||||||
|
Nsec uint32
|
||||||
|
Reserved uint32
|
||||||
|
}
|
||||||
|
PtpExttsEvent struct {
|
||||||
|
T PtpClockTime
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
Rsv [2]uint32
|
||||||
|
}
|
||||||
|
PtpExttsRequest struct {
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
Rsv [2]uint32
|
||||||
|
}
|
||||||
|
PtpPeroutRequest struct {
|
||||||
|
StartOrPhase PtpClockTime
|
||||||
|
Period PtpClockTime
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
On PtpClockTime
|
||||||
|
}
|
||||||
|
PtpPinDesc struct {
|
||||||
|
Name [64]byte
|
||||||
|
Index uint32
|
||||||
|
Func uint32
|
||||||
|
Chan uint32
|
||||||
|
Rsv [5]uint32
|
||||||
|
}
|
||||||
|
PtpSysOffset struct {
|
||||||
|
Samples uint32
|
||||||
|
Rsv [3]uint32
|
||||||
|
Ts [51]PtpClockTime
|
||||||
|
}
|
||||||
|
PtpSysOffsetExtended struct {
|
||||||
|
Samples uint32
|
||||||
|
Clockid int32
|
||||||
|
Rsv [2]uint32
|
||||||
|
Ts [25][3]PtpClockTime
|
||||||
|
}
|
||||||
|
PtpSysOffsetPrecise struct {
|
||||||
|
Device PtpClockTime
|
||||||
|
Realtime PtpClockTime
|
||||||
|
Monoraw PtpClockTime
|
||||||
|
Rsv [4]uint32
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PTP_PF_NONE = 0x0
|
||||||
|
PTP_PF_EXTTS = 0x1
|
||||||
|
PTP_PF_PEROUT = 0x2
|
||||||
|
PTP_PF_PHYSYNC = 0x3
|
||||||
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
HIDRawReportDescriptor struct {
|
HIDRawReportDescriptor struct {
|
||||||
Size uint32
|
Size uint32
|
||||||
|
@ -4263,6 +4400,7 @@ const (
|
||||||
type LandlockRulesetAttr struct {
|
type LandlockRulesetAttr struct {
|
||||||
Access_fs uint64
|
Access_fs uint64
|
||||||
Access_net uint64
|
Access_net uint64
|
||||||
|
Scoped uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type LandlockPathBeneathAttr struct {
|
type LandlockPathBeneathAttr struct {
|
||||||
|
@ -4609,7 +4747,7 @@ const (
|
||||||
NL80211_ATTR_MAC_HINT = 0xc8
|
NL80211_ATTR_MAC_HINT = 0xc8
|
||||||
NL80211_ATTR_MAC_MASK = 0xd7
|
NL80211_ATTR_MAC_MASK = 0xd7
|
||||||
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
|
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
|
||||||
NL80211_ATTR_MAX = 0x14a
|
NL80211_ATTR_MAX = 0x14c
|
||||||
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
|
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
|
||||||
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
|
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
|
||||||
NL80211_ATTR_MAX_MATCH_SETS = 0x85
|
NL80211_ATTR_MAX_MATCH_SETS = 0x85
|
||||||
|
@ -5213,7 +5351,7 @@ const (
|
||||||
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
||||||
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
||||||
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
||||||
NL80211_FREQUENCY_ATTR_MAX = 0x20
|
NL80211_FREQUENCY_ATTR_MAX = 0x21
|
||||||
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
||||||
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
||||||
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
||||||
|
|
6
vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
generated
vendored
6
vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
generated
vendored
|
@ -377,6 +377,12 @@ type Flock_t struct {
|
||||||
Pid int32
|
Pid int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type F_cnvrt struct {
|
||||||
|
Cvtcmd int32
|
||||||
|
Pccsid int16
|
||||||
|
Fccsid int16
|
||||||
|
}
|
||||||
|
|
||||||
type Termios struct {
|
type Termios struct {
|
||||||
Cflag uint32
|
Cflag uint32
|
||||||
Iflag uint32
|
Iflag uint32
|
||||||
|
|
2
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
2
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
|
@ -65,7 +65,7 @@ func LoadDLL(name string) (dll *DLL, err error) {
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustLoadDLL is like LoadDLL but panics if load operation failes.
|
// MustLoadDLL is like LoadDLL but panics if load operation fails.
|
||||||
func MustLoadDLL(name string) *DLL {
|
func MustLoadDLL(name string) *DLL {
|
||||||
d, e := LoadDLL(name)
|
d, e := LoadDLL(name)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
|
36
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
36
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
|
@ -168,6 +168,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW
|
//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW
|
||||||
//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error)
|
//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error)
|
||||||
//sys DisconnectNamedPipe(pipe Handle) (err error)
|
//sys DisconnectNamedPipe(pipe Handle) (err error)
|
||||||
|
//sys GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error)
|
||||||
|
//sys GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error)
|
||||||
//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error)
|
//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error)
|
||||||
//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW
|
//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW
|
||||||
//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState
|
//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState
|
||||||
|
@ -725,20 +727,12 @@ func DurationSinceBoot() time.Duration {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Ftruncate(fd Handle, length int64) (err error) {
|
func Ftruncate(fd Handle, length int64) (err error) {
|
||||||
curoffset, e := Seek(fd, 0, 1)
|
type _FILE_END_OF_FILE_INFO struct {
|
||||||
if e != nil {
|
EndOfFile int64
|
||||||
return e
|
|
||||||
}
|
}
|
||||||
defer Seek(fd, curoffset, 0)
|
var info _FILE_END_OF_FILE_INFO
|
||||||
_, e = Seek(fd, length, 0)
|
info.EndOfFile = length
|
||||||
if e != nil {
|
return SetFileInformationByHandle(fd, FileEndOfFileInfo, (*byte)(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info)))
|
||||||
return e
|
|
||||||
}
|
|
||||||
e = SetEndOfFile(fd)
|
|
||||||
if e != nil {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Gettimeofday(tv *Timeval) (err error) {
|
func Gettimeofday(tv *Timeval) (err error) {
|
||||||
|
@ -894,6 +888,11 @@ const socket_error = uintptr(^uint32(0))
|
||||||
//sys GetACP() (acp uint32) = kernel32.GetACP
|
//sys GetACP() (acp uint32) = kernel32.GetACP
|
||||||
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
||||||
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
||||||
|
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
|
||||||
|
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
|
||||||
|
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
|
||||||
|
//sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange
|
||||||
|
//sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2
|
||||||
|
|
||||||
// For testing: clients can set this flag to force
|
// For testing: clients can set this flag to force
|
||||||
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
||||||
|
@ -1685,13 +1684,16 @@ func (s NTStatus) Error() string {
|
||||||
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
|
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
|
||||||
// the more common *uint16 string type.
|
// the more common *uint16 string type.
|
||||||
func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
||||||
var u NTUnicodeString
|
s16, err := UTF16FromString(s)
|
||||||
s16, err := UTF16PtrFromString(s)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&u, s16)
|
n := uint16(len(s16) * 2)
|
||||||
return &u, nil
|
return &NTUnicodeString{
|
||||||
|
Length: n - 2, // subtract 2 bytes for the NULL terminator
|
||||||
|
MaximumLength: n,
|
||||||
|
Buffer: &s16[0],
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
|
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
|
||||||
|
|
127
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
127
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
|
@ -176,6 +176,7 @@ const (
|
||||||
WAIT_FAILED = 0xFFFFFFFF
|
WAIT_FAILED = 0xFFFFFFFF
|
||||||
|
|
||||||
// Access rights for process.
|
// Access rights for process.
|
||||||
|
PROCESS_ALL_ACCESS = 0xFFFF
|
||||||
PROCESS_CREATE_PROCESS = 0x0080
|
PROCESS_CREATE_PROCESS = 0x0080
|
||||||
PROCESS_CREATE_THREAD = 0x0002
|
PROCESS_CREATE_THREAD = 0x0002
|
||||||
PROCESS_DUP_HANDLE = 0x0040
|
PROCESS_DUP_HANDLE = 0x0040
|
||||||
|
@ -2203,6 +2204,132 @@ const (
|
||||||
IfOperStatusLowerLayerDown = 7
|
IfOperStatusLowerLayerDown = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
IF_MAX_PHYS_ADDRESS_LENGTH = 32
|
||||||
|
IF_MAX_STRING_SIZE = 256
|
||||||
|
)
|
||||||
|
|
||||||
|
// MIB_IF_ENTRY_LEVEL enumeration from netioapi.h or
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-getifentry2ex.
|
||||||
|
const (
|
||||||
|
MibIfEntryNormal = 0
|
||||||
|
MibIfEntryNormalWithoutStatistics = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// MIB_NOTIFICATION_TYPE enumeration from netioapi.h or
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_notification_type.
|
||||||
|
const (
|
||||||
|
MibParameterNotification = 0
|
||||||
|
MibAddInstance = 1
|
||||||
|
MibDeleteInstance = 2
|
||||||
|
MibInitialNotification = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// MibIfRow2 stores information about a particular interface. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_row2.
|
||||||
|
type MibIfRow2 struct {
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
InterfaceGuid GUID
|
||||||
|
Alias [IF_MAX_STRING_SIZE + 1]uint16
|
||||||
|
Description [IF_MAX_STRING_SIZE + 1]uint16
|
||||||
|
PhysicalAddressLength uint32
|
||||||
|
PhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||||
|
PermanentPhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||||
|
Mtu uint32
|
||||||
|
Type uint32
|
||||||
|
TunnelType uint32
|
||||||
|
MediaType uint32
|
||||||
|
PhysicalMediumType uint32
|
||||||
|
AccessType uint32
|
||||||
|
DirectionType uint32
|
||||||
|
InterfaceAndOperStatusFlags uint8
|
||||||
|
OperStatus uint32
|
||||||
|
AdminStatus uint32
|
||||||
|
MediaConnectState uint32
|
||||||
|
NetworkGuid GUID
|
||||||
|
ConnectionType uint32
|
||||||
|
TransmitLinkSpeed uint64
|
||||||
|
ReceiveLinkSpeed uint64
|
||||||
|
InOctets uint64
|
||||||
|
InUcastPkts uint64
|
||||||
|
InNUcastPkts uint64
|
||||||
|
InDiscards uint64
|
||||||
|
InErrors uint64
|
||||||
|
InUnknownProtos uint64
|
||||||
|
InUcastOctets uint64
|
||||||
|
InMulticastOctets uint64
|
||||||
|
InBroadcastOctets uint64
|
||||||
|
OutOctets uint64
|
||||||
|
OutUcastPkts uint64
|
||||||
|
OutNUcastPkts uint64
|
||||||
|
OutDiscards uint64
|
||||||
|
OutErrors uint64
|
||||||
|
OutUcastOctets uint64
|
||||||
|
OutMulticastOctets uint64
|
||||||
|
OutBroadcastOctets uint64
|
||||||
|
OutQLen uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row.
|
||||||
|
type MibUnicastIpAddressRow struct {
|
||||||
|
Address RawSockaddrInet6 // SOCKADDR_INET union
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
PrefixOrigin uint32
|
||||||
|
SuffixOrigin uint32
|
||||||
|
ValidLifetime uint32
|
||||||
|
PreferredLifetime uint32
|
||||||
|
OnLinkPrefixLength uint8
|
||||||
|
SkipAsSource uint8
|
||||||
|
DadState uint32
|
||||||
|
ScopeId uint32
|
||||||
|
CreationTimeStamp Filetime
|
||||||
|
}
|
||||||
|
|
||||||
|
const ScopeLevelCount = 16
|
||||||
|
|
||||||
|
// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
|
||||||
|
// See https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row.
|
||||||
|
type MibIpInterfaceRow struct {
|
||||||
|
Family uint16
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
MaxReassemblySize uint32
|
||||||
|
InterfaceIdentifier uint64
|
||||||
|
MinRouterAdvertisementInterval uint32
|
||||||
|
MaxRouterAdvertisementInterval uint32
|
||||||
|
AdvertisingEnabled uint8
|
||||||
|
ForwardingEnabled uint8
|
||||||
|
WeakHostSend uint8
|
||||||
|
WeakHostReceive uint8
|
||||||
|
UseAutomaticMetric uint8
|
||||||
|
UseNeighborUnreachabilityDetection uint8
|
||||||
|
ManagedAddressConfigurationSupported uint8
|
||||||
|
OtherStatefulConfigurationSupported uint8
|
||||||
|
AdvertiseDefaultRoute uint8
|
||||||
|
RouterDiscoveryBehavior uint32
|
||||||
|
DadTransmits uint32
|
||||||
|
BaseReachableTime uint32
|
||||||
|
RetransmitTime uint32
|
||||||
|
PathMtuDiscoveryTimeout uint32
|
||||||
|
LinkLocalAddressBehavior uint32
|
||||||
|
LinkLocalAddressTimeout uint32
|
||||||
|
ZoneIndices [ScopeLevelCount]uint32
|
||||||
|
SitePrefixLength uint32
|
||||||
|
Metric uint32
|
||||||
|
NlMtu uint32
|
||||||
|
Connected uint8
|
||||||
|
SupportsWakeUpPatterns uint8
|
||||||
|
SupportsNeighborDiscovery uint8
|
||||||
|
SupportsRouterDiscovery uint8
|
||||||
|
ReachableTime uint32
|
||||||
|
TransmitOffload uint32
|
||||||
|
ReceiveOffload uint32
|
||||||
|
DisableDefaultRoutes uint8
|
||||||
|
}
|
||||||
|
|
||||||
// Console related constants used for the mode parameter to SetConsoleMode. See
|
// Console related constants used for the mode parameter to SetConsoleMode. See
|
||||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
||||||
|
|
||||||
|
|
71
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
71
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
|
@ -181,10 +181,15 @@ var (
|
||||||
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
|
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
|
||||||
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
|
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
|
||||||
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
|
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
|
||||||
|
procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2")
|
||||||
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
||||||
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
||||||
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
||||||
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
||||||
|
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
|
||||||
|
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
|
||||||
|
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
|
||||||
|
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
|
||||||
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
||||||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||||
procCancelIo = modkernel32.NewProc("CancelIo")
|
procCancelIo = modkernel32.NewProc("CancelIo")
|
||||||
|
@ -275,8 +280,10 @@ var (
|
||||||
procGetMaximumProcessorCount = modkernel32.NewProc("GetMaximumProcessorCount")
|
procGetMaximumProcessorCount = modkernel32.NewProc("GetMaximumProcessorCount")
|
||||||
procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW")
|
procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW")
|
||||||
procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW")
|
procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW")
|
||||||
|
procGetNamedPipeClientProcessId = modkernel32.NewProc("GetNamedPipeClientProcessId")
|
||||||
procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
|
procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
|
||||||
procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo")
|
procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo")
|
||||||
|
procGetNamedPipeServerProcessId = modkernel32.NewProc("GetNamedPipeServerProcessId")
|
||||||
procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
|
procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
|
||||||
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
|
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
|
||||||
procGetProcAddress = modkernel32.NewProc("GetProcAddress")
|
procGetProcAddress = modkernel32.NewProc("GetProcAddress")
|
||||||
|
@ -1606,6 +1613,14 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procCancelMibChangeNotify2.Addr(), 1, uintptr(notificationHandle), 0, 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
||||||
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
|
@ -1638,6 +1653,46 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetIfEntry2Ex.Addr(), 2, uintptr(level), uintptr(unsafe.Pointer(row)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if initialNotification {
|
||||||
|
_p0 = 1
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall6(procNotifyIpInterfaceChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if initialNotification {
|
||||||
|
_p0 = 1
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall6(procNotifyUnicastIpAddressChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||||
cookie = uintptr(r0)
|
cookie = uintptr(r0)
|
||||||
|
@ -2393,6 +2448,14 @@ func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err er
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procGetNamedPipeClientProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
|
func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
|
r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -2409,6 +2472,14 @@ func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint3
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procGetNamedPipeServerProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
|
func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
|
||||||
var _p0 uint32
|
var _p0 uint32
|
||||||
if wait {
|
if wait {
|
||||||
|
|
117
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
117
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
|
@ -2,22 +2,64 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package gcexportdata provides functions for locating, reading, and
|
// Package gcexportdata provides functions for reading and writing
|
||||||
// writing export data files containing type information produced by the
|
// export data, which is a serialized description of the API of a Go
|
||||||
// gc compiler. This package supports go1.7 export data format and all
|
// package including the names, kinds, types, and locations of all
|
||||||
// later versions.
|
// exported declarations.
|
||||||
//
|
//
|
||||||
// Although it might seem convenient for this package to live alongside
|
// The standard Go compiler (cmd/compile) writes an export data file
|
||||||
// go/types in the standard library, this would cause version skew
|
// for each package it compiles, which it later reads when compiling
|
||||||
// problems for developer tools that use it, since they must be able to
|
// packages that import the earlier one. The compiler must thus
|
||||||
// consume the outputs of the gc compiler both before and after a Go
|
// contain logic to both write and read export data.
|
||||||
// update such as from Go 1.7 to Go 1.8. Because this package lives in
|
// (See the "Export" section in the cmd/compile/README file.)
|
||||||
// golang.org/x/tools, sites can update their version of this repo some
|
//
|
||||||
// time before the Go 1.8 release and rebuild and redeploy their
|
// The [Read] function in this package can read files produced by the
|
||||||
// developer tools, which will then be able to consume both Go 1.7 and
|
// compiler, producing [go/types] data structures. As a matter of
|
||||||
// Go 1.8 export data files, so they will work before and after the
|
// policy, Read supports export data files produced by only the last
|
||||||
// Go update. (See discussion at https://golang.org/issue/15651.)
|
// two Go releases plus tip; see https://go.dev/issue/68898. The
|
||||||
package gcexportdata // import "golang.org/x/tools/go/gcexportdata"
|
// export data files produced by the compiler contain additional
|
||||||
|
// details related to generics, inlining, and other optimizations that
|
||||||
|
// cannot be decoded by the [Read] function.
|
||||||
|
//
|
||||||
|
// In files written by the compiler, the export data is not at the
|
||||||
|
// start of the file. Before calling Read, use [NewReader] to locate
|
||||||
|
// the desired portion of the file.
|
||||||
|
//
|
||||||
|
// The [Write] function in this package encodes the exported API of a
|
||||||
|
// Go package ([types.Package]) as a file. Such files can be later
|
||||||
|
// decoded by Read, but cannot be consumed by the compiler.
|
||||||
|
//
|
||||||
|
// # Future changes
|
||||||
|
//
|
||||||
|
// Although Read supports the formats written by both Write and the
|
||||||
|
// compiler, the two are quite different, and there is an open
|
||||||
|
// proposal (https://go.dev/issue/69491) to separate these APIs.
|
||||||
|
//
|
||||||
|
// Under that proposal, this package would ultimately provide only the
|
||||||
|
// Read operation for compiler export data, which must be defined in
|
||||||
|
// this module (golang.org/x/tools), not in the standard library, to
|
||||||
|
// avoid version skew for developer tools that need to read compiler
|
||||||
|
// export data both before and after a Go release, such as from Go
|
||||||
|
// 1.23 to Go 1.24. Because this package lives in the tools module,
|
||||||
|
// clients can update their version of the module some time before the
|
||||||
|
// Go 1.24 release and rebuild and redeploy their tools, which will
|
||||||
|
// then be able to consume both Go 1.23 and Go 1.24 export data files,
|
||||||
|
// so they will work before and after the Go update. (See discussion
|
||||||
|
// at https://go.dev/issue/15651.)
|
||||||
|
//
|
||||||
|
// The operations to import and export [go/types] data structures
|
||||||
|
// would be defined in the go/types package as Import and Export.
|
||||||
|
// [Write] would (eventually) delegate to Export,
|
||||||
|
// and [Read], when it detects a file produced by Export,
|
||||||
|
// would delegate to Import.
|
||||||
|
//
|
||||||
|
// # Deprecations
|
||||||
|
//
|
||||||
|
// The [NewImporter] and [Find] functions are deprecated and should
|
||||||
|
// not be used in new code. The [WriteBundle] and [ReadBundle]
|
||||||
|
// functions are experimental, and there is an open proposal to
|
||||||
|
// deprecate them (https://go.dev/issue/69573).
|
||||||
|
package gcexportdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
@ -64,24 +106,18 @@ func Find(importPath, srcDir string) (filename, path string) {
|
||||||
// additional trailing data beyond the end of the export data.
|
// additional trailing data beyond the end of the export data.
|
||||||
func NewReader(r io.Reader) (io.Reader, error) {
|
func NewReader(r io.Reader) (io.Reader, error) {
|
||||||
buf := bufio.NewReader(r)
|
buf := bufio.NewReader(r)
|
||||||
_, size, err := gcimporter.FindExportData(buf)
|
size, err := gcimporter.FindExportData(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if size >= 0 {
|
// We were given an archive and found the __.PKGDEF in it.
|
||||||
// We were given an archive and found the __.PKGDEF in it.
|
// This tells us the size of the export data, and we don't
|
||||||
// This tells us the size of the export data, and we don't
|
// need to return the entire file.
|
||||||
// need to return the entire file.
|
return &io.LimitedReader{
|
||||||
return &io.LimitedReader{
|
R: buf,
|
||||||
R: buf,
|
N: size,
|
||||||
N: size,
|
}, nil
|
||||||
}, nil
|
|
||||||
} else {
|
|
||||||
// We were given an object file. As such, we don't know how large
|
|
||||||
// the export data is and must return the entire file.
|
|
||||||
return buf, nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// readAll works the same way as io.ReadAll, but avoids allocations and copies
|
// readAll works the same way as io.ReadAll, but avoids allocations and copies
|
||||||
|
@ -100,6 +136,11 @@ func readAll(r io.Reader) ([]byte, error) {
|
||||||
// Read reads export data from in, decodes it, and returns type
|
// Read reads export data from in, decodes it, and returns type
|
||||||
// information for the package.
|
// information for the package.
|
||||||
//
|
//
|
||||||
|
// Read is capable of reading export data produced by [Write] at the
|
||||||
|
// same source code version, or by the last two Go releases (plus tip)
|
||||||
|
// of the standard Go compiler. Reading files from older compilers may
|
||||||
|
// produce an error.
|
||||||
|
//
|
||||||
// The package path (effectively its linker symbol prefix) is
|
// The package path (effectively its linker symbol prefix) is
|
||||||
// specified by path, since unlike the package name, this information
|
// specified by path, since unlike the package name, this information
|
||||||
// may not be recorded in the export data.
|
// may not be recorded in the export data.
|
||||||
|
@ -128,14 +169,26 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package,
|
||||||
// (from "version"). Select appropriate importer.
|
// (from "version"). Select appropriate importer.
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
switch data[0] {
|
switch data[0] {
|
||||||
case 'v', 'c', 'd': // binary, till go1.10
|
case 'v', 'c', 'd':
|
||||||
|
// binary, produced by cmd/compile till go1.10
|
||||||
return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0])
|
return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0])
|
||||||
|
|
||||||
case 'i': // indexed, till go1.19
|
case 'i':
|
||||||
|
// indexed, produced by cmd/compile till go1.19,
|
||||||
|
// and also by [Write].
|
||||||
|
//
|
||||||
|
// If proposal #69491 is accepted, go/types
|
||||||
|
// serialization will be implemented by
|
||||||
|
// types.Export, to which Write would eventually
|
||||||
|
// delegate (explicitly dropping any pretence at
|
||||||
|
// inter-version Write-Read compatibility).
|
||||||
|
// This [Read] function would delegate to types.Import
|
||||||
|
// when it detects that the file was produced by Export.
|
||||||
_, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path)
|
_, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path)
|
||||||
return pkg, err
|
return pkg, err
|
||||||
|
|
||||||
case 'u': // unified, from go1.20
|
case 'u':
|
||||||
|
// unified, produced by cmd/compile since go1.20
|
||||||
_, pkg, err := gcimporter.UImportData(fset, imports, data[1:], path)
|
_, pkg, err := gcimporter.UImportData(fset, imports, data[1:], path)
|
||||||
return pkg, err
|
return pkg, err
|
||||||
|
|
||||||
|
|
15
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
15
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
|
@ -64,7 +64,7 @@ graph using the Imports fields.
|
||||||
|
|
||||||
The Load function can be configured by passing a pointer to a Config as
|
The Load function can be configured by passing a pointer to a Config as
|
||||||
the first argument. A nil Config is equivalent to the zero Config, which
|
the first argument. A nil Config is equivalent to the zero Config, which
|
||||||
causes Load to run in LoadFiles mode, collecting minimal information.
|
causes Load to run in [LoadFiles] mode, collecting minimal information.
|
||||||
See the documentation for type Config for details.
|
See the documentation for type Config for details.
|
||||||
|
|
||||||
As noted earlier, the Config.Mode controls the amount of detail
|
As noted earlier, the Config.Mode controls the amount of detail
|
||||||
|
@ -72,14 +72,14 @@ reported about the loaded packages. See the documentation for type LoadMode
|
||||||
for details.
|
for details.
|
||||||
|
|
||||||
Most tools should pass their command-line arguments (after any flags)
|
Most tools should pass their command-line arguments (after any flags)
|
||||||
uninterpreted to [Load], so that it can interpret them
|
uninterpreted to Load, so that it can interpret them
|
||||||
according to the conventions of the underlying build system.
|
according to the conventions of the underlying build system.
|
||||||
|
|
||||||
See the Example function for typical usage.
|
See the Example function for typical usage.
|
||||||
|
|
||||||
# The driver protocol
|
# The driver protocol
|
||||||
|
|
||||||
[Load] may be used to load Go packages even in Go projects that use
|
Load may be used to load Go packages even in Go projects that use
|
||||||
alternative build systems, by installing an appropriate "driver"
|
alternative build systems, by installing an appropriate "driver"
|
||||||
program for the build system and specifying its location in the
|
program for the build system and specifying its location in the
|
||||||
GOPACKAGESDRIVER environment variable.
|
GOPACKAGESDRIVER environment variable.
|
||||||
|
@ -97,6 +97,15 @@ JSON-encoded [DriverRequest] message providing additional information
|
||||||
is written to the driver's standard input. The driver must write a
|
is written to the driver's standard input. The driver must write a
|
||||||
JSON-encoded [DriverResponse] message to its standard output. (This
|
JSON-encoded [DriverResponse] message to its standard output. (This
|
||||||
message differs from the JSON schema produced by 'go list'.)
|
message differs from the JSON schema produced by 'go list'.)
|
||||||
|
|
||||||
|
The value of the PWD environment variable seen by the driver process
|
||||||
|
is the preferred name of its working directory. (The working directory
|
||||||
|
may have other aliases due to symbolic links; see the comment on the
|
||||||
|
Dir field of [exec.Cmd] for related information.)
|
||||||
|
When the driver process emits in its response the name of a file
|
||||||
|
that is a descendant of this directory, it must use an absolute path
|
||||||
|
that has the value of PWD as a prefix, to ensure that the returned
|
||||||
|
filenames satisfy the original query.
|
||||||
*/
|
*/
|
||||||
package packages // import "golang.org/x/tools/go/packages"
|
package packages // import "golang.org/x/tools/go/packages"
|
||||||
|
|
||||||
|
|
13
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
13
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
|
@ -13,6 +13,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ type DriverResponse struct {
|
||||||
|
|
||||||
// driver is the type for functions that query the build system for the
|
// driver is the type for functions that query the build system for the
|
||||||
// packages named by the patterns.
|
// packages named by the patterns.
|
||||||
type driver func(cfg *Config, patterns ...string) (*DriverResponse, error)
|
type driver func(cfg *Config, patterns []string) (*DriverResponse, error)
|
||||||
|
|
||||||
// findExternalDriver returns the file path of a tool that supplies
|
// findExternalDriver returns the file path of a tool that supplies
|
||||||
// the build system package structure, or "" if not found.
|
// the build system package structure, or "" if not found.
|
||||||
|
@ -103,7 +104,7 @@ func findExternalDriver(cfg *Config) driver {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return func(cfg *Config, words ...string) (*DriverResponse, error) {
|
return func(cfg *Config, patterns []string) (*DriverResponse, error) {
|
||||||
req, err := json.Marshal(DriverRequest{
|
req, err := json.Marshal(DriverRequest{
|
||||||
Mode: cfg.Mode,
|
Mode: cfg.Mode,
|
||||||
Env: cfg.Env,
|
Env: cfg.Env,
|
||||||
|
@ -117,7 +118,7 @@ func findExternalDriver(cfg *Config) driver {
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
stderr := new(bytes.Buffer)
|
stderr := new(bytes.Buffer)
|
||||||
cmd := exec.CommandContext(cfg.Context, tool, words...)
|
cmd := exec.CommandContext(cfg.Context, tool, patterns...)
|
||||||
cmd.Dir = cfg.Dir
|
cmd.Dir = cfg.Dir
|
||||||
// The cwd gets resolved to the real path. On Darwin, where
|
// The cwd gets resolved to the real path. On Darwin, where
|
||||||
// /tmp is a symlink, this breaks anything that expects the
|
// /tmp is a symlink, this breaks anything that expects the
|
||||||
|
@ -131,7 +132,7 @@ func findExternalDriver(cfg *Config) driver {
|
||||||
// command.
|
// command.
|
||||||
//
|
//
|
||||||
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
|
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
|
||||||
cmd.Env = append(slicesClip(cfg.Env), "PWD="+cfg.Dir)
|
cmd.Env = append(slices.Clip(cfg.Env), "PWD="+cfg.Dir)
|
||||||
cmd.Stdin = bytes.NewReader(req)
|
cmd.Stdin = bytes.NewReader(req)
|
||||||
cmd.Stdout = buf
|
cmd.Stdout = buf
|
||||||
cmd.Stderr = stderr
|
cmd.Stderr = stderr
|
||||||
|
@ -150,7 +151,3 @@ func findExternalDriver(cfg *Config) driver {
|
||||||
return &response, nil
|
return &response, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// slicesClip removes unused capacity from the slice, returning s[:len(s):len(s)].
|
|
||||||
// TODO(adonovan): use go1.21 slices.Clip.
|
|
||||||
func slicesClip[S ~[]E, E any](s S) S { return s[:len(s):len(s)] }
|
|
||||||
|
|
43
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
43
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
|
@ -80,6 +80,12 @@ type golistState struct {
|
||||||
cfg *Config
|
cfg *Config
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
|
||||||
|
runner *gocommand.Runner
|
||||||
|
|
||||||
|
// overlay is the JSON file that encodes the Config.Overlay
|
||||||
|
// mapping, used by 'go list -overlay=...'.
|
||||||
|
overlay string
|
||||||
|
|
||||||
envOnce sync.Once
|
envOnce sync.Once
|
||||||
goEnvError error
|
goEnvError error
|
||||||
goEnv map[string]string
|
goEnv map[string]string
|
||||||
|
@ -127,7 +133,10 @@ func (state *golistState) mustGetEnv() map[string]string {
|
||||||
// goListDriver uses the go list command to interpret the patterns and produce
|
// goListDriver uses the go list command to interpret the patterns and produce
|
||||||
// the build system package structure.
|
// the build system package structure.
|
||||||
// See driver for more details.
|
// See driver for more details.
|
||||||
func goListDriver(cfg *Config, patterns ...string) (_ *DriverResponse, err error) {
|
//
|
||||||
|
// overlay is the JSON file that encodes the cfg.Overlay
|
||||||
|
// mapping, used by 'go list -overlay=...'
|
||||||
|
func goListDriver(cfg *Config, runner *gocommand.Runner, overlay string, patterns []string) (_ *DriverResponse, err error) {
|
||||||
// Make sure that any asynchronous go commands are killed when we return.
|
// Make sure that any asynchronous go commands are killed when we return.
|
||||||
parentCtx := cfg.Context
|
parentCtx := cfg.Context
|
||||||
if parentCtx == nil {
|
if parentCtx == nil {
|
||||||
|
@ -142,13 +151,15 @@ func goListDriver(cfg *Config, patterns ...string) (_ *DriverResponse, err error
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
vendorDirs: map[string]bool{},
|
vendorDirs: map[string]bool{},
|
||||||
|
overlay: overlay,
|
||||||
|
runner: runner,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in response.Sizes asynchronously if necessary.
|
// Fill in response.Sizes asynchronously if necessary.
|
||||||
if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 {
|
if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&(NeedTypes|NeedTypesInfo) != 0 {
|
||||||
errCh := make(chan error)
|
errCh := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
compiler, arch, err := getSizesForArgs(ctx, state.cfgInvocation(), cfg.gocmdRunner)
|
compiler, arch, err := getSizesForArgs(ctx, state.cfgInvocation(), runner)
|
||||||
response.dr.Compiler = compiler
|
response.dr.Compiler = compiler
|
||||||
response.dr.Arch = arch
|
response.dr.Arch = arch
|
||||||
errCh <- err
|
errCh <- err
|
||||||
|
@ -494,13 +505,14 @@ func (state *golistState) createDriverResponse(words ...string) (*DriverResponse
|
||||||
pkg := &Package{
|
pkg := &Package{
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
ID: p.ImportPath,
|
ID: p.ImportPath,
|
||||||
|
Dir: p.Dir,
|
||||||
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles),
|
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles),
|
||||||
CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles),
|
CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles),
|
||||||
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
|
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
|
||||||
EmbedFiles: absJoin(p.Dir, p.EmbedFiles),
|
EmbedFiles: absJoin(p.Dir, p.EmbedFiles),
|
||||||
EmbedPatterns: absJoin(p.Dir, p.EmbedPatterns),
|
EmbedPatterns: absJoin(p.Dir, p.EmbedPatterns),
|
||||||
IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles),
|
IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles),
|
||||||
forTest: p.ForTest,
|
ForTest: p.ForTest,
|
||||||
depsErrors: p.DepsErrors,
|
depsErrors: p.DepsErrors,
|
||||||
Module: p.Module,
|
Module: p.Module,
|
||||||
}
|
}
|
||||||
|
@ -681,7 +693,7 @@ func (state *golistState) shouldAddFilenameFromError(p *jsonPackage) bool {
|
||||||
// getGoVersion returns the effective minor version of the go command.
|
// getGoVersion returns the effective minor version of the go command.
|
||||||
func (state *golistState) getGoVersion() (int, error) {
|
func (state *golistState) getGoVersion() (int, error) {
|
||||||
state.goVersionOnce.Do(func() {
|
state.goVersionOnce.Do(func() {
|
||||||
state.goVersion, state.goVersionError = gocommand.GoVersion(state.ctx, state.cfgInvocation(), state.cfg.gocmdRunner)
|
state.goVersion, state.goVersionError = gocommand.GoVersion(state.ctx, state.cfgInvocation(), state.runner)
|
||||||
})
|
})
|
||||||
return state.goVersion, state.goVersionError
|
return state.goVersion, state.goVersionError
|
||||||
}
|
}
|
||||||
|
@ -751,7 +763,7 @@ func jsonFlag(cfg *Config, goVersion int) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addFields("Name", "ImportPath", "Error") // These fields are always needed
|
addFields("Name", "ImportPath", "Error") // These fields are always needed
|
||||||
if cfg.Mode&NeedFiles != 0 || cfg.Mode&NeedTypes != 0 {
|
if cfg.Mode&NeedFiles != 0 || cfg.Mode&(NeedTypes|NeedTypesInfo) != 0 {
|
||||||
addFields("Dir", "GoFiles", "IgnoredGoFiles", "IgnoredOtherFiles", "CFiles",
|
addFields("Dir", "GoFiles", "IgnoredGoFiles", "IgnoredOtherFiles", "CFiles",
|
||||||
"CgoFiles", "CXXFiles", "MFiles", "HFiles", "FFiles", "SFiles",
|
"CgoFiles", "CXXFiles", "MFiles", "HFiles", "FFiles", "SFiles",
|
||||||
"SwigFiles", "SwigCXXFiles", "SysoFiles")
|
"SwigFiles", "SwigCXXFiles", "SysoFiles")
|
||||||
|
@ -759,7 +771,7 @@ func jsonFlag(cfg *Config, goVersion int) string {
|
||||||
addFields("TestGoFiles", "XTestGoFiles")
|
addFields("TestGoFiles", "XTestGoFiles")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cfg.Mode&NeedTypes != 0 {
|
if cfg.Mode&(NeedTypes|NeedTypesInfo) != 0 {
|
||||||
// CompiledGoFiles seems to be required for the test case TestCgoNoSyntax,
|
// CompiledGoFiles seems to be required for the test case TestCgoNoSyntax,
|
||||||
// even when -compiled isn't passed in.
|
// even when -compiled isn't passed in.
|
||||||
// TODO(#52435): Should we make the test ask for -compiled, or automatically
|
// TODO(#52435): Should we make the test ask for -compiled, or automatically
|
||||||
|
@ -784,7 +796,7 @@ func jsonFlag(cfg *Config, goVersion int) string {
|
||||||
// Request Dir in the unlikely case Export is not absolute.
|
// Request Dir in the unlikely case Export is not absolute.
|
||||||
addFields("Dir", "Export")
|
addFields("Dir", "Export")
|
||||||
}
|
}
|
||||||
if cfg.Mode&needInternalForTest != 0 {
|
if cfg.Mode&NeedForTest != 0 {
|
||||||
addFields("ForTest")
|
addFields("ForTest")
|
||||||
}
|
}
|
||||||
if cfg.Mode&needInternalDepsErrors != 0 {
|
if cfg.Mode&needInternalDepsErrors != 0 {
|
||||||
|
@ -840,7 +852,7 @@ func (state *golistState) cfgInvocation() gocommand.Invocation {
|
||||||
Env: cfg.Env,
|
Env: cfg.Env,
|
||||||
Logf: cfg.Logf,
|
Logf: cfg.Logf,
|
||||||
WorkingDir: cfg.Dir,
|
WorkingDir: cfg.Dir,
|
||||||
Overlay: cfg.goListOverlayFile,
|
Overlay: state.overlay,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,11 +863,8 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
|
||||||
inv := state.cfgInvocation()
|
inv := state.cfgInvocation()
|
||||||
inv.Verb = verb
|
inv.Verb = verb
|
||||||
inv.Args = args
|
inv.Args = args
|
||||||
gocmdRunner := cfg.gocmdRunner
|
|
||||||
if gocmdRunner == nil {
|
stdout, stderr, friendlyErr, err := state.runner.RunRaw(cfg.Context, inv)
|
||||||
gocmdRunner = &gocommand.Runner{}
|
|
||||||
}
|
|
||||||
stdout, stderr, friendlyErr, err := gocmdRunner.RunRaw(cfg.Context, inv)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Check for 'go' executable not being found.
|
// Check for 'go' executable not being found.
|
||||||
if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
|
if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
|
||||||
|
@ -879,6 +888,12 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer,
|
||||||
return nil, friendlyErr
|
return nil, friendlyErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return an error if 'go list' failed due to missing tools in
|
||||||
|
// $GOROOT/pkg/tool/$GOOS_$GOARCH (#69606).
|
||||||
|
if len(stderr.String()) > 0 && strings.Contains(stderr.String(), `go: no such tool`) {
|
||||||
|
return nil, friendlyErr
|
||||||
|
}
|
||||||
|
|
||||||
// Is there an error running the C compiler in cgo? This will be reported in the "Error" field
|
// Is there an error running the C compiler in cgo? This will be reported in the "Error" field
|
||||||
// and should be suppressed by go list -e.
|
// and should be suppressed by go list -e.
|
||||||
//
|
//
|
||||||
|
|
72
vendor/golang.org/x/tools/go/packages/loadmode_string.go
generated
vendored
72
vendor/golang.org/x/tools/go/packages/loadmode_string.go
generated
vendored
|
@ -9,49 +9,47 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var allModes = []LoadMode{
|
var modes = [...]struct {
|
||||||
NeedName,
|
mode LoadMode
|
||||||
NeedFiles,
|
name string
|
||||||
NeedCompiledGoFiles,
|
}{
|
||||||
NeedImports,
|
{NeedName, "NeedName"},
|
||||||
NeedDeps,
|
{NeedFiles, "NeedFiles"},
|
||||||
NeedExportFile,
|
{NeedCompiledGoFiles, "NeedCompiledGoFiles"},
|
||||||
NeedTypes,
|
{NeedImports, "NeedImports"},
|
||||||
NeedSyntax,
|
{NeedDeps, "NeedDeps"},
|
||||||
NeedTypesInfo,
|
{NeedExportFile, "NeedExportFile"},
|
||||||
NeedTypesSizes,
|
{NeedTypes, "NeedTypes"},
|
||||||
|
{NeedSyntax, "NeedSyntax"},
|
||||||
|
{NeedTypesInfo, "NeedTypesInfo"},
|
||||||
|
{NeedTypesSizes, "NeedTypesSizes"},
|
||||||
|
{NeedForTest, "NeedForTest"},
|
||||||
|
{NeedModule, "NeedModule"},
|
||||||
|
{NeedEmbedFiles, "NeedEmbedFiles"},
|
||||||
|
{NeedEmbedPatterns, "NeedEmbedPatterns"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var modeStrings = []string{
|
func (mode LoadMode) String() string {
|
||||||
"NeedName",
|
if mode == 0 {
|
||||||
"NeedFiles",
|
|
||||||
"NeedCompiledGoFiles",
|
|
||||||
"NeedImports",
|
|
||||||
"NeedDeps",
|
|
||||||
"NeedExportFile",
|
|
||||||
"NeedTypes",
|
|
||||||
"NeedSyntax",
|
|
||||||
"NeedTypesInfo",
|
|
||||||
"NeedTypesSizes",
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod LoadMode) String() string {
|
|
||||||
m := mod
|
|
||||||
if m == 0 {
|
|
||||||
return "LoadMode(0)"
|
return "LoadMode(0)"
|
||||||
}
|
}
|
||||||
var out []string
|
var out []string
|
||||||
for i, x := range allModes {
|
// named bits
|
||||||
if x > m {
|
for _, item := range modes {
|
||||||
break
|
if (mode & item.mode) != 0 {
|
||||||
}
|
mode ^= item.mode
|
||||||
if (m & x) != 0 {
|
out = append(out, item.name)
|
||||||
out = append(out, modeStrings[i])
|
|
||||||
m = m ^ x
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m != 0 {
|
// unnamed residue
|
||||||
out = append(out, "Unknown")
|
if mode != 0 {
|
||||||
|
if out == nil {
|
||||||
|
return fmt.Sprintf("LoadMode(%#x)", int(mode))
|
||||||
|
}
|
||||||
|
out = append(out, fmt.Sprintf("%#x", int(mode)))
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("LoadMode(%s)", strings.Join(out, "|"))
|
if len(out) == 1 {
|
||||||
|
return out[0]
|
||||||
|
}
|
||||||
|
return "(" + strings.Join(out, "|") + ")"
|
||||||
}
|
}
|
||||||
|
|
397
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
397
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
|
@ -16,13 +16,13 @@ import (
|
||||||
"go/scanner"
|
"go/scanner"
|
||||||
"go/token"
|
"go/token"
|
||||||
"go/types"
|
"go/types"
|
||||||
"io"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
@ -31,7 +31,6 @@ import (
|
||||||
"golang.org/x/tools/internal/gocommand"
|
"golang.org/x/tools/internal/gocommand"
|
||||||
"golang.org/x/tools/internal/packagesinternal"
|
"golang.org/x/tools/internal/packagesinternal"
|
||||||
"golang.org/x/tools/internal/typesinternal"
|
"golang.org/x/tools/internal/typesinternal"
|
||||||
"golang.org/x/tools/internal/versions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// A LoadMode controls the amount of detail to return when loading.
|
// A LoadMode controls the amount of detail to return when loading.
|
||||||
|
@ -44,19 +43,33 @@ import (
|
||||||
// ID and Errors (if present) will always be filled.
|
// ID and Errors (if present) will always be filled.
|
||||||
// [Load] may return more information than requested.
|
// [Load] may return more information than requested.
|
||||||
//
|
//
|
||||||
|
// The Mode flag is a union of several bits named NeedName,
|
||||||
|
// NeedFiles, and so on, each of which determines whether
|
||||||
|
// a given field of Package (Name, Files, etc) should be
|
||||||
|
// populated.
|
||||||
|
//
|
||||||
|
// For convenience, we provide named constants for the most
|
||||||
|
// common combinations of Need flags:
|
||||||
|
//
|
||||||
|
// [LoadFiles] lists of files in each package
|
||||||
|
// [LoadImports] ... plus imports
|
||||||
|
// [LoadTypes] ... plus type information
|
||||||
|
// [LoadSyntax] ... plus type-annotated syntax
|
||||||
|
// [LoadAllSyntax] ... for all dependencies
|
||||||
|
//
|
||||||
// Unfortunately there are a number of open bugs related to
|
// Unfortunately there are a number of open bugs related to
|
||||||
// interactions among the LoadMode bits:
|
// interactions among the LoadMode bits:
|
||||||
// - https://github.com/golang/go/issues/56633
|
// - https://github.com/golang/go/issues/56633
|
||||||
// - https://github.com/golang/go/issues/56677
|
// - https://github.com/golang/go/issues/56677
|
||||||
// - https://github.com/golang/go/issues/58726
|
// - https://github.com/golang/go/issues/58726
|
||||||
// - https://github.com/golang/go/issues/63517
|
// - https://github.com/golang/go/issues/63517
|
||||||
type LoadMode int
|
type LoadMode int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// NeedName adds Name and PkgPath.
|
// NeedName adds Name and PkgPath.
|
||||||
NeedName LoadMode = 1 << iota
|
NeedName LoadMode = 1 << iota
|
||||||
|
|
||||||
// NeedFiles adds GoFiles and OtherFiles.
|
// NeedFiles adds Dir, GoFiles, OtherFiles, and IgnoredFiles
|
||||||
NeedFiles
|
NeedFiles
|
||||||
|
|
||||||
// NeedCompiledGoFiles adds CompiledGoFiles.
|
// NeedCompiledGoFiles adds CompiledGoFiles.
|
||||||
|
@ -78,7 +91,7 @@ const (
|
||||||
// NeedSyntax adds Syntax and Fset.
|
// NeedSyntax adds Syntax and Fset.
|
||||||
NeedSyntax
|
NeedSyntax
|
||||||
|
|
||||||
// NeedTypesInfo adds TypesInfo.
|
// NeedTypesInfo adds TypesInfo and Fset.
|
||||||
NeedTypesInfo
|
NeedTypesInfo
|
||||||
|
|
||||||
// NeedTypesSizes adds TypesSizes.
|
// NeedTypesSizes adds TypesSizes.
|
||||||
|
@ -87,9 +100,10 @@ const (
|
||||||
// needInternalDepsErrors adds the internal deps errors field for use by gopls.
|
// needInternalDepsErrors adds the internal deps errors field for use by gopls.
|
||||||
needInternalDepsErrors
|
needInternalDepsErrors
|
||||||
|
|
||||||
// needInternalForTest adds the internal forTest field.
|
// NeedForTest adds ForTest.
|
||||||
|
//
|
||||||
// Tests must also be set on the context for this field to be populated.
|
// Tests must also be set on the context for this field to be populated.
|
||||||
needInternalForTest
|
NeedForTest
|
||||||
|
|
||||||
// typecheckCgo enables full support for type checking cgo. Requires Go 1.15+.
|
// typecheckCgo enables full support for type checking cgo. Requires Go 1.15+.
|
||||||
// Modifies CompiledGoFiles and Types, and has no effect on its own.
|
// Modifies CompiledGoFiles and Types, and has no effect on its own.
|
||||||
|
@ -103,27 +117,24 @@ const (
|
||||||
|
|
||||||
// NeedEmbedPatterns adds EmbedPatterns.
|
// NeedEmbedPatterns adds EmbedPatterns.
|
||||||
NeedEmbedPatterns
|
NeedEmbedPatterns
|
||||||
|
|
||||||
|
// Be sure to update loadmode_string.go when adding new items!
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Deprecated: LoadFiles exists for historical compatibility
|
// LoadFiles loads the name and file names for the initial packages.
|
||||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
|
||||||
LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
|
LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
|
||||||
|
|
||||||
// Deprecated: LoadImports exists for historical compatibility
|
// LoadImports loads the name, file names, and import mapping for the initial packages.
|
||||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
|
||||||
LoadImports = LoadFiles | NeedImports
|
LoadImports = LoadFiles | NeedImports
|
||||||
|
|
||||||
// Deprecated: LoadTypes exists for historical compatibility
|
// LoadTypes loads exported type information for the initial packages.
|
||||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
|
||||||
LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
|
LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
|
||||||
|
|
||||||
// Deprecated: LoadSyntax exists for historical compatibility
|
// LoadSyntax loads typed syntax for the initial packages.
|
||||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
|
||||||
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
|
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
|
||||||
|
|
||||||
// Deprecated: LoadAllSyntax exists for historical compatibility
|
// LoadAllSyntax loads typed syntax for the initial packages and all dependencies.
|
||||||
// and should not be used. Please directly specify the needed fields using the Need values.
|
|
||||||
LoadAllSyntax = LoadSyntax | NeedDeps
|
LoadAllSyntax = LoadSyntax | NeedDeps
|
||||||
|
|
||||||
// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
|
// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
|
||||||
|
@ -133,13 +144,7 @@ const (
|
||||||
// A Config specifies details about how packages should be loaded.
|
// A Config specifies details about how packages should be loaded.
|
||||||
// The zero value is a valid configuration.
|
// The zero value is a valid configuration.
|
||||||
//
|
//
|
||||||
// Calls to Load do not modify this struct.
|
// Calls to [Load] do not modify this struct.
|
||||||
//
|
|
||||||
// TODO(adonovan): #67702: this is currently false: in fact,
|
|
||||||
// calls to [Load] do not modify the public fields of this struct, but
|
|
||||||
// may modify hidden fields, so concurrent calls to [Load] must not
|
|
||||||
// use the same Config. But perhaps we should reestablish the
|
|
||||||
// documented invariant.
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Mode controls the level of information returned for each package.
|
// Mode controls the level of information returned for each package.
|
||||||
Mode LoadMode
|
Mode LoadMode
|
||||||
|
@ -170,19 +175,10 @@ type Config struct {
|
||||||
//
|
//
|
||||||
Env []string
|
Env []string
|
||||||
|
|
||||||
// gocmdRunner guards go command calls from concurrency errors.
|
|
||||||
gocmdRunner *gocommand.Runner
|
|
||||||
|
|
||||||
// BuildFlags is a list of command-line flags to be passed through to
|
// BuildFlags is a list of command-line flags to be passed through to
|
||||||
// the build system's query tool.
|
// the build system's query tool.
|
||||||
BuildFlags []string
|
BuildFlags []string
|
||||||
|
|
||||||
// modFile will be used for -modfile in go command invocations.
|
|
||||||
modFile string
|
|
||||||
|
|
||||||
// modFlag will be used for -modfile in go command invocations.
|
|
||||||
modFlag string
|
|
||||||
|
|
||||||
// Fset provides source position information for syntax trees and types.
|
// Fset provides source position information for syntax trees and types.
|
||||||
// If Fset is nil, Load will use a new fileset, but preserve Fset's value.
|
// If Fset is nil, Load will use a new fileset, but preserve Fset's value.
|
||||||
Fset *token.FileSet
|
Fset *token.FileSet
|
||||||
|
@ -229,21 +225,24 @@ type Config struct {
|
||||||
// drivers may vary in their level of support for overlays.
|
// drivers may vary in their level of support for overlays.
|
||||||
Overlay map[string][]byte
|
Overlay map[string][]byte
|
||||||
|
|
||||||
// goListOverlayFile is the JSON file that encodes the Overlay
|
// -- Hidden configuration fields only for use in x/tools --
|
||||||
// mapping, used by 'go list -overlay=...'
|
|
||||||
goListOverlayFile string
|
// modFile will be used for -modfile in go command invocations.
|
||||||
|
modFile string
|
||||||
|
|
||||||
|
// modFlag will be used for -modfile in go command invocations.
|
||||||
|
modFlag string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load loads and returns the Go packages named by the given patterns.
|
// Load loads and returns the Go packages named by the given patterns.
|
||||||
//
|
//
|
||||||
// Config specifies loading options;
|
// The cfg parameter specifies loading options; nil behaves the same as an empty [Config].
|
||||||
// nil behaves the same as an empty Config.
|
|
||||||
//
|
//
|
||||||
// The [Config.Mode] field is a set of bits that determine what kinds
|
// The [Config.Mode] field is a set of bits that determine what kinds
|
||||||
// of information should be computed and returned. Modes that require
|
// of information should be computed and returned. Modes that require
|
||||||
// more information tend to be slower. See [LoadMode] for details
|
// more information tend to be slower. See [LoadMode] for details
|
||||||
// and important caveats. Its zero value is equivalent to
|
// and important caveats. Its zero value is equivalent to
|
||||||
// NeedName | NeedFiles | NeedCompiledGoFiles.
|
// [NeedName] | [NeedFiles] | [NeedCompiledGoFiles].
|
||||||
//
|
//
|
||||||
// Each call to Load returns a new set of [Package] instances.
|
// Each call to Load returns a new set of [Package] instances.
|
||||||
// The Packages and their Imports form a directed acyclic graph.
|
// The Packages and their Imports form a directed acyclic graph.
|
||||||
|
@ -260,7 +259,7 @@ type Config struct {
|
||||||
// Errors associated with a particular package are recorded in the
|
// Errors associated with a particular package are recorded in the
|
||||||
// corresponding Package's Errors list, and do not cause Load to
|
// corresponding Package's Errors list, and do not cause Load to
|
||||||
// return an error. Clients may need to handle such errors before
|
// return an error. Clients may need to handle such errors before
|
||||||
// proceeding with further analysis. The PrintErrors function is
|
// proceeding with further analysis. The [PrintErrors] function is
|
||||||
// provided for convenient display of all errors.
|
// provided for convenient display of all errors.
|
||||||
func Load(cfg *Config, patterns ...string) ([]*Package, error) {
|
func Load(cfg *Config, patterns ...string) ([]*Package, error) {
|
||||||
ld := newLoader(cfg)
|
ld := newLoader(cfg)
|
||||||
|
@ -323,21 +322,24 @@ func defaultDriver(cfg *Config, patterns ...string) (*DriverResponse, bool, erro
|
||||||
} else if !response.NotHandled {
|
} else if !response.NotHandled {
|
||||||
return response, true, nil
|
return response, true, nil
|
||||||
}
|
}
|
||||||
// (fall through)
|
// not handled: fall through
|
||||||
}
|
}
|
||||||
|
|
||||||
// go list fallback
|
// go list fallback
|
||||||
//
|
|
||||||
// Write overlays once, as there are many calls
|
// Write overlays once, as there are many calls
|
||||||
// to 'go list' (one per chunk plus others too).
|
// to 'go list' (one per chunk plus others too).
|
||||||
overlay, cleanupOverlay, err := gocommand.WriteOverlays(cfg.Overlay)
|
overlayFile, cleanupOverlay, err := gocommand.WriteOverlays(cfg.Overlay)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
defer cleanupOverlay()
|
defer cleanupOverlay()
|
||||||
cfg.goListOverlayFile = overlay
|
|
||||||
|
|
||||||
response, err := callDriverOnChunks(goListDriver, cfg, chunks)
|
var runner gocommand.Runner // (shared across many 'go list' calls)
|
||||||
|
driver := func(cfg *Config, patterns []string) (*DriverResponse, error) {
|
||||||
|
return goListDriver(cfg, &runner, overlayFile, patterns)
|
||||||
|
}
|
||||||
|
response, err := callDriverOnChunks(driver, cfg, chunks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
@ -375,16 +377,14 @@ func splitIntoChunks(patterns []string, argMax int) ([][]string, error) {
|
||||||
|
|
||||||
func callDriverOnChunks(driver driver, cfg *Config, chunks [][]string) (*DriverResponse, error) {
|
func callDriverOnChunks(driver driver, cfg *Config, chunks [][]string) (*DriverResponse, error) {
|
||||||
if len(chunks) == 0 {
|
if len(chunks) == 0 {
|
||||||
return driver(cfg)
|
return driver(cfg, nil)
|
||||||
}
|
}
|
||||||
responses := make([]*DriverResponse, len(chunks))
|
responses := make([]*DriverResponse, len(chunks))
|
||||||
errNotHandled := errors.New("driver returned NotHandled")
|
errNotHandled := errors.New("driver returned NotHandled")
|
||||||
var g errgroup.Group
|
var g errgroup.Group
|
||||||
for i, chunk := range chunks {
|
for i, chunk := range chunks {
|
||||||
i := i
|
|
||||||
chunk := chunk
|
|
||||||
g.Go(func() (err error) {
|
g.Go(func() (err error) {
|
||||||
responses[i], err = driver(cfg, chunk...)
|
responses[i], err = driver(cfg, chunk)
|
||||||
if responses[i] != nil && responses[i].NotHandled {
|
if responses[i] != nil && responses[i].NotHandled {
|
||||||
err = errNotHandled
|
err = errNotHandled
|
||||||
}
|
}
|
||||||
|
@ -434,6 +434,12 @@ type Package struct {
|
||||||
// PkgPath is the package path as used by the go/types package.
|
// PkgPath is the package path as used by the go/types package.
|
||||||
PkgPath string
|
PkgPath string
|
||||||
|
|
||||||
|
// Dir is the directory associated with the package, if it exists.
|
||||||
|
//
|
||||||
|
// For packages listed by the go command, this is the directory containing
|
||||||
|
// the package files.
|
||||||
|
Dir string
|
||||||
|
|
||||||
// Errors contains any errors encountered querying the metadata
|
// Errors contains any errors encountered querying the metadata
|
||||||
// of the package, or while parsing or type-checking its files.
|
// of the package, or while parsing or type-checking its files.
|
||||||
Errors []Error
|
Errors []Error
|
||||||
|
@ -521,8 +527,8 @@ type Package struct {
|
||||||
|
|
||||||
// -- internal --
|
// -- internal --
|
||||||
|
|
||||||
// forTest is the package under test, if any.
|
// ForTest is the package under test, if any.
|
||||||
forTest string
|
ForTest string
|
||||||
|
|
||||||
// depsErrors is the DepsErrors field from the go list response, if any.
|
// depsErrors is the DepsErrors field from the go list response, if any.
|
||||||
depsErrors []*packagesinternal.PackageError
|
depsErrors []*packagesinternal.PackageError
|
||||||
|
@ -551,9 +557,6 @@ type ModuleError struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
packagesinternal.GetForTest = func(p interface{}) string {
|
|
||||||
return p.(*Package).forTest
|
|
||||||
}
|
|
||||||
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError {
|
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError {
|
||||||
return p.(*Package).depsErrors
|
return p.(*Package).depsErrors
|
||||||
}
|
}
|
||||||
|
@ -565,7 +568,6 @@ func init() {
|
||||||
}
|
}
|
||||||
packagesinternal.TypecheckCgo = int(typecheckCgo)
|
packagesinternal.TypecheckCgo = int(typecheckCgo)
|
||||||
packagesinternal.DepsErrors = int(needInternalDepsErrors)
|
packagesinternal.DepsErrors = int(needInternalDepsErrors)
|
||||||
packagesinternal.ForTest = int(needInternalForTest)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// An Error describes a problem with a package's metadata, syntax, or types.
|
// An Error describes a problem with a package's metadata, syntax, or types.
|
||||||
|
@ -681,18 +683,19 @@ func (p *Package) String() string { return p.ID }
|
||||||
// loaderPackage augments Package with state used during the loading phase
|
// loaderPackage augments Package with state used during the loading phase
|
||||||
type loaderPackage struct {
|
type loaderPackage struct {
|
||||||
*Package
|
*Package
|
||||||
importErrors map[string]error // maps each bad import to its error
|
importErrors map[string]error // maps each bad import to its error
|
||||||
loadOnce sync.Once
|
preds []*loaderPackage // packages that import this one
|
||||||
color uint8 // for cycle detection
|
unfinishedSuccs atomic.Int32 // number of direct imports not yet loaded
|
||||||
needsrc bool // load from source (Mode >= LoadTypes)
|
color uint8 // for cycle detection
|
||||||
needtypes bool // type information is either requested or depended on
|
needsrc bool // load from source (Mode >= LoadTypes)
|
||||||
initial bool // package was matched by a pattern
|
needtypes bool // type information is either requested or depended on
|
||||||
goVersion int // minor version number of go command on PATH
|
initial bool // package was matched by a pattern
|
||||||
|
goVersion int // minor version number of go command on PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
// loader holds the working state of a single call to load.
|
// loader holds the working state of a single call to load.
|
||||||
type loader struct {
|
type loader struct {
|
||||||
pkgs map[string]*loaderPackage
|
pkgs map[string]*loaderPackage // keyed by Package.ID
|
||||||
Config
|
Config
|
||||||
sizes types.Sizes // non-nil if needed by mode
|
sizes types.Sizes // non-nil if needed by mode
|
||||||
parseCache map[string]*parseValue
|
parseCache map[string]*parseValue
|
||||||
|
@ -738,9 +741,6 @@ func newLoader(cfg *Config) *loader {
|
||||||
if ld.Config.Env == nil {
|
if ld.Config.Env == nil {
|
||||||
ld.Config.Env = os.Environ()
|
ld.Config.Env = os.Environ()
|
||||||
}
|
}
|
||||||
if ld.Config.gocmdRunner == nil {
|
|
||||||
ld.Config.gocmdRunner = &gocommand.Runner{}
|
|
||||||
}
|
|
||||||
if ld.Context == nil {
|
if ld.Context == nil {
|
||||||
ld.Context = context.Background()
|
ld.Context = context.Background()
|
||||||
}
|
}
|
||||||
|
@ -754,7 +754,7 @@ func newLoader(cfg *Config) *loader {
|
||||||
ld.requestedMode = ld.Mode
|
ld.requestedMode = ld.Mode
|
||||||
ld.Mode = impliedLoadMode(ld.Mode)
|
ld.Mode = impliedLoadMode(ld.Mode)
|
||||||
|
|
||||||
if ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 {
|
if ld.Mode&(NeedSyntax|NeedTypes|NeedTypesInfo) != 0 {
|
||||||
if ld.Fset == nil {
|
if ld.Fset == nil {
|
||||||
ld.Fset = token.NewFileSet()
|
ld.Fset = token.NewFileSet()
|
||||||
}
|
}
|
||||||
|
@ -763,6 +763,7 @@ func newLoader(cfg *Config) *loader {
|
||||||
// because we load source if export data is missing.
|
// because we load source if export data is missing.
|
||||||
if ld.ParseFile == nil {
|
if ld.ParseFile == nil {
|
||||||
ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
|
ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
|
||||||
|
// We implicitly promise to keep doing ast.Object resolution. :(
|
||||||
const mode = parser.AllErrors | parser.ParseComments
|
const mode = parser.AllErrors | parser.ParseComments
|
||||||
return parser.ParseFile(fset, filename, src, mode)
|
return parser.ParseFile(fset, filename, src, mode)
|
||||||
}
|
}
|
||||||
|
@ -794,7 +795,7 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
exportDataInvalid := len(ld.Overlay) > 0 || pkg.ExportFile == "" && pkg.PkgPath != "unsafe"
|
exportDataInvalid := len(ld.Overlay) > 0 || pkg.ExportFile == "" && pkg.PkgPath != "unsafe"
|
||||||
// This package needs type information if the caller requested types and the package is
|
// This package needs type information if the caller requested types and the package is
|
||||||
// either a root, or it's a non-root and the user requested dependencies ...
|
// either a root, or it's a non-root and the user requested dependencies ...
|
||||||
needtypes := (ld.Mode&NeedTypes|NeedTypesInfo != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0))
|
needtypes := (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0))
|
||||||
// This package needs source if the call requested source (or types info, which implies source)
|
// This package needs source if the call requested source (or types info, which implies source)
|
||||||
// and the package is either a root, or itas a non- root and the user requested dependencies...
|
// and the package is either a root, or itas a non- root and the user requested dependencies...
|
||||||
needsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) ||
|
needsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) ||
|
||||||
|
@ -819,9 +820,10 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ld.Mode&NeedImports != 0 {
|
// Materialize the import graph if it is needed (NeedImports),
|
||||||
// Materialize the import graph.
|
// or if we'll be using loadPackages (Need{Syntax|Types|TypesInfo}).
|
||||||
|
var leaves []*loaderPackage // packages with no unfinished successors
|
||||||
|
if ld.Mode&(NeedImports|NeedSyntax|NeedTypes|NeedTypesInfo) != 0 {
|
||||||
const (
|
const (
|
||||||
white = 0 // new
|
white = 0 // new
|
||||||
grey = 1 // in progress
|
grey = 1 // in progress
|
||||||
|
@ -840,63 +842,76 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
// dependency on a package that does. These are the only packages
|
// dependency on a package that does. These are the only packages
|
||||||
// for which we load source code.
|
// for which we load source code.
|
||||||
var stack []*loaderPackage
|
var stack []*loaderPackage
|
||||||
var visit func(lpkg *loaderPackage) bool
|
var visit func(from, lpkg *loaderPackage) bool
|
||||||
visit = func(lpkg *loaderPackage) bool {
|
visit = func(from, lpkg *loaderPackage) bool {
|
||||||
switch lpkg.color {
|
if lpkg.color == grey {
|
||||||
case black:
|
|
||||||
return lpkg.needsrc
|
|
||||||
case grey:
|
|
||||||
panic("internal error: grey node")
|
panic("internal error: grey node")
|
||||||
}
|
}
|
||||||
lpkg.color = grey
|
if lpkg.color == white {
|
||||||
stack = append(stack, lpkg) // push
|
lpkg.color = grey
|
||||||
stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports
|
stack = append(stack, lpkg) // push
|
||||||
lpkg.Imports = make(map[string]*Package, len(stubs))
|
stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports
|
||||||
for importPath, ipkg := range stubs {
|
lpkg.Imports = make(map[string]*Package, len(stubs))
|
||||||
var importErr error
|
for importPath, ipkg := range stubs {
|
||||||
imp := ld.pkgs[ipkg.ID]
|
var importErr error
|
||||||
if imp == nil {
|
imp := ld.pkgs[ipkg.ID]
|
||||||
// (includes package "C" when DisableCgo)
|
if imp == nil {
|
||||||
importErr = fmt.Errorf("missing package: %q", ipkg.ID)
|
// (includes package "C" when DisableCgo)
|
||||||
} else if imp.color == grey {
|
importErr = fmt.Errorf("missing package: %q", ipkg.ID)
|
||||||
importErr = fmt.Errorf("import cycle: %s", stack)
|
} else if imp.color == grey {
|
||||||
}
|
importErr = fmt.Errorf("import cycle: %s", stack)
|
||||||
if importErr != nil {
|
|
||||||
if lpkg.importErrors == nil {
|
|
||||||
lpkg.importErrors = make(map[string]error)
|
|
||||||
}
|
}
|
||||||
lpkg.importErrors[importPath] = importErr
|
if importErr != nil {
|
||||||
continue
|
if lpkg.importErrors == nil {
|
||||||
|
lpkg.importErrors = make(map[string]error)
|
||||||
|
}
|
||||||
|
lpkg.importErrors[importPath] = importErr
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if visit(lpkg, imp) {
|
||||||
|
lpkg.needsrc = true
|
||||||
|
}
|
||||||
|
lpkg.Imports[importPath] = imp.Package
|
||||||
}
|
}
|
||||||
|
|
||||||
if visit(imp) {
|
// -- postorder --
|
||||||
lpkg.needsrc = true
|
|
||||||
|
// Complete type information is required for the
|
||||||
|
// immediate dependencies of each source package.
|
||||||
|
if lpkg.needsrc && ld.Mode&NeedTypes != 0 {
|
||||||
|
for _, ipkg := range lpkg.Imports {
|
||||||
|
ld.pkgs[ipkg.ID].needtypes = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lpkg.Imports[importPath] = imp.Package
|
|
||||||
|
// NeedTypeSizes causes TypeSizes to be set even
|
||||||
|
// on packages for which types aren't needed.
|
||||||
|
if ld.Mode&NeedTypesSizes != 0 {
|
||||||
|
lpkg.TypesSizes = ld.sizes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add packages with no imports directly to the queue of leaves.
|
||||||
|
if len(lpkg.Imports) == 0 {
|
||||||
|
leaves = append(leaves, lpkg)
|
||||||
|
}
|
||||||
|
|
||||||
|
stack = stack[:len(stack)-1] // pop
|
||||||
|
lpkg.color = black
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete type information is required for the
|
// Add edge from predecessor.
|
||||||
// immediate dependencies of each source package.
|
if from != nil {
|
||||||
if lpkg.needsrc && ld.Mode&NeedTypes != 0 {
|
from.unfinishedSuccs.Add(+1) // incref
|
||||||
for _, ipkg := range lpkg.Imports {
|
lpkg.preds = append(lpkg.preds, from)
|
||||||
ld.pkgs[ipkg.ID].needtypes = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NeedTypeSizes causes TypeSizes to be set even
|
|
||||||
// on packages for which types aren't needed.
|
|
||||||
if ld.Mode&NeedTypesSizes != 0 {
|
|
||||||
lpkg.TypesSizes = ld.sizes
|
|
||||||
}
|
|
||||||
stack = stack[:len(stack)-1] // pop
|
|
||||||
lpkg.color = black
|
|
||||||
|
|
||||||
return lpkg.needsrc
|
return lpkg.needsrc
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each initial package, create its import DAG.
|
// For each initial package, create its import DAG.
|
||||||
for _, lpkg := range initial {
|
for _, lpkg := range initial {
|
||||||
visit(lpkg)
|
visit(nil, lpkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -909,16 +924,45 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
|
|
||||||
// Load type data and syntax if needed, starting at
|
// Load type data and syntax if needed, starting at
|
||||||
// the initial packages (roots of the import DAG).
|
// the initial packages (roots of the import DAG).
|
||||||
if ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 {
|
if ld.Mode&(NeedSyntax|NeedTypes|NeedTypesInfo) != 0 {
|
||||||
var wg sync.WaitGroup
|
|
||||||
for _, lpkg := range initial {
|
// We avoid using g.SetLimit to limit concurrency as
|
||||||
wg.Add(1)
|
// it makes g.Go stop accepting work, which prevents
|
||||||
go func(lpkg *loaderPackage) {
|
// workers from enqeuing, and thus finishing, and thus
|
||||||
ld.loadRecursive(lpkg)
|
// allowing the group to make progress: deadlock.
|
||||||
wg.Done()
|
//
|
||||||
}(lpkg)
|
// Instead we use the ioLimit and cpuLimit semaphores.
|
||||||
|
g, _ := errgroup.WithContext(ld.Context)
|
||||||
|
|
||||||
|
// enqueues adds a package to the type-checking queue.
|
||||||
|
// It must have no unfinished successors.
|
||||||
|
var enqueue func(*loaderPackage)
|
||||||
|
enqueue = func(lpkg *loaderPackage) {
|
||||||
|
g.Go(func() error {
|
||||||
|
// Parse and type-check.
|
||||||
|
ld.loadPackage(lpkg)
|
||||||
|
|
||||||
|
// Notify each waiting predecessor,
|
||||||
|
// and enqueue it when it becomes a leaf.
|
||||||
|
for _, pred := range lpkg.preds {
|
||||||
|
if pred.unfinishedSuccs.Add(-1) == 0 { // decref
|
||||||
|
enqueue(pred)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load leaves first, adding new packages
|
||||||
|
// to the queue as they become leaves.
|
||||||
|
for _, leaf := range leaves {
|
||||||
|
enqueue(leaf)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := g.Wait(); err != nil {
|
||||||
|
return nil, err // cancelled
|
||||||
}
|
}
|
||||||
wg.Wait()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the context is done, return its error and
|
// If the context is done, return its error and
|
||||||
|
@ -965,7 +1009,7 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
if ld.requestedMode&NeedSyntax == 0 {
|
if ld.requestedMode&NeedSyntax == 0 {
|
||||||
ld.pkgs[i].Syntax = nil
|
ld.pkgs[i].Syntax = nil
|
||||||
}
|
}
|
||||||
if ld.requestedMode&NeedTypes == 0 && ld.requestedMode&NeedSyntax == 0 {
|
if ld.requestedMode&(NeedSyntax|NeedTypes|NeedTypesInfo) == 0 {
|
||||||
ld.pkgs[i].Fset = nil
|
ld.pkgs[i].Fset = nil
|
||||||
}
|
}
|
||||||
if ld.requestedMode&NeedTypesInfo == 0 {
|
if ld.requestedMode&NeedTypesInfo == 0 {
|
||||||
|
@ -982,31 +1026,10 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadRecursive loads the specified package and its dependencies,
|
// loadPackage loads/parses/typechecks the specified package.
|
||||||
// recursively, in parallel, in topological order.
|
|
||||||
// It is atomic and idempotent.
|
|
||||||
// Precondition: ld.Mode&NeedTypes.
|
|
||||||
func (ld *loader) loadRecursive(lpkg *loaderPackage) {
|
|
||||||
lpkg.loadOnce.Do(func() {
|
|
||||||
// Load the direct dependencies, in parallel.
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
for _, ipkg := range lpkg.Imports {
|
|
||||||
imp := ld.pkgs[ipkg.ID]
|
|
||||||
wg.Add(1)
|
|
||||||
go func(imp *loaderPackage) {
|
|
||||||
ld.loadRecursive(imp)
|
|
||||||
wg.Done()
|
|
||||||
}(imp)
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
ld.loadPackage(lpkg)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// loadPackage loads the specified package.
|
|
||||||
// It must be called only once per Package,
|
// It must be called only once per Package,
|
||||||
// after immediate dependencies are loaded.
|
// after immediate dependencies are loaded.
|
||||||
// Precondition: ld.Mode & NeedTypes.
|
// Precondition: ld.Mode&(NeedSyntax|NeedTypes|NeedTypesInfo) != 0.
|
||||||
func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
||||||
if lpkg.PkgPath == "unsafe" {
|
if lpkg.PkgPath == "unsafe" {
|
||||||
// Fill in the blanks to avoid surprises.
|
// Fill in the blanks to avoid surprises.
|
||||||
|
@ -1042,6 +1065,10 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
||||||
if !lpkg.needtypes && !lpkg.needsrc {
|
if !lpkg.needtypes && !lpkg.needsrc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(adonovan): this condition looks wrong:
|
||||||
|
// I think it should be lpkg.needtypes && !lpg.needsrc,
|
||||||
|
// so that NeedSyntax without NeedTypes can be satisfied by export data.
|
||||||
if !lpkg.needsrc {
|
if !lpkg.needsrc {
|
||||||
if err := ld.loadFromExportData(lpkg); err != nil {
|
if err := ld.loadFromExportData(lpkg); err != nil {
|
||||||
lpkg.Errors = append(lpkg.Errors, Error{
|
lpkg.Errors = append(lpkg.Errors, Error{
|
||||||
|
@ -1147,7 +1174,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
lpkg.Syntax = files
|
lpkg.Syntax = files
|
||||||
if ld.Config.Mode&NeedTypes == 0 {
|
if ld.Config.Mode&(NeedTypes|NeedTypesInfo) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,16 +1185,20 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lpkg.TypesInfo = &types.Info{
|
// Populate TypesInfo only if needed, as it
|
||||||
Types: make(map[ast.Expr]types.TypeAndValue),
|
// causes the type checker to work much harder.
|
||||||
Defs: make(map[*ast.Ident]types.Object),
|
if ld.Config.Mode&NeedTypesInfo != 0 {
|
||||||
Uses: make(map[*ast.Ident]types.Object),
|
lpkg.TypesInfo = &types.Info{
|
||||||
Implicits: make(map[ast.Node]types.Object),
|
Types: make(map[ast.Expr]types.TypeAndValue),
|
||||||
Instances: make(map[*ast.Ident]types.Instance),
|
Defs: make(map[*ast.Ident]types.Object),
|
||||||
Scopes: make(map[ast.Node]*types.Scope),
|
Uses: make(map[*ast.Ident]types.Object),
|
||||||
Selections: make(map[*ast.SelectorExpr]*types.Selection),
|
Implicits: make(map[ast.Node]types.Object),
|
||||||
|
Instances: make(map[*ast.Ident]types.Instance),
|
||||||
|
Scopes: make(map[ast.Node]*types.Scope),
|
||||||
|
Selections: make(map[*ast.SelectorExpr]*types.Selection),
|
||||||
|
FileVersions: make(map[*ast.File]string),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
versions.InitFileVersions(lpkg.TypesInfo)
|
|
||||||
lpkg.TypesSizes = ld.sizes
|
lpkg.TypesSizes = ld.sizes
|
||||||
|
|
||||||
importer := importerFunc(func(path string) (*types.Package, error) {
|
importer := importerFunc(func(path string) (*types.Package, error) {
|
||||||
|
@ -1220,6 +1251,10 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type-checking is CPU intensive.
|
||||||
|
cpuLimit <- unit{} // acquire a token
|
||||||
|
defer func() { <-cpuLimit }() // release a token
|
||||||
|
|
||||||
typErr := types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax)
|
typErr := types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax)
|
||||||
lpkg.importErrors = nil // no longer needed
|
lpkg.importErrors = nil // no longer needed
|
||||||
|
|
||||||
|
@ -1284,8 +1319,11 @@ type importerFunc func(path string) (*types.Package, error)
|
||||||
func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
|
func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
|
||||||
|
|
||||||
// We use a counting semaphore to limit
|
// We use a counting semaphore to limit
|
||||||
// the number of parallel I/O calls per process.
|
// the number of parallel I/O calls or CPU threads per process.
|
||||||
var ioLimit = make(chan bool, 20)
|
var (
|
||||||
|
ioLimit = make(chan unit, 20)
|
||||||
|
cpuLimit = make(chan unit, runtime.GOMAXPROCS(0))
|
||||||
|
)
|
||||||
|
|
||||||
func (ld *loader) parseFile(filename string) (*ast.File, error) {
|
func (ld *loader) parseFile(filename string) (*ast.File, error) {
|
||||||
ld.parseCacheMu.Lock()
|
ld.parseCacheMu.Lock()
|
||||||
|
@ -1302,20 +1340,28 @@ func (ld *loader) parseFile(filename string) (*ast.File, error) {
|
||||||
|
|
||||||
var src []byte
|
var src []byte
|
||||||
for f, contents := range ld.Config.Overlay {
|
for f, contents := range ld.Config.Overlay {
|
||||||
|
// TODO(adonovan): Inefficient for large overlays.
|
||||||
|
// Do an exact name-based map lookup
|
||||||
|
// (for nonexistent files) followed by a
|
||||||
|
// FileID-based map lookup (for existing ones).
|
||||||
if sameFile(f, filename) {
|
if sameFile(f, filename) {
|
||||||
src = contents
|
src = contents
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
if src == nil {
|
if src == nil {
|
||||||
ioLimit <- true // wait
|
ioLimit <- unit{} // acquire a token
|
||||||
src, err = os.ReadFile(filename)
|
src, err = os.ReadFile(filename)
|
||||||
<-ioLimit // signal
|
<-ioLimit // release a token
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.err = err
|
v.err = err
|
||||||
} else {
|
} else {
|
||||||
|
// Parsing is CPU intensive.
|
||||||
|
cpuLimit <- unit{} // acquire a token
|
||||||
v.f, v.err = ld.ParseFile(ld.Fset, filename, src)
|
v.f, v.err = ld.ParseFile(ld.Fset, filename, src)
|
||||||
|
<-cpuLimit // release a token
|
||||||
}
|
}
|
||||||
|
|
||||||
close(v.ready)
|
close(v.ready)
|
||||||
|
@ -1330,18 +1376,21 @@ func (ld *loader) parseFile(filename string) (*ast.File, error) {
|
||||||
// Because files are scanned in parallel, the token.Pos
|
// Because files are scanned in parallel, the token.Pos
|
||||||
// positions of the resulting ast.Files are not ordered.
|
// positions of the resulting ast.Files are not ordered.
|
||||||
func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
|
func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
|
||||||
var wg sync.WaitGroup
|
var (
|
||||||
n := len(filenames)
|
n = len(filenames)
|
||||||
parsed := make([]*ast.File, n)
|
parsed = make([]*ast.File, n)
|
||||||
errors := make([]error, n)
|
errors = make([]error, n)
|
||||||
for i, file := range filenames {
|
)
|
||||||
wg.Add(1)
|
var g errgroup.Group
|
||||||
go func(i int, filename string) {
|
for i, filename := range filenames {
|
||||||
|
// This creates goroutines unnecessarily in the
|
||||||
|
// cache-hit case, but that case is uncommon.
|
||||||
|
g.Go(func() error {
|
||||||
parsed[i], errors[i] = ld.parseFile(filename)
|
parsed[i], errors[i] = ld.parseFile(filename)
|
||||||
wg.Done()
|
return nil
|
||||||
}(i, file)
|
})
|
||||||
}
|
}
|
||||||
wg.Wait()
|
g.Wait()
|
||||||
|
|
||||||
// Eliminate nils, preserving order.
|
// Eliminate nils, preserving order.
|
||||||
var o int
|
var o int
|
||||||
|
@ -1512,4 +1561,4 @@ func usesExportData(cfg *Config) bool {
|
||||||
return cfg.Mode&NeedExportFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0
|
return cfg.Mode&NeedExportFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ interface{} = io.Discard // assert build toolchain is go1.16 or later
|
type unit struct{}
|
||||||
|
|
111
vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
111
vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
|
@ -228,7 +228,7 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||||
// Reject obviously non-viable cases.
|
// Reject obviously non-viable cases.
|
||||||
switch obj := obj.(type) {
|
switch obj := obj.(type) {
|
||||||
case *types.TypeName:
|
case *types.TypeName:
|
||||||
if _, ok := aliases.Unalias(obj.Type()).(*types.TypeParam); !ok {
|
if _, ok := types.Unalias(obj.Type()).(*types.TypeParam); !ok {
|
||||||
// With the exception of type parameters, only package-level type names
|
// With the exception of type parameters, only package-level type names
|
||||||
// have a path.
|
// have a path.
|
||||||
return "", fmt.Errorf("no path for %v", obj)
|
return "", fmt.Errorf("no path for %v", obj)
|
||||||
|
@ -280,26 +280,26 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||||
path = append(path, opType)
|
path = append(path, opType)
|
||||||
|
|
||||||
T := o.Type()
|
T := o.Type()
|
||||||
if alias, ok := T.(*aliases.Alias); ok {
|
if alias, ok := T.(*types.Alias); ok {
|
||||||
if r := findTypeParam(obj, aliases.TypeParams(alias), path, opTypeParam, nil); r != nil {
|
if r := findTypeParam(obj, aliases.TypeParams(alias), path, opTypeParam); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
if r := find(obj, aliases.Rhs(alias), append(path, opRhs), nil); r != nil {
|
if r := find(obj, aliases.Rhs(alias), append(path, opRhs)); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if tname.IsAlias() {
|
} else if tname.IsAlias() {
|
||||||
// legacy alias
|
// legacy alias
|
||||||
if r := find(obj, T, path, nil); r != nil {
|
if r := find(obj, T, path); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if named, ok := T.(*types.Named); ok {
|
} else if named, ok := T.(*types.Named); ok {
|
||||||
// defined (named) type
|
// defined (named) type
|
||||||
if r := findTypeParam(obj, named.TypeParams(), path, opTypeParam, nil); r != nil {
|
if r := findTypeParam(obj, named.TypeParams(), path, opTypeParam); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
if r := find(obj, named.Underlying(), append(path, opUnderlying), nil); r != nil {
|
if r := find(obj, named.Underlying(), append(path, opUnderlying)); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||||
if _, ok := o.(*types.TypeName); !ok {
|
if _, ok := o.(*types.TypeName); !ok {
|
||||||
if o.Exported() {
|
if o.Exported() {
|
||||||
// exported non-type (const, var, func)
|
// exported non-type (const, var, func)
|
||||||
if r := find(obj, o.Type(), append(path, opType), nil); r != nil {
|
if r := find(obj, o.Type(), append(path, opType)); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspect declared methods of defined types.
|
// Inspect declared methods of defined types.
|
||||||
if T, ok := aliases.Unalias(o.Type()).(*types.Named); ok {
|
if T, ok := types.Unalias(o.Type()).(*types.Named); ok {
|
||||||
path = append(path, opType)
|
path = append(path, opType)
|
||||||
// The method index here is always with respect
|
// The method index here is always with respect
|
||||||
// to the underlying go/types data structures,
|
// to the underlying go/types data structures,
|
||||||
|
@ -332,7 +332,7 @@ func (enc *Encoder) For(obj types.Object) (Path, error) {
|
||||||
if m == obj {
|
if m == obj {
|
||||||
return Path(path2), nil // found declared method
|
return Path(path2), nil // found declared method
|
||||||
}
|
}
|
||||||
if r := find(obj, m.Type(), append(path2, opType), nil); r != nil {
|
if r := find(obj, m.Type(), append(path2, opType)); r != nil {
|
||||||
return Path(r), nil
|
return Path(r), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,46 +447,64 @@ func (enc *Encoder) concreteMethod(meth *types.Func) (Path, bool) {
|
||||||
//
|
//
|
||||||
// The seen map is used to short circuit cycles through type parameters. If
|
// The seen map is used to short circuit cycles through type parameters. If
|
||||||
// nil, it will be allocated as necessary.
|
// nil, it will be allocated as necessary.
|
||||||
func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]bool) []byte {
|
//
|
||||||
|
// The seenMethods map is used internally to short circuit cycles through
|
||||||
|
// interface methods, such as occur in the following example:
|
||||||
|
//
|
||||||
|
// type I interface { f() interface{I} }
|
||||||
|
//
|
||||||
|
// See golang/go#68046 for details.
|
||||||
|
func find(obj types.Object, T types.Type, path []byte) []byte {
|
||||||
|
return (&finder{obj: obj}).find(T, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// finder closes over search state for a call to find.
|
||||||
|
type finder struct {
|
||||||
|
obj types.Object // the sought object
|
||||||
|
seenTParamNames map[*types.TypeName]bool // for cycle breaking through type parameters
|
||||||
|
seenMethods map[*types.Func]bool // for cycle breaking through recursive interfaces
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *finder) find(T types.Type, path []byte) []byte {
|
||||||
switch T := T.(type) {
|
switch T := T.(type) {
|
||||||
case *aliases.Alias:
|
case *types.Alias:
|
||||||
return find(obj, aliases.Unalias(T), path, seen)
|
return f.find(types.Unalias(T), path)
|
||||||
case *types.Basic, *types.Named:
|
case *types.Basic, *types.Named:
|
||||||
// Named types belonging to pkg were handled already,
|
// Named types belonging to pkg were handled already,
|
||||||
// so T must belong to another package. No path.
|
// so T must belong to another package. No path.
|
||||||
return nil
|
return nil
|
||||||
case *types.Pointer:
|
case *types.Pointer:
|
||||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
return f.find(T.Elem(), append(path, opElem))
|
||||||
case *types.Slice:
|
case *types.Slice:
|
||||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
return f.find(T.Elem(), append(path, opElem))
|
||||||
case *types.Array:
|
case *types.Array:
|
||||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
return f.find(T.Elem(), append(path, opElem))
|
||||||
case *types.Chan:
|
case *types.Chan:
|
||||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
return f.find(T.Elem(), append(path, opElem))
|
||||||
case *types.Map:
|
case *types.Map:
|
||||||
if r := find(obj, T.Key(), append(path, opKey), seen); r != nil {
|
if r := f.find(T.Key(), append(path, opKey)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
return find(obj, T.Elem(), append(path, opElem), seen)
|
return f.find(T.Elem(), append(path, opElem))
|
||||||
case *types.Signature:
|
case *types.Signature:
|
||||||
if r := findTypeParam(obj, T.RecvTypeParams(), path, opRecvTypeParam, nil); r != nil {
|
if r := f.findTypeParam(T.RecvTypeParams(), path, opRecvTypeParam); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
if r := findTypeParam(obj, T.TypeParams(), path, opTypeParam, seen); r != nil {
|
if r := f.findTypeParam(T.TypeParams(), path, opTypeParam); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
if r := find(obj, T.Params(), append(path, opParams), seen); r != nil {
|
if r := f.find(T.Params(), append(path, opParams)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
return find(obj, T.Results(), append(path, opResults), seen)
|
return f.find(T.Results(), append(path, opResults))
|
||||||
case *types.Struct:
|
case *types.Struct:
|
||||||
for i := 0; i < T.NumFields(); i++ {
|
for i := 0; i < T.NumFields(); i++ {
|
||||||
fld := T.Field(i)
|
fld := T.Field(i)
|
||||||
path2 := appendOpArg(path, opField, i)
|
path2 := appendOpArg(path, opField, i)
|
||||||
if fld == obj {
|
if fld == f.obj {
|
||||||
return path2 // found field var
|
return path2 // found field var
|
||||||
}
|
}
|
||||||
if r := find(obj, fld.Type(), append(path2, opType), seen); r != nil {
|
if r := f.find(fld.Type(), append(path2, opType)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,10 +513,10 @@ func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]
|
||||||
for i := 0; i < T.Len(); i++ {
|
for i := 0; i < T.Len(); i++ {
|
||||||
v := T.At(i)
|
v := T.At(i)
|
||||||
path2 := appendOpArg(path, opAt, i)
|
path2 := appendOpArg(path, opAt, i)
|
||||||
if v == obj {
|
if v == f.obj {
|
||||||
return path2 // found param/result var
|
return path2 // found param/result var
|
||||||
}
|
}
|
||||||
if r := find(obj, v.Type(), append(path2, opType), seen); r != nil {
|
if r := f.find(v.Type(), append(path2, opType)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,28 +524,35 @@ func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]
|
||||||
case *types.Interface:
|
case *types.Interface:
|
||||||
for i := 0; i < T.NumMethods(); i++ {
|
for i := 0; i < T.NumMethods(); i++ {
|
||||||
m := T.Method(i)
|
m := T.Method(i)
|
||||||
|
if f.seenMethods[m] {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
path2 := appendOpArg(path, opMethod, i)
|
path2 := appendOpArg(path, opMethod, i)
|
||||||
if m == obj {
|
if m == f.obj {
|
||||||
return path2 // found interface method
|
return path2 // found interface method
|
||||||
}
|
}
|
||||||
if r := find(obj, m.Type(), append(path2, opType), seen); r != nil {
|
if f.seenMethods == nil {
|
||||||
|
f.seenMethods = make(map[*types.Func]bool)
|
||||||
|
}
|
||||||
|
f.seenMethods[m] = true
|
||||||
|
if r := f.find(m.Type(), append(path2, opType)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case *types.TypeParam:
|
case *types.TypeParam:
|
||||||
name := T.Obj()
|
name := T.Obj()
|
||||||
if name == obj {
|
if f.seenTParamNames[name] {
|
||||||
return append(path, opObj)
|
|
||||||
}
|
|
||||||
if seen[name] {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if seen == nil {
|
if name == f.obj {
|
||||||
seen = make(map[*types.TypeName]bool)
|
return append(path, opObj)
|
||||||
}
|
}
|
||||||
seen[name] = true
|
if f.seenTParamNames == nil {
|
||||||
if r := find(obj, T.Constraint(), append(path, opConstraint), seen); r != nil {
|
f.seenTParamNames = make(map[*types.TypeName]bool)
|
||||||
|
}
|
||||||
|
f.seenTParamNames[name] = true
|
||||||
|
if r := f.find(T.Constraint(), append(path, opConstraint)); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -535,11 +560,15 @@ func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]
|
||||||
panic(T)
|
panic(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
func findTypeParam(obj types.Object, list *types.TypeParamList, path []byte, op byte, seen map[*types.TypeName]bool) []byte {
|
func findTypeParam(obj types.Object, list *types.TypeParamList, path []byte, op byte) []byte {
|
||||||
|
return (&finder{obj: obj}).findTypeParam(list, path, op)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *finder) findTypeParam(list *types.TypeParamList, path []byte, op byte) []byte {
|
||||||
for i := 0; i < list.Len(); i++ {
|
for i := 0; i < list.Len(); i++ {
|
||||||
tparam := list.At(i)
|
tparam := list.At(i)
|
||||||
path2 := appendOpArg(path, op, i)
|
path2 := appendOpArg(path, op, i)
|
||||||
if r := find(obj, tparam, path2, seen); r != nil {
|
if r := f.find(tparam, path2); r != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,7 +655,7 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||||
|
|
||||||
// Inv: t != nil, obj == nil
|
// Inv: t != nil, obj == nil
|
||||||
|
|
||||||
t = aliases.Unalias(t)
|
t = types.Unalias(t)
|
||||||
switch code {
|
switch code {
|
||||||
case opElem:
|
case opElem:
|
||||||
hasElem, ok := t.(hasElem) // Pointer, Slice, Array, Chan, Map
|
hasElem, ok := t.(hasElem) // Pointer, Slice, Array, Chan, Map
|
||||||
|
@ -664,7 +693,7 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||||
t = named.Underlying()
|
t = named.Underlying()
|
||||||
|
|
||||||
case opRhs:
|
case opRhs:
|
||||||
if alias, ok := t.(*aliases.Alias); ok {
|
if alias, ok := t.(*types.Alias); ok {
|
||||||
t = aliases.Rhs(alias)
|
t = aliases.Rhs(alias)
|
||||||
} else if false && aliases.Enabled() {
|
} else if false && aliases.Enabled() {
|
||||||
// The Enabled check is too expensive, so for now we
|
// The Enabled check is too expensive, so for now we
|
||||||
|
|
68
vendor/golang.org/x/tools/go/types/typeutil/callee.go
generated
vendored
Normal file
68
vendor/golang.org/x/tools/go/types/typeutil/callee.go
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/types"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/typeparams"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Callee returns the named target of a function call, if any:
|
||||||
|
// a function, method, builtin, or variable.
|
||||||
|
//
|
||||||
|
// Functions and methods may potentially have type parameters.
|
||||||
|
func Callee(info *types.Info, call *ast.CallExpr) types.Object {
|
||||||
|
fun := ast.Unparen(call.Fun)
|
||||||
|
|
||||||
|
// Look through type instantiation if necessary.
|
||||||
|
isInstance := false
|
||||||
|
switch fun.(type) {
|
||||||
|
case *ast.IndexExpr, *ast.IndexListExpr:
|
||||||
|
// When extracting the callee from an *IndexExpr, we need to check that
|
||||||
|
// it is a *types.Func and not a *types.Var.
|
||||||
|
// Example: Don't match a slice m within the expression `m[0]()`.
|
||||||
|
isInstance = true
|
||||||
|
fun, _, _, _ = typeparams.UnpackIndexExpr(fun)
|
||||||
|
}
|
||||||
|
|
||||||
|
var obj types.Object
|
||||||
|
switch fun := fun.(type) {
|
||||||
|
case *ast.Ident:
|
||||||
|
obj = info.Uses[fun] // type, var, builtin, or declared func
|
||||||
|
case *ast.SelectorExpr:
|
||||||
|
if sel, ok := info.Selections[fun]; ok {
|
||||||
|
obj = sel.Obj() // method or field
|
||||||
|
} else {
|
||||||
|
obj = info.Uses[fun.Sel] // qualified identifier?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := obj.(*types.TypeName); ok {
|
||||||
|
return nil // T(x) is a conversion, not a call
|
||||||
|
}
|
||||||
|
// A Func is required to match instantiations.
|
||||||
|
if _, ok := obj.(*types.Func); isInstance && !ok {
|
||||||
|
return nil // Was not a Func.
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// StaticCallee returns the target (function or method) of a static function
|
||||||
|
// call, if any. It returns nil for calls to builtins.
|
||||||
|
//
|
||||||
|
// Note: for calls of instantiated functions and methods, StaticCallee returns
|
||||||
|
// the corresponding generic function or method on the generic type.
|
||||||
|
func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func {
|
||||||
|
if f, ok := Callee(info, call).(*types.Func); ok && !interfaceMethod(f) {
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func interfaceMethod(f *types.Func) bool {
|
||||||
|
recv := f.Type().(*types.Signature).Recv()
|
||||||
|
return recv != nil && types.IsInterface(recv.Type())
|
||||||
|
}
|
30
vendor/golang.org/x/tools/go/types/typeutil/imports.go
generated
vendored
Normal file
30
vendor/golang.org/x/tools/go/types/typeutil/imports.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeutil
|
||||||
|
|
||||||
|
import "go/types"
|
||||||
|
|
||||||
|
// Dependencies returns all dependencies of the specified packages.
|
||||||
|
//
|
||||||
|
// Dependent packages appear in topological order: if package P imports
|
||||||
|
// package Q, Q appears earlier than P in the result.
|
||||||
|
// The algorithm follows import statements in the order they
|
||||||
|
// appear in the source code, so the result is a total order.
|
||||||
|
func Dependencies(pkgs ...*types.Package) []*types.Package {
|
||||||
|
var result []*types.Package
|
||||||
|
seen := make(map[*types.Package]bool)
|
||||||
|
var visit func(pkgs []*types.Package)
|
||||||
|
visit = func(pkgs []*types.Package) {
|
||||||
|
for _, p := range pkgs {
|
||||||
|
if !seen[p] {
|
||||||
|
seen[p] = true
|
||||||
|
visit(p.Imports())
|
||||||
|
result = append(result, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visit(pkgs)
|
||||||
|
return result
|
||||||
|
}
|
517
vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
Normal file
517
vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
Normal file
|
@ -0,0 +1,517 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package typeutil defines various utilities for types, such as Map,
|
||||||
|
// a mapping from types.Type to any values.
|
||||||
|
package typeutil // import "golang.org/x/tools/go/types/typeutil"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/typeparams"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Map is a hash-table-based mapping from types (types.Type) to
|
||||||
|
// arbitrary any values. The concrete types that implement
|
||||||
|
// the Type interface are pointers. Since they are not canonicalized,
|
||||||
|
// == cannot be used to check for equivalence, and thus we cannot
|
||||||
|
// simply use a Go map.
|
||||||
|
//
|
||||||
|
// Just as with map[K]V, a nil *Map is a valid empty map.
|
||||||
|
//
|
||||||
|
// Not thread-safe.
|
||||||
|
type Map struct {
|
||||||
|
hasher Hasher // shared by many Maps
|
||||||
|
table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused
|
||||||
|
length int // number of map entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// entry is an entry (key/value association) in a hash bucket.
|
||||||
|
type entry struct {
|
||||||
|
key types.Type
|
||||||
|
value any
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHasher sets the hasher used by Map.
|
||||||
|
//
|
||||||
|
// All Hashers are functionally equivalent but contain internal state
|
||||||
|
// used to cache the results of hashing previously seen types.
|
||||||
|
//
|
||||||
|
// A single Hasher created by MakeHasher() may be shared among many
|
||||||
|
// Maps. This is recommended if the instances have many keys in
|
||||||
|
// common, as it will amortize the cost of hash computation.
|
||||||
|
//
|
||||||
|
// A Hasher may grow without bound as new types are seen. Even when a
|
||||||
|
// type is deleted from the map, the Hasher never shrinks, since other
|
||||||
|
// types in the map may reference the deleted type indirectly.
|
||||||
|
//
|
||||||
|
// Hashers are not thread-safe, and read-only operations such as
|
||||||
|
// Map.Lookup require updates to the hasher, so a full Mutex lock (not a
|
||||||
|
// read-lock) is require around all Map operations if a shared
|
||||||
|
// hasher is accessed from multiple threads.
|
||||||
|
//
|
||||||
|
// If SetHasher is not called, the Map will create a private hasher at
|
||||||
|
// the first call to Insert.
|
||||||
|
func (m *Map) SetHasher(hasher Hasher) {
|
||||||
|
m.hasher = hasher
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete removes the entry with the given key, if any.
|
||||||
|
// It returns true if the entry was found.
|
||||||
|
func (m *Map) Delete(key types.Type) bool {
|
||||||
|
if m != nil && m.table != nil {
|
||||||
|
hash := m.hasher.Hash(key)
|
||||||
|
bucket := m.table[hash]
|
||||||
|
for i, e := range bucket {
|
||||||
|
if e.key != nil && types.Identical(key, e.key) {
|
||||||
|
// We can't compact the bucket as it
|
||||||
|
// would disturb iterators.
|
||||||
|
bucket[i] = entry{}
|
||||||
|
m.length--
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// At returns the map entry for the given key.
|
||||||
|
// The result is nil if the entry is not present.
|
||||||
|
func (m *Map) At(key types.Type) any {
|
||||||
|
if m != nil && m.table != nil {
|
||||||
|
for _, e := range m.table[m.hasher.Hash(key)] {
|
||||||
|
if e.key != nil && types.Identical(key, e.key) {
|
||||||
|
return e.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set sets the map entry for key to val,
|
||||||
|
// and returns the previous entry, if any.
|
||||||
|
func (m *Map) Set(key types.Type, value any) (prev any) {
|
||||||
|
if m.table != nil {
|
||||||
|
hash := m.hasher.Hash(key)
|
||||||
|
bucket := m.table[hash]
|
||||||
|
var hole *entry
|
||||||
|
for i, e := range bucket {
|
||||||
|
if e.key == nil {
|
||||||
|
hole = &bucket[i]
|
||||||
|
} else if types.Identical(key, e.key) {
|
||||||
|
prev = e.value
|
||||||
|
bucket[i].value = value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if hole != nil {
|
||||||
|
*hole = entry{key, value} // overwrite deleted entry
|
||||||
|
} else {
|
||||||
|
m.table[hash] = append(bucket, entry{key, value})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if m.hasher.memo == nil {
|
||||||
|
m.hasher = MakeHasher()
|
||||||
|
}
|
||||||
|
hash := m.hasher.Hash(key)
|
||||||
|
m.table = map[uint32][]entry{hash: {entry{key, value}}}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.length++
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Len returns the number of map entries.
|
||||||
|
func (m *Map) Len() int {
|
||||||
|
if m != nil {
|
||||||
|
return m.length
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate calls function f on each entry in the map in unspecified order.
|
||||||
|
//
|
||||||
|
// If f should mutate the map, Iterate provides the same guarantees as
|
||||||
|
// Go maps: if f deletes a map entry that Iterate has not yet reached,
|
||||||
|
// f will not be invoked for it, but if f inserts a map entry that
|
||||||
|
// Iterate has not yet reached, whether or not f will be invoked for
|
||||||
|
// it is unspecified.
|
||||||
|
func (m *Map) Iterate(f func(key types.Type, value any)) {
|
||||||
|
if m != nil {
|
||||||
|
for _, bucket := range m.table {
|
||||||
|
for _, e := range bucket {
|
||||||
|
if e.key != nil {
|
||||||
|
f(e.key, e.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keys returns a new slice containing the set of map keys.
|
||||||
|
// The order is unspecified.
|
||||||
|
func (m *Map) Keys() []types.Type {
|
||||||
|
keys := make([]types.Type, 0, m.Len())
|
||||||
|
m.Iterate(func(key types.Type, _ any) {
|
||||||
|
keys = append(keys, key)
|
||||||
|
})
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Map) toString(values bool) string {
|
||||||
|
if m == nil {
|
||||||
|
return "{}"
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
fmt.Fprint(&buf, "{")
|
||||||
|
sep := ""
|
||||||
|
m.Iterate(func(key types.Type, value any) {
|
||||||
|
fmt.Fprint(&buf, sep)
|
||||||
|
sep = ", "
|
||||||
|
fmt.Fprint(&buf, key)
|
||||||
|
if values {
|
||||||
|
fmt.Fprintf(&buf, ": %q", value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
fmt.Fprint(&buf, "}")
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns a string representation of the map's entries.
|
||||||
|
// Values are printed using fmt.Sprintf("%v", v).
|
||||||
|
// Order is unspecified.
|
||||||
|
func (m *Map) String() string {
|
||||||
|
return m.toString(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// KeysString returns a string representation of the map's key set.
|
||||||
|
// Order is unspecified.
|
||||||
|
func (m *Map) KeysString() string {
|
||||||
|
return m.toString(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Hasher
|
||||||
|
|
||||||
|
// A Hasher maps each type to its hash value.
|
||||||
|
// For efficiency, a hasher uses memoization; thus its memory
|
||||||
|
// footprint grows monotonically over time.
|
||||||
|
// Hashers are not thread-safe.
|
||||||
|
// Hashers have reference semantics.
|
||||||
|
// Call MakeHasher to create a Hasher.
|
||||||
|
type Hasher struct {
|
||||||
|
memo map[types.Type]uint32
|
||||||
|
|
||||||
|
// ptrMap records pointer identity.
|
||||||
|
ptrMap map[any]uint32
|
||||||
|
|
||||||
|
// sigTParams holds type parameters from the signature being hashed.
|
||||||
|
// Signatures are considered identical modulo renaming of type parameters, so
|
||||||
|
// within the scope of a signature type the identity of the signature's type
|
||||||
|
// parameters is just their index.
|
||||||
|
//
|
||||||
|
// Since the language does not currently support referring to uninstantiated
|
||||||
|
// generic types or functions, and instantiated signatures do not have type
|
||||||
|
// parameter lists, we should never encounter a second non-empty type
|
||||||
|
// parameter list when hashing a generic signature.
|
||||||
|
sigTParams *types.TypeParamList
|
||||||
|
}
|
||||||
|
|
||||||
|
// MakeHasher returns a new Hasher instance.
|
||||||
|
func MakeHasher() Hasher {
|
||||||
|
return Hasher{
|
||||||
|
memo: make(map[types.Type]uint32),
|
||||||
|
ptrMap: make(map[any]uint32),
|
||||||
|
sigTParams: nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hash computes a hash value for the given type t such that
|
||||||
|
// Identical(t, t') => Hash(t) == Hash(t').
|
||||||
|
func (h Hasher) Hash(t types.Type) uint32 {
|
||||||
|
hash, ok := h.memo[t]
|
||||||
|
if !ok {
|
||||||
|
hash = h.hashFor(t)
|
||||||
|
h.memo[t] = hash
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
// hashString computes the Fowler–Noll–Vo hash of s.
|
||||||
|
func hashString(s string) uint32 {
|
||||||
|
var h uint32
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
h ^= uint32(s[i])
|
||||||
|
h *= 16777619
|
||||||
|
}
|
||||||
|
return h
|
||||||
|
}
|
||||||
|
|
||||||
|
// hashFor computes the hash of t.
|
||||||
|
func (h Hasher) hashFor(t types.Type) uint32 {
|
||||||
|
// See Identical for rationale.
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
return uint32(t.Kind())
|
||||||
|
|
||||||
|
case *types.Alias:
|
||||||
|
return h.Hash(types.Unalias(t))
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
return 9043 + 2*uint32(t.Len()) + 3*h.Hash(t.Elem())
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
return 9049 + 2*h.Hash(t.Elem())
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
var hash uint32 = 9059
|
||||||
|
for i, n := 0, t.NumFields(); i < n; i++ {
|
||||||
|
f := t.Field(i)
|
||||||
|
if f.Anonymous() {
|
||||||
|
hash += 8861
|
||||||
|
}
|
||||||
|
hash += hashString(t.Tag(i))
|
||||||
|
hash += hashString(f.Name()) // (ignore f.Pkg)
|
||||||
|
hash += h.Hash(f.Type())
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
return 9067 + 2*h.Hash(t.Elem())
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
var hash uint32 = 9091
|
||||||
|
if t.Variadic() {
|
||||||
|
hash *= 8863
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use a separate hasher for types inside of the signature, where type
|
||||||
|
// parameter identity is modified to be (index, constraint). We must use a
|
||||||
|
// new memo for this hasher as type identity may be affected by this
|
||||||
|
// masking. For example, in func[T any](*T), the identity of *T depends on
|
||||||
|
// whether we are mapping the argument in isolation, or recursively as part
|
||||||
|
// of hashing the signature.
|
||||||
|
//
|
||||||
|
// We should never encounter a generic signature while hashing another
|
||||||
|
// generic signature, but defensively set sigTParams only if h.mask is
|
||||||
|
// unset.
|
||||||
|
tparams := t.TypeParams()
|
||||||
|
if h.sigTParams == nil && tparams.Len() != 0 {
|
||||||
|
h = Hasher{
|
||||||
|
// There may be something more efficient than discarding the existing
|
||||||
|
// memo, but it would require detecting whether types are 'tainted' by
|
||||||
|
// references to type parameters.
|
||||||
|
memo: make(map[types.Type]uint32),
|
||||||
|
// Re-using ptrMap ensures that pointer identity is preserved in this
|
||||||
|
// hasher.
|
||||||
|
ptrMap: h.ptrMap,
|
||||||
|
sigTParams: tparams,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < tparams.Len(); i++ {
|
||||||
|
tparam := tparams.At(i)
|
||||||
|
hash += 7 * h.Hash(tparam.Constraint())
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results())
|
||||||
|
|
||||||
|
case *types.Union:
|
||||||
|
return h.hashUnion(t)
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
// Interfaces are identical if they have the same set of methods, with
|
||||||
|
// identical names and types, and they have the same set of type
|
||||||
|
// restrictions. See go/types.identical for more details.
|
||||||
|
var hash uint32 = 9103
|
||||||
|
|
||||||
|
// Hash methods.
|
||||||
|
for i, n := 0, t.NumMethods(); i < n; i++ {
|
||||||
|
// Method order is not significant.
|
||||||
|
// Ignore m.Pkg().
|
||||||
|
m := t.Method(i)
|
||||||
|
// Use shallow hash on method signature to
|
||||||
|
// avoid anonymous interface cycles.
|
||||||
|
hash += 3*hashString(m.Name()) + 5*h.shallowHash(m.Type())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hash type restrictions.
|
||||||
|
terms, err := typeparams.InterfaceTermSet(t)
|
||||||
|
// if err != nil t has invalid type restrictions.
|
||||||
|
if err == nil {
|
||||||
|
hash += h.hashTermSet(terms)
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
return 9109 + 2*h.Hash(t.Key()) + 3*h.Hash(t.Elem())
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
return 9127 + 2*uint32(t.Dir()) + 3*h.Hash(t.Elem())
|
||||||
|
|
||||||
|
case *types.Named:
|
||||||
|
hash := h.hashPtr(t.Obj())
|
||||||
|
targs := t.TypeArgs()
|
||||||
|
for i := 0; i < targs.Len(); i++ {
|
||||||
|
targ := targs.At(i)
|
||||||
|
hash += 2 * h.Hash(targ)
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
|
||||||
|
case *types.TypeParam:
|
||||||
|
return h.hashTypeParam(t)
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
return h.hashTuple(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
panic(fmt.Sprintf("%T: %v", t, t))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h Hasher) hashTuple(tuple *types.Tuple) uint32 {
|
||||||
|
// See go/types.identicalTypes for rationale.
|
||||||
|
n := tuple.Len()
|
||||||
|
hash := 9137 + 2*uint32(n)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
hash += 3 * h.Hash(tuple.At(i).Type())
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h Hasher) hashUnion(t *types.Union) uint32 {
|
||||||
|
// Hash type restrictions.
|
||||||
|
terms, err := typeparams.UnionTermSet(t)
|
||||||
|
// if err != nil t has invalid type restrictions. Fall back on a non-zero
|
||||||
|
// hash.
|
||||||
|
if err != nil {
|
||||||
|
return 9151
|
||||||
|
}
|
||||||
|
return h.hashTermSet(terms)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h Hasher) hashTermSet(terms []*types.Term) uint32 {
|
||||||
|
hash := 9157 + 2*uint32(len(terms))
|
||||||
|
for _, term := range terms {
|
||||||
|
// term order is not significant.
|
||||||
|
termHash := h.Hash(term.Type())
|
||||||
|
if term.Tilde() {
|
||||||
|
termHash *= 9161
|
||||||
|
}
|
||||||
|
hash += 3 * termHash
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
// hashTypeParam returns a hash of the type parameter t, with a hash value
|
||||||
|
// depending on whether t is contained in h.sigTParams.
|
||||||
|
//
|
||||||
|
// If h.sigTParams is set and contains t, then we are in the process of hashing
|
||||||
|
// a signature, and the hash value of t must depend only on t's index and
|
||||||
|
// constraint: signatures are considered identical modulo type parameter
|
||||||
|
// renaming. To avoid infinite recursion, we only hash the type parameter
|
||||||
|
// index, and rely on types.Identical to handle signatures where constraints
|
||||||
|
// are not identical.
|
||||||
|
//
|
||||||
|
// Otherwise the hash of t depends only on t's pointer identity.
|
||||||
|
func (h Hasher) hashTypeParam(t *types.TypeParam) uint32 {
|
||||||
|
if h.sigTParams != nil {
|
||||||
|
i := t.Index()
|
||||||
|
if i >= 0 && i < h.sigTParams.Len() && t == h.sigTParams.At(i) {
|
||||||
|
return 9173 + 3*uint32(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return h.hashPtr(t.Obj())
|
||||||
|
}
|
||||||
|
|
||||||
|
// hashPtr hashes the pointer identity of ptr. It uses h.ptrMap to ensure that
|
||||||
|
// pointers values are not dependent on the GC.
|
||||||
|
func (h Hasher) hashPtr(ptr any) uint32 {
|
||||||
|
if hash, ok := h.ptrMap[ptr]; ok {
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
hash := uint32(reflect.ValueOf(ptr).Pointer())
|
||||||
|
h.ptrMap[ptr] = hash
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
// shallowHash computes a hash of t without looking at any of its
|
||||||
|
// element Types, to avoid potential anonymous cycles in the types of
|
||||||
|
// interface methods.
|
||||||
|
//
|
||||||
|
// When an unnamed non-empty interface type appears anywhere among the
|
||||||
|
// arguments or results of an interface method, there is a potential
|
||||||
|
// for endless recursion. Consider:
|
||||||
|
//
|
||||||
|
// type X interface { m() []*interface { X } }
|
||||||
|
//
|
||||||
|
// The problem is that the Methods of the interface in m's result type
|
||||||
|
// include m itself; there is no mention of the named type X that
|
||||||
|
// might help us break the cycle.
|
||||||
|
// (See comment in go/types.identical, case *Interface, for more.)
|
||||||
|
func (h Hasher) shallowHash(t types.Type) uint32 {
|
||||||
|
// t is the type of an interface method (Signature),
|
||||||
|
// its params or results (Tuples), or their immediate
|
||||||
|
// elements (mostly Slice, Pointer, Basic, Named),
|
||||||
|
// so there's no need to optimize anything else.
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Alias:
|
||||||
|
return h.shallowHash(types.Unalias(t))
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
var hash uint32 = 604171
|
||||||
|
if t.Variadic() {
|
||||||
|
hash *= 971767
|
||||||
|
}
|
||||||
|
// The Signature/Tuple recursion is always finite
|
||||||
|
// and invariably shallow.
|
||||||
|
return hash + 1062599*h.shallowHash(t.Params()) + 1282529*h.shallowHash(t.Results())
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
n := t.Len()
|
||||||
|
hash := 9137 + 2*uint32(n)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
hash += 53471161 * h.shallowHash(t.At(i).Type())
|
||||||
|
}
|
||||||
|
return hash
|
||||||
|
|
||||||
|
case *types.Basic:
|
||||||
|
return 45212177 * uint32(t.Kind())
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
return 1524181 + 2*uint32(t.Len())
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
return 2690201
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
return 3326489
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
return 4393139
|
||||||
|
|
||||||
|
case *types.Union:
|
||||||
|
return 562448657
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
return 2124679 // no recursion here
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
return 9109
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
return 9127
|
||||||
|
|
||||||
|
case *types.Named:
|
||||||
|
return h.hashPtr(t.Obj())
|
||||||
|
|
||||||
|
case *types.TypeParam:
|
||||||
|
return h.hashPtr(t.Obj())
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("shallowHash: %T: %v", t, t))
|
||||||
|
}
|
71
vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go
generated
vendored
Normal file
71
vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// This file implements a cache of method sets.
|
||||||
|
|
||||||
|
package typeutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/types"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A MethodSetCache records the method set of each type T for which
|
||||||
|
// MethodSet(T) is called so that repeat queries are fast.
|
||||||
|
// The zero value is a ready-to-use cache instance.
|
||||||
|
type MethodSetCache struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
named map[*types.Named]struct{ value, pointer *types.MethodSet } // method sets for named N and *N
|
||||||
|
others map[types.Type]*types.MethodSet // all other types
|
||||||
|
}
|
||||||
|
|
||||||
|
// MethodSet returns the method set of type T. It is thread-safe.
|
||||||
|
//
|
||||||
|
// If cache is nil, this function is equivalent to types.NewMethodSet(T).
|
||||||
|
// Utility functions can thus expose an optional *MethodSetCache
|
||||||
|
// parameter to clients that care about performance.
|
||||||
|
func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet {
|
||||||
|
if cache == nil {
|
||||||
|
return types.NewMethodSet(T)
|
||||||
|
}
|
||||||
|
cache.mu.Lock()
|
||||||
|
defer cache.mu.Unlock()
|
||||||
|
|
||||||
|
switch T := types.Unalias(T).(type) {
|
||||||
|
case *types.Named:
|
||||||
|
return cache.lookupNamed(T).value
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
if N, ok := types.Unalias(T.Elem()).(*types.Named); ok {
|
||||||
|
return cache.lookupNamed(N).pointer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all other types
|
||||||
|
// (The map uses pointer equivalence, not type identity.)
|
||||||
|
mset := cache.others[T]
|
||||||
|
if mset == nil {
|
||||||
|
mset = types.NewMethodSet(T)
|
||||||
|
if cache.others == nil {
|
||||||
|
cache.others = make(map[types.Type]*types.MethodSet)
|
||||||
|
}
|
||||||
|
cache.others[T] = mset
|
||||||
|
}
|
||||||
|
return mset
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cache *MethodSetCache) lookupNamed(named *types.Named) struct{ value, pointer *types.MethodSet } {
|
||||||
|
if cache.named == nil {
|
||||||
|
cache.named = make(map[*types.Named]struct{ value, pointer *types.MethodSet })
|
||||||
|
}
|
||||||
|
// Avoid recomputing mset(*T) for each distinct Pointer
|
||||||
|
// instance whose underlying type is a named type.
|
||||||
|
msets, ok := cache.named[named]
|
||||||
|
if !ok {
|
||||||
|
msets.value = types.NewMethodSet(named)
|
||||||
|
msets.pointer = types.NewMethodSet(types.NewPointer(named))
|
||||||
|
cache.named[named] = msets
|
||||||
|
}
|
||||||
|
return msets
|
||||||
|
}
|
53
vendor/golang.org/x/tools/go/types/typeutil/ui.go
generated
vendored
Normal file
53
vendor/golang.org/x/tools/go/types/typeutil/ui.go
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeutil
|
||||||
|
|
||||||
|
// This file defines utilities for user interfaces that display types.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IntuitiveMethodSet returns the intuitive method set of a type T,
|
||||||
|
// which is the set of methods you can call on an addressable value of
|
||||||
|
// that type.
|
||||||
|
//
|
||||||
|
// The result always contains MethodSet(T), and is exactly MethodSet(T)
|
||||||
|
// for interface types and for pointer-to-concrete types.
|
||||||
|
// For all other concrete types T, the result additionally
|
||||||
|
// contains each method belonging to *T if there is no identically
|
||||||
|
// named method on T itself.
|
||||||
|
//
|
||||||
|
// This corresponds to user intuition about method sets;
|
||||||
|
// this function is intended only for user interfaces.
|
||||||
|
//
|
||||||
|
// The order of the result is as for types.MethodSet(T).
|
||||||
|
func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection {
|
||||||
|
isPointerToConcrete := func(T types.Type) bool {
|
||||||
|
ptr, ok := types.Unalias(T).(*types.Pointer)
|
||||||
|
return ok && !types.IsInterface(ptr.Elem())
|
||||||
|
}
|
||||||
|
|
||||||
|
var result []*types.Selection
|
||||||
|
mset := msets.MethodSet(T)
|
||||||
|
if types.IsInterface(T) || isPointerToConcrete(T) {
|
||||||
|
for i, n := 0, mset.Len(); i < n; i++ {
|
||||||
|
result = append(result, mset.At(i))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// T is some other concrete type.
|
||||||
|
// Report methods of T and *T, preferring those of T.
|
||||||
|
pmset := msets.MethodSet(types.NewPointer(T))
|
||||||
|
for i, n := 0, pmset.Len(); i < n; i++ {
|
||||||
|
meth := pmset.At(i)
|
||||||
|
if m := mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name()); m != nil {
|
||||||
|
meth = m
|
||||||
|
}
|
||||||
|
result = append(result, meth)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
2
vendor/golang.org/x/tools/internal/aliases/aliases.go
generated
vendored
2
vendor/golang.org/x/tools/internal/aliases/aliases.go
generated
vendored
|
@ -28,7 +28,7 @@ import (
|
||||||
func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName {
|
func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName {
|
||||||
if enabled {
|
if enabled {
|
||||||
tname := types.NewTypeName(pos, pkg, name, nil)
|
tname := types.NewTypeName(pos, pkg, name, nil)
|
||||||
newAlias(tname, rhs, tparams)
|
SetTypeParams(types.NewAlias(tname, rhs), tparams)
|
||||||
return tname
|
return tname
|
||||||
}
|
}
|
||||||
if len(tparams) > 0 {
|
if len(tparams) > 0 {
|
||||||
|
|
37
vendor/golang.org/x/tools/internal/aliases/aliases_go121.go
generated
vendored
37
vendor/golang.org/x/tools/internal/aliases/aliases_go121.go
generated
vendored
|
@ -1,37 +0,0 @@
|
||||||
// Copyright 2024 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !go1.22
|
|
||||||
// +build !go1.22
|
|
||||||
|
|
||||||
package aliases
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Alias is a placeholder for a go/types.Alias for <=1.21.
|
|
||||||
// It will never be created by go/types.
|
|
||||||
type Alias struct{}
|
|
||||||
|
|
||||||
func (*Alias) String() string { panic("unreachable") }
|
|
||||||
func (*Alias) Underlying() types.Type { panic("unreachable") }
|
|
||||||
func (*Alias) Obj() *types.TypeName { panic("unreachable") }
|
|
||||||
func Rhs(alias *Alias) types.Type { panic("unreachable") }
|
|
||||||
func TypeParams(alias *Alias) *types.TypeParamList { panic("unreachable") }
|
|
||||||
func SetTypeParams(alias *Alias, tparams []*types.TypeParam) { panic("unreachable") }
|
|
||||||
func TypeArgs(alias *Alias) *types.TypeList { panic("unreachable") }
|
|
||||||
func Origin(alias *Alias) *Alias { panic("unreachable") }
|
|
||||||
|
|
||||||
// Unalias returns the type t for go <=1.21.
|
|
||||||
func Unalias(t types.Type) types.Type { return t }
|
|
||||||
|
|
||||||
func newAlias(name *types.TypeName, rhs types.Type, tparams []*types.TypeParam) *Alias {
|
|
||||||
panic("unreachable")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enabled reports whether [NewAlias] should create [types.Alias] types.
|
|
||||||
//
|
|
||||||
// Before go1.22, this function always returns false.
|
|
||||||
func Enabled() bool { return false }
|
|
32
vendor/golang.org/x/tools/internal/aliases/aliases_go122.go
generated
vendored
32
vendor/golang.org/x/tools/internal/aliases/aliases_go122.go
generated
vendored
|
@ -2,9 +2,6 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.22
|
|
||||||
// +build go1.22
|
|
||||||
|
|
||||||
package aliases
|
package aliases
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -14,22 +11,19 @@ import (
|
||||||
"go/types"
|
"go/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Alias is an alias of types.Alias.
|
|
||||||
type Alias = types.Alias
|
|
||||||
|
|
||||||
// Rhs returns the type on the right-hand side of the alias declaration.
|
// Rhs returns the type on the right-hand side of the alias declaration.
|
||||||
func Rhs(alias *Alias) types.Type {
|
func Rhs(alias *types.Alias) types.Type {
|
||||||
if alias, ok := any(alias).(interface{ Rhs() types.Type }); ok {
|
if alias, ok := any(alias).(interface{ Rhs() types.Type }); ok {
|
||||||
return alias.Rhs() // go1.23+
|
return alias.Rhs() // go1.23+
|
||||||
}
|
}
|
||||||
|
|
||||||
// go1.22's Alias didn't have the Rhs method,
|
// go1.22's Alias didn't have the Rhs method,
|
||||||
// so Unalias is the best we can do.
|
// so Unalias is the best we can do.
|
||||||
return Unalias(alias)
|
return types.Unalias(alias)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeParams returns the type parameter list of the alias.
|
// TypeParams returns the type parameter list of the alias.
|
||||||
func TypeParams(alias *Alias) *types.TypeParamList {
|
func TypeParams(alias *types.Alias) *types.TypeParamList {
|
||||||
if alias, ok := any(alias).(interface{ TypeParams() *types.TypeParamList }); ok {
|
if alias, ok := any(alias).(interface{ TypeParams() *types.TypeParamList }); ok {
|
||||||
return alias.TypeParams() // go1.23+
|
return alias.TypeParams() // go1.23+
|
||||||
}
|
}
|
||||||
|
@ -37,7 +31,7 @@ func TypeParams(alias *Alias) *types.TypeParamList {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTypeParams sets the type parameters of the alias type.
|
// SetTypeParams sets the type parameters of the alias type.
|
||||||
func SetTypeParams(alias *Alias, tparams []*types.TypeParam) {
|
func SetTypeParams(alias *types.Alias, tparams []*types.TypeParam) {
|
||||||
if alias, ok := any(alias).(interface {
|
if alias, ok := any(alias).(interface {
|
||||||
SetTypeParams(tparams []*types.TypeParam)
|
SetTypeParams(tparams []*types.TypeParam)
|
||||||
}); ok {
|
}); ok {
|
||||||
|
@ -48,7 +42,7 @@ func SetTypeParams(alias *Alias, tparams []*types.TypeParam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeArgs returns the type arguments used to instantiate the Alias type.
|
// TypeArgs returns the type arguments used to instantiate the Alias type.
|
||||||
func TypeArgs(alias *Alias) *types.TypeList {
|
func TypeArgs(alias *types.Alias) *types.TypeList {
|
||||||
if alias, ok := any(alias).(interface{ TypeArgs() *types.TypeList }); ok {
|
if alias, ok := any(alias).(interface{ TypeArgs() *types.TypeList }); ok {
|
||||||
return alias.TypeArgs() // go1.23+
|
return alias.TypeArgs() // go1.23+
|
||||||
}
|
}
|
||||||
|
@ -57,25 +51,13 @@ func TypeArgs(alias *Alias) *types.TypeList {
|
||||||
|
|
||||||
// Origin returns the generic Alias type of which alias is an instance.
|
// Origin returns the generic Alias type of which alias is an instance.
|
||||||
// If alias is not an instance of a generic alias, Origin returns alias.
|
// If alias is not an instance of a generic alias, Origin returns alias.
|
||||||
func Origin(alias *Alias) *Alias {
|
func Origin(alias *types.Alias) *types.Alias {
|
||||||
if alias, ok := any(alias).(interface{ Origin() *types.Alias }); ok {
|
if alias, ok := any(alias).(interface{ Origin() *types.Alias }); ok {
|
||||||
return alias.Origin() // go1.23+
|
return alias.Origin() // go1.23+
|
||||||
}
|
}
|
||||||
return alias // not an instance of a generic alias (go1.22)
|
return alias // not an instance of a generic alias (go1.22)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unalias is a wrapper of types.Unalias.
|
|
||||||
func Unalias(t types.Type) types.Type { return types.Unalias(t) }
|
|
||||||
|
|
||||||
// newAlias is an internal alias around types.NewAlias.
|
|
||||||
// Direct usage is discouraged as the moment.
|
|
||||||
// Try to use NewAlias instead.
|
|
||||||
func newAlias(tname *types.TypeName, rhs types.Type, tparams []*types.TypeParam) *Alias {
|
|
||||||
a := types.NewAlias(tname, rhs)
|
|
||||||
SetTypeParams(a, tparams)
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enabled reports whether [NewAlias] should create [types.Alias] types.
|
// Enabled reports whether [NewAlias] should create [types.Alias] types.
|
||||||
//
|
//
|
||||||
// This function is expensive! Call it sparingly.
|
// This function is expensive! Call it sparingly.
|
||||||
|
@ -91,7 +73,7 @@ func Enabled() bool {
|
||||||
// many tests. Therefore any attempt to cache the result
|
// many tests. Therefore any attempt to cache the result
|
||||||
// is just incorrect.
|
// is just incorrect.
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
f, _ := parser.ParseFile(fset, "a.go", "package p; type A = int", 0)
|
f, _ := parser.ParseFile(fset, "a.go", "package p; type A = int", parser.SkipObjectResolution)
|
||||||
pkg, _ := new(types.Config).Check("p", fset, []*ast.File{f}, nil)
|
pkg, _ := new(types.Config).Check("p", fset, []*ast.File{f}, nil)
|
||||||
_, enabled := pkg.Scope().Lookup("A").Type().(*types.Alias)
|
_, enabled := pkg.Scope().Lookup("A").Type().(*types.Alias)
|
||||||
return enabled
|
return enabled
|
||||||
|
|
61
vendor/golang.org/x/tools/internal/gcimporter/bimport.go
generated
vendored
61
vendor/golang.org/x/tools/internal/gcimporter/bimport.go
generated
vendored
|
@ -87,64 +87,3 @@ func chanDir(d int) types.ChanDir {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var predeclOnce sync.Once
|
|
||||||
var predecl []types.Type // initialized lazily
|
|
||||||
|
|
||||||
func predeclared() []types.Type {
|
|
||||||
predeclOnce.Do(func() {
|
|
||||||
// initialize lazily to be sure that all
|
|
||||||
// elements have been initialized before
|
|
||||||
predecl = []types.Type{ // basic types
|
|
||||||
types.Typ[types.Bool],
|
|
||||||
types.Typ[types.Int],
|
|
||||||
types.Typ[types.Int8],
|
|
||||||
types.Typ[types.Int16],
|
|
||||||
types.Typ[types.Int32],
|
|
||||||
types.Typ[types.Int64],
|
|
||||||
types.Typ[types.Uint],
|
|
||||||
types.Typ[types.Uint8],
|
|
||||||
types.Typ[types.Uint16],
|
|
||||||
types.Typ[types.Uint32],
|
|
||||||
types.Typ[types.Uint64],
|
|
||||||
types.Typ[types.Uintptr],
|
|
||||||
types.Typ[types.Float32],
|
|
||||||
types.Typ[types.Float64],
|
|
||||||
types.Typ[types.Complex64],
|
|
||||||
types.Typ[types.Complex128],
|
|
||||||
types.Typ[types.String],
|
|
||||||
|
|
||||||
// basic type aliases
|
|
||||||
types.Universe.Lookup("byte").Type(),
|
|
||||||
types.Universe.Lookup("rune").Type(),
|
|
||||||
|
|
||||||
// error
|
|
||||||
types.Universe.Lookup("error").Type(),
|
|
||||||
|
|
||||||
// untyped types
|
|
||||||
types.Typ[types.UntypedBool],
|
|
||||||
types.Typ[types.UntypedInt],
|
|
||||||
types.Typ[types.UntypedRune],
|
|
||||||
types.Typ[types.UntypedFloat],
|
|
||||||
types.Typ[types.UntypedComplex],
|
|
||||||
types.Typ[types.UntypedString],
|
|
||||||
types.Typ[types.UntypedNil],
|
|
||||||
|
|
||||||
// package unsafe
|
|
||||||
types.Typ[types.UnsafePointer],
|
|
||||||
|
|
||||||
// invalid type
|
|
||||||
types.Typ[types.Invalid], // only appears in packages with errors
|
|
||||||
|
|
||||||
// used internally by gc; never used by this package or in .a files
|
|
||||||
anyType{},
|
|
||||||
}
|
|
||||||
predecl = append(predecl, additionalPredeclared()...)
|
|
||||||
})
|
|
||||||
return predecl
|
|
||||||
}
|
|
||||||
|
|
||||||
type anyType struct{}
|
|
||||||
|
|
||||||
func (t anyType) Underlying() types.Type { return t }
|
|
||||||
func (t anyType) String() string { return "any" }
|
|
||||||
|
|
75
vendor/golang.org/x/tools/internal/gcimporter/exportdata.go
generated
vendored
75
vendor/golang.org/x/tools/internal/gcimporter/exportdata.go
generated
vendored
|
@ -39,12 +39,15 @@ func readGopackHeader(r *bufio.Reader) (name string, size int64, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindExportData positions the reader r at the beginning of the
|
// FindExportData positions the reader r at the beginning of the
|
||||||
// export data section of an underlying GC-created object/archive
|
// export data section of an underlying cmd/compile created archive
|
||||||
// file by reading from it. The reader must be positioned at the
|
// file by reading from it. The reader must be positioned at the
|
||||||
// start of the file before calling this function. The hdr result
|
// start of the file before calling this function.
|
||||||
// is the string before the export data, either "$$" or "$$B".
|
// The size result is the length of the export data in bytes.
|
||||||
// The size result is the length of the export data in bytes, or -1 if not known.
|
//
|
||||||
func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
// This function is needed by [gcexportdata.Read], which must
|
||||||
|
// accept inputs produced by the last two releases of cmd/compile,
|
||||||
|
// plus tip.
|
||||||
|
func FindExportData(r *bufio.Reader) (size int64, err error) {
|
||||||
// Read first line to make sure this is an object file.
|
// Read first line to make sure this is an object file.
|
||||||
line, err := r.ReadSlice('\n')
|
line, err := r.ReadSlice('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -52,28 +55,33 @@ func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if string(line) == "!<arch>\n" {
|
// Is the first line an archive file signature?
|
||||||
// Archive file. Scan to __.PKGDEF.
|
if string(line) != "!<arch>\n" {
|
||||||
var name string
|
err = fmt.Errorf("not the start of an archive file (%q)", line)
|
||||||
if name, size, err = readGopackHeader(r); err != nil {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// First entry should be __.PKGDEF.
|
|
||||||
if name != "__.PKGDEF" {
|
|
||||||
err = fmt.Errorf("go archive is missing __.PKGDEF")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read first line of __.PKGDEF data, so that line
|
|
||||||
// is once again the first line of the input.
|
|
||||||
if line, err = r.ReadSlice('\n'); err != nil {
|
|
||||||
err = fmt.Errorf("can't find export data (%v)", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
size -= int64(len(line))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Archive file. Scan to __.PKGDEF.
|
||||||
|
var name string
|
||||||
|
if name, size, err = readGopackHeader(r); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
arsize := size
|
||||||
|
|
||||||
|
// First entry should be __.PKGDEF.
|
||||||
|
if name != "__.PKGDEF" {
|
||||||
|
err = fmt.Errorf("go archive is missing __.PKGDEF")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read first line of __.PKGDEF data, so that line
|
||||||
|
// is once again the first line of the input.
|
||||||
|
if line, err = r.ReadSlice('\n'); err != nil {
|
||||||
|
err = fmt.Errorf("can't find export data (%v)", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
size -= int64(len(line))
|
||||||
|
|
||||||
// Now at __.PKGDEF in archive or still at beginning of file.
|
// Now at __.PKGDEF in archive or still at beginning of file.
|
||||||
// Either way, line should begin with "go object ".
|
// Either way, line should begin with "go object ".
|
||||||
if !strings.HasPrefix(string(line), "go object ") {
|
if !strings.HasPrefix(string(line), "go object ") {
|
||||||
|
@ -81,8 +89,8 @@ func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip over object header to export data.
|
// Skip over object headers to get to the export data section header "$$B\n".
|
||||||
// Begins after first line starting with $$.
|
// Object headers are lines that do not start with '$'.
|
||||||
for line[0] != '$' {
|
for line[0] != '$' {
|
||||||
if line, err = r.ReadSlice('\n'); err != nil {
|
if line, err = r.ReadSlice('\n'); err != nil {
|
||||||
err = fmt.Errorf("can't find export data (%v)", err)
|
err = fmt.Errorf("can't find export data (%v)", err)
|
||||||
|
@ -90,9 +98,18 @@ func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) {
|
||||||
}
|
}
|
||||||
size -= int64(len(line))
|
size -= int64(len(line))
|
||||||
}
|
}
|
||||||
hdr = string(line)
|
|
||||||
|
// Check for the binary export data section header "$$B\n".
|
||||||
|
hdr := string(line)
|
||||||
|
if hdr != "$$B\n" {
|
||||||
|
err = fmt.Errorf("unknown export data header: %q", hdr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// TODO(taking): Remove end-of-section marker "\n$$\n" from size.
|
||||||
|
|
||||||
if size < 0 {
|
if size < 0 {
|
||||||
size = -1
|
err = fmt.Errorf("invalid size (%d) in the archive file: %d bytes remain without section headers (recompile package)", arsize, size)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
79
vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go
generated
vendored
79
vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go
generated
vendored
|
@ -161,6 +161,8 @@ func FindPkg(path, srcDir string) (filename, id string) {
|
||||||
// Import imports a gc-generated package given its import path and srcDir, adds
|
// Import imports a gc-generated package given its import path and srcDir, adds
|
||||||
// the corresponding package object to the packages map, and returns the object.
|
// the corresponding package object to the packages map, and returns the object.
|
||||||
// The packages map must contain all packages already imported.
|
// The packages map must contain all packages already imported.
|
||||||
|
//
|
||||||
|
// TODO(taking): Import is only used in tests. Move to gcimporter_test.
|
||||||
func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
|
func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
|
||||||
var rc io.ReadCloser
|
var rc io.ReadCloser
|
||||||
var filename, id string
|
var filename, id string
|
||||||
|
@ -210,53 +212,50 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func
|
||||||
}
|
}
|
||||||
defer rc.Close()
|
defer rc.Close()
|
||||||
|
|
||||||
var hdr string
|
|
||||||
var size int64
|
var size int64
|
||||||
buf := bufio.NewReader(rc)
|
buf := bufio.NewReader(rc)
|
||||||
if hdr, size, err = FindExportData(buf); err != nil {
|
if size, err = FindExportData(buf); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch hdr {
|
var data []byte
|
||||||
case "$$B\n":
|
data, err = io.ReadAll(buf)
|
||||||
var data []byte
|
if err != nil {
|
||||||
data, err = io.ReadAll(buf)
|
return
|
||||||
if err != nil {
|
}
|
||||||
break
|
if len(data) == 0 {
|
||||||
}
|
return nil, fmt.Errorf("no data to load a package from for path %s", id)
|
||||||
|
|
||||||
// TODO(gri): allow clients of go/importer to provide a FileSet.
|
|
||||||
// Or, define a new standard go/types/gcexportdata package.
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
|
|
||||||
// Select appropriate importer.
|
|
||||||
if len(data) > 0 {
|
|
||||||
switch data[0] {
|
|
||||||
case 'v', 'c', 'd': // binary, till go1.10
|
|
||||||
return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0])
|
|
||||||
|
|
||||||
case 'i': // indexed, till go1.19
|
|
||||||
_, pkg, err := IImportData(fset, packages, data[1:], id)
|
|
||||||
return pkg, err
|
|
||||||
|
|
||||||
case 'u': // unified, from go1.20
|
|
||||||
_, pkg, err := UImportData(fset, packages, data[1:size], id)
|
|
||||||
return pkg, err
|
|
||||||
|
|
||||||
default:
|
|
||||||
l := len(data)
|
|
||||||
if l > 10 {
|
|
||||||
l = 10
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
err = fmt.Errorf("unknown export data header: %q", hdr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
// TODO(gri): allow clients of go/importer to provide a FileSet.
|
||||||
|
// Or, define a new standard go/types/gcexportdata package.
|
||||||
|
fset := token.NewFileSet()
|
||||||
|
|
||||||
|
// Select appropriate importer.
|
||||||
|
switch data[0] {
|
||||||
|
case 'v', 'c', 'd':
|
||||||
|
// binary: emitted by cmd/compile till go1.10; obsolete.
|
||||||
|
return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0])
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
// indexed: emitted by cmd/compile till go1.19;
|
||||||
|
// now used only for serializing go/types.
|
||||||
|
// See https://github.com/golang/go/issues/69491.
|
||||||
|
_, pkg, err := IImportData(fset, packages, data[1:], id)
|
||||||
|
return pkg, err
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
// unified: emitted by cmd/compile since go1.20.
|
||||||
|
_, pkg, err := UImportData(fset, packages, data[1:size], id)
|
||||||
|
return pkg, err
|
||||||
|
|
||||||
|
default:
|
||||||
|
l := len(data)
|
||||||
|
if l > 10 {
|
||||||
|
l = 10
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type byPath []*types.Package
|
type byPath []*types.Package
|
||||||
|
|
37
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
37
vendor/golang.org/x/tools/internal/gcimporter/iexport.go
generated
vendored
|
@ -242,11 +242,30 @@ import (
|
||||||
|
|
||||||
"golang.org/x/tools/go/types/objectpath"
|
"golang.org/x/tools/go/types/objectpath"
|
||||||
"golang.org/x/tools/internal/aliases"
|
"golang.org/x/tools/internal/aliases"
|
||||||
"golang.org/x/tools/internal/tokeninternal"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// IExportShallow encodes "shallow" export data for the specified package.
|
// IExportShallow encodes "shallow" export data for the specified package.
|
||||||
//
|
//
|
||||||
|
// For types, we use "shallow" export data. Historically, the Go
|
||||||
|
// compiler always produced a summary of the types for a given package
|
||||||
|
// that included types from other packages that it indirectly
|
||||||
|
// referenced: "deep" export data. This had the advantage that the
|
||||||
|
// compiler (and analogous tools such as gopls) need only load one
|
||||||
|
// file per direct import. However, it meant that the files tended to
|
||||||
|
// get larger based on the level of the package in the import
|
||||||
|
// graph. For example, higher-level packages in the kubernetes module
|
||||||
|
// have over 1MB of "deep" export data, even when they have almost no
|
||||||
|
// content of their own, merely because they mention a major type that
|
||||||
|
// references many others. In pathological cases the export data was
|
||||||
|
// 300x larger than the source for a package due to this quadratic
|
||||||
|
// growth.
|
||||||
|
//
|
||||||
|
// "Shallow" export data means that the serialized types describe only
|
||||||
|
// a single package. If those types mention types from other packages,
|
||||||
|
// the type checker may need to request additional packages beyond
|
||||||
|
// just the direct imports. Type information for the entire transitive
|
||||||
|
// closure of imports is provided (lazily) by the DAG.
|
||||||
|
//
|
||||||
// No promises are made about the encoding other than that it can be decoded by
|
// No promises are made about the encoding other than that it can be decoded by
|
||||||
// the same version of IIExportShallow. If you plan to save export data in the
|
// the same version of IIExportShallow. If you plan to save export data in the
|
||||||
// file system, be sure to include a cryptographic digest of the executable in
|
// file system, be sure to include a cryptographic digest of the executable in
|
||||||
|
@ -269,8 +288,8 @@ func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IImportShallow decodes "shallow" types.Package data encoded by
|
// IImportShallow decodes "shallow" types.Package data encoded by
|
||||||
// IExportShallow in the same executable. This function cannot import data from
|
// [IExportShallow] in the same executable. This function cannot import data
|
||||||
// cmd/compile or gcexportdata.Write.
|
// from cmd/compile or gcexportdata.Write.
|
||||||
//
|
//
|
||||||
// The importer calls getPackages to obtain package symbols for all
|
// The importer calls getPackages to obtain package symbols for all
|
||||||
// packages mentioned in the export data, including the one being
|
// packages mentioned in the export data, including the one being
|
||||||
|
@ -441,7 +460,7 @@ func (p *iexporter) encodeFile(w *intWriter, file *token.File, needed []uint64)
|
||||||
// Sort the set of needed offsets. Duplicates are harmless.
|
// Sort the set of needed offsets. Duplicates are harmless.
|
||||||
sort.Slice(needed, func(i, j int) bool { return needed[i] < needed[j] })
|
sort.Slice(needed, func(i, j int) bool { return needed[i] < needed[j] })
|
||||||
|
|
||||||
lines := tokeninternal.GetLines(file) // byte offset of each line start
|
lines := file.Lines() // byte offset of each line start
|
||||||
w.uint64(uint64(len(lines)))
|
w.uint64(uint64(len(lines)))
|
||||||
|
|
||||||
// Rather than record the entire array of line start offsets,
|
// Rather than record the entire array of line start offsets,
|
||||||
|
@ -725,13 +744,13 @@ func (p *iexporter) doDecl(obj types.Object) {
|
||||||
case *types.TypeName:
|
case *types.TypeName:
|
||||||
t := obj.Type()
|
t := obj.Type()
|
||||||
|
|
||||||
if tparam, ok := aliases.Unalias(t).(*types.TypeParam); ok {
|
if tparam, ok := types.Unalias(t).(*types.TypeParam); ok {
|
||||||
w.tag(typeParamTag)
|
w.tag(typeParamTag)
|
||||||
w.pos(obj.Pos())
|
w.pos(obj.Pos())
|
||||||
constraint := tparam.Constraint()
|
constraint := tparam.Constraint()
|
||||||
if p.version >= iexportVersionGo1_18 {
|
if p.version >= iexportVersionGo1_18 {
|
||||||
implicit := false
|
implicit := false
|
||||||
if iface, _ := aliases.Unalias(constraint).(*types.Interface); iface != nil {
|
if iface, _ := types.Unalias(constraint).(*types.Interface); iface != nil {
|
||||||
implicit = iface.IsImplicit()
|
implicit = iface.IsImplicit()
|
||||||
}
|
}
|
||||||
w.bool(implicit)
|
w.bool(implicit)
|
||||||
|
@ -741,7 +760,7 @@ func (p *iexporter) doDecl(obj types.Object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if obj.IsAlias() {
|
if obj.IsAlias() {
|
||||||
alias, materialized := t.(*aliases.Alias) // may fail when aliases are not enabled
|
alias, materialized := t.(*types.Alias) // may fail when aliases are not enabled
|
||||||
|
|
||||||
var tparams *types.TypeParamList
|
var tparams *types.TypeParamList
|
||||||
if materialized {
|
if materialized {
|
||||||
|
@ -975,7 +994,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
switch t := t.(type) {
|
switch t := t.(type) {
|
||||||
case *aliases.Alias:
|
case *types.Alias:
|
||||||
if targs := aliases.TypeArgs(t); targs.Len() > 0 {
|
if targs := aliases.TypeArgs(t); targs.Len() > 0 {
|
||||||
w.startType(instanceType)
|
w.startType(instanceType)
|
||||||
w.pos(t.Obj().Pos())
|
w.pos(t.Obj().Pos())
|
||||||
|
@ -1091,7 +1110,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
ft := t.EmbeddedType(i)
|
ft := t.EmbeddedType(i)
|
||||||
tPkg := pkg
|
tPkg := pkg
|
||||||
if named, _ := aliases.Unalias(ft).(*types.Named); named != nil {
|
if named, _ := types.Unalias(ft).(*types.Named); named != nil {
|
||||||
w.pos(named.Obj().Pos())
|
w.pos(named.Obj().Pos())
|
||||||
} else {
|
} else {
|
||||||
w.pos(token.NoPos)
|
w.pos(token.NoPos)
|
||||||
|
|
25
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
25
vendor/golang.org/x/tools/internal/gcimporter/iimport.go
generated
vendored
|
@ -53,6 +53,7 @@ const (
|
||||||
iexportVersionPosCol = 1
|
iexportVersionPosCol = 1
|
||||||
iexportVersionGo1_18 = 2
|
iexportVersionGo1_18 = 2
|
||||||
iexportVersionGenerics = 2
|
iexportVersionGenerics = 2
|
||||||
|
iexportVersion = iexportVersionGenerics
|
||||||
|
|
||||||
iexportVersionCurrent = 2
|
iexportVersionCurrent = 2
|
||||||
)
|
)
|
||||||
|
@ -540,7 +541,7 @@ func canReuse(def *types.Named, rhs types.Type) bool {
|
||||||
if def == nil {
|
if def == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
iface, _ := aliases.Unalias(rhs).(*types.Interface)
|
iface, _ := types.Unalias(rhs).(*types.Interface)
|
||||||
if iface == nil {
|
if iface == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -557,6 +558,14 @@ type importReader struct {
|
||||||
prevColumn int64
|
prevColumn int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// markBlack is redefined in iimport_go123.go, to work around golang/go#69912.
|
||||||
|
//
|
||||||
|
// If TypeNames are not marked black (in the sense of go/types cycle
|
||||||
|
// detection), they may be mutated when dot-imported. Fix this by punching a
|
||||||
|
// hole through the type, when compiling with Go 1.23. (The bug has been fixed
|
||||||
|
// for 1.24, but the fix was not worth back-porting).
|
||||||
|
var markBlack = func(name *types.TypeName) {}
|
||||||
|
|
||||||
func (r *importReader) obj(name string) {
|
func (r *importReader) obj(name string) {
|
||||||
tag := r.byte()
|
tag := r.byte()
|
||||||
pos := r.pos()
|
pos := r.pos()
|
||||||
|
@ -569,6 +578,7 @@ func (r *importReader) obj(name string) {
|
||||||
}
|
}
|
||||||
typ := r.typ()
|
typ := r.typ()
|
||||||
obj := aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ, tparams)
|
obj := aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ, tparams)
|
||||||
|
markBlack(obj) // workaround for golang/go#69912
|
||||||
r.declare(obj)
|
r.declare(obj)
|
||||||
|
|
||||||
case constTag:
|
case constTag:
|
||||||
|
@ -589,6 +599,9 @@ func (r *importReader) obj(name string) {
|
||||||
// declaration before recursing.
|
// declaration before recursing.
|
||||||
obj := types.NewTypeName(pos, r.currPkg, name, nil)
|
obj := types.NewTypeName(pos, r.currPkg, name, nil)
|
||||||
named := types.NewNamed(obj, nil, nil)
|
named := types.NewNamed(obj, nil, nil)
|
||||||
|
|
||||||
|
markBlack(obj) // workaround for golang/go#69912
|
||||||
|
|
||||||
// Declare obj before calling r.tparamList, so the new type name is recognized
|
// Declare obj before calling r.tparamList, so the new type name is recognized
|
||||||
// if used in the constraint of one of its own typeparams (see #48280).
|
// if used in the constraint of one of its own typeparams (see #48280).
|
||||||
r.declare(obj)
|
r.declare(obj)
|
||||||
|
@ -615,7 +628,7 @@ func (r *importReader) obj(name string) {
|
||||||
if targs.Len() > 0 {
|
if targs.Len() > 0 {
|
||||||
rparams = make([]*types.TypeParam, targs.Len())
|
rparams = make([]*types.TypeParam, targs.Len())
|
||||||
for i := range rparams {
|
for i := range rparams {
|
||||||
rparams[i] = aliases.Unalias(targs.At(i)).(*types.TypeParam)
|
rparams[i] = types.Unalias(targs.At(i)).(*types.TypeParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msig := r.signature(recv, rparams, nil)
|
msig := r.signature(recv, rparams, nil)
|
||||||
|
@ -645,7 +658,7 @@ func (r *importReader) obj(name string) {
|
||||||
}
|
}
|
||||||
constraint := r.typ()
|
constraint := r.typ()
|
||||||
if implicit {
|
if implicit {
|
||||||
iface, _ := aliases.Unalias(constraint).(*types.Interface)
|
iface, _ := types.Unalias(constraint).(*types.Interface)
|
||||||
if iface == nil {
|
if iface == nil {
|
||||||
errorf("non-interface constraint marked implicit")
|
errorf("non-interface constraint marked implicit")
|
||||||
}
|
}
|
||||||
|
@ -852,7 +865,7 @@ func (r *importReader) typ() types.Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInterface(t types.Type) bool {
|
func isInterface(t types.Type) bool {
|
||||||
_, ok := aliases.Unalias(t).(*types.Interface)
|
_, ok := types.Unalias(t).(*types.Interface)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,7 +972,7 @@ func (r *importReader) doType(base *types.Named) (res types.Type) {
|
||||||
methods[i] = method
|
methods[i] = method
|
||||||
}
|
}
|
||||||
|
|
||||||
typ := newInterface(methods, embeddeds)
|
typ := types.NewInterfaceType(methods, embeddeds)
|
||||||
r.p.interfaceList = append(r.p.interfaceList, typ)
|
r.p.interfaceList = append(r.p.interfaceList, typ)
|
||||||
return typ
|
return typ
|
||||||
|
|
||||||
|
@ -1051,7 +1064,7 @@ func (r *importReader) tparamList() []*types.TypeParam {
|
||||||
for i := range xs {
|
for i := range xs {
|
||||||
// Note: the standard library importer is tolerant of nil types here,
|
// Note: the standard library importer is tolerant of nil types here,
|
||||||
// though would panic in SetTypeParams.
|
// though would panic in SetTypeParams.
|
||||||
xs[i] = aliases.Unalias(r.typ()).(*types.TypeParam)
|
xs[i] = types.Unalias(r.typ()).(*types.TypeParam)
|
||||||
}
|
}
|
||||||
return xs
|
return xs
|
||||||
}
|
}
|
||||||
|
|
53
vendor/golang.org/x/tools/internal/gcimporter/iimport_go122.go
generated
vendored
Normal file
53
vendor/golang.org/x/tools/internal/gcimporter/iimport_go122.go
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.22 && !go1.24
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO(rfindley): delete this workaround once go1.24 is assured.
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Update markBlack so that it correctly sets the color
|
||||||
|
// of imported TypeNames.
|
||||||
|
//
|
||||||
|
// See the doc comment for markBlack for details.
|
||||||
|
|
||||||
|
type color uint32
|
||||||
|
const (
|
||||||
|
white color = iota
|
||||||
|
black
|
||||||
|
grey
|
||||||
|
)
|
||||||
|
type object struct {
|
||||||
|
_ *types.Scope
|
||||||
|
_ token.Pos
|
||||||
|
_ *types.Package
|
||||||
|
_ string
|
||||||
|
_ types.Type
|
||||||
|
_ uint32
|
||||||
|
color_ color
|
||||||
|
_ token.Pos
|
||||||
|
}
|
||||||
|
type typeName struct {
|
||||||
|
object
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the size of types.TypeName changes, this will fail to compile.
|
||||||
|
const delta = int64(unsafe.Sizeof(typeName{})) - int64(unsafe.Sizeof(types.TypeName{}))
|
||||||
|
var _ [-delta * delta]int
|
||||||
|
|
||||||
|
markBlack = func(obj *types.TypeName) {
|
||||||
|
type uP = unsafe.Pointer
|
||||||
|
var ptr *typeName
|
||||||
|
*(*uP)(uP(&ptr)) = uP(obj)
|
||||||
|
ptr.color_ = black
|
||||||
|
}
|
||||||
|
}
|
22
vendor/golang.org/x/tools/internal/gcimporter/newInterface10.go
generated
vendored
22
vendor/golang.org/x/tools/internal/gcimporter/newInterface10.go
generated
vendored
|
@ -1,22 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !go1.11
|
|
||||||
// +build !go1.11
|
|
||||||
|
|
||||||
package gcimporter
|
|
||||||
|
|
||||||
import "go/types"
|
|
||||||
|
|
||||||
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
|
|
||||||
named := make([]*types.Named, len(embeddeds))
|
|
||||||
for i, e := range embeddeds {
|
|
||||||
var ok bool
|
|
||||||
named[i], ok = e.(*types.Named)
|
|
||||||
if !ok {
|
|
||||||
panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return types.NewInterface(methods, named)
|
|
||||||
}
|
|
14
vendor/golang.org/x/tools/internal/gcimporter/newInterface11.go
generated
vendored
14
vendor/golang.org/x/tools/internal/gcimporter/newInterface11.go
generated
vendored
|
@ -1,14 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build go1.11
|
|
||||||
// +build go1.11
|
|
||||||
|
|
||||||
package gcimporter
|
|
||||||
|
|
||||||
import "go/types"
|
|
||||||
|
|
||||||
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
|
|
||||||
return types.NewInterfaceType(methods, embeddeds)
|
|
||||||
}
|
|
91
vendor/golang.org/x/tools/internal/gcimporter/predeclared.go
generated
vendored
Normal file
91
vendor/golang.org/x/tools/internal/gcimporter/predeclared.go
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/types"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// predecl is a cache for the predeclared types in types.Universe.
|
||||||
|
//
|
||||||
|
// Cache a distinct result based on the runtime value of any.
|
||||||
|
// The pointer value of the any type varies based on GODEBUG settings.
|
||||||
|
var predeclMu sync.Mutex
|
||||||
|
var predecl map[types.Type][]types.Type
|
||||||
|
|
||||||
|
func predeclared() []types.Type {
|
||||||
|
anyt := types.Universe.Lookup("any").Type()
|
||||||
|
|
||||||
|
predeclMu.Lock()
|
||||||
|
defer predeclMu.Unlock()
|
||||||
|
|
||||||
|
if pre, ok := predecl[anyt]; ok {
|
||||||
|
return pre
|
||||||
|
}
|
||||||
|
|
||||||
|
if predecl == nil {
|
||||||
|
predecl = make(map[types.Type][]types.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
decls := []types.Type{ // basic types
|
||||||
|
types.Typ[types.Bool],
|
||||||
|
types.Typ[types.Int],
|
||||||
|
types.Typ[types.Int8],
|
||||||
|
types.Typ[types.Int16],
|
||||||
|
types.Typ[types.Int32],
|
||||||
|
types.Typ[types.Int64],
|
||||||
|
types.Typ[types.Uint],
|
||||||
|
types.Typ[types.Uint8],
|
||||||
|
types.Typ[types.Uint16],
|
||||||
|
types.Typ[types.Uint32],
|
||||||
|
types.Typ[types.Uint64],
|
||||||
|
types.Typ[types.Uintptr],
|
||||||
|
types.Typ[types.Float32],
|
||||||
|
types.Typ[types.Float64],
|
||||||
|
types.Typ[types.Complex64],
|
||||||
|
types.Typ[types.Complex128],
|
||||||
|
types.Typ[types.String],
|
||||||
|
|
||||||
|
// basic type aliases
|
||||||
|
types.Universe.Lookup("byte").Type(),
|
||||||
|
types.Universe.Lookup("rune").Type(),
|
||||||
|
|
||||||
|
// error
|
||||||
|
types.Universe.Lookup("error").Type(),
|
||||||
|
|
||||||
|
// untyped types
|
||||||
|
types.Typ[types.UntypedBool],
|
||||||
|
types.Typ[types.UntypedInt],
|
||||||
|
types.Typ[types.UntypedRune],
|
||||||
|
types.Typ[types.UntypedFloat],
|
||||||
|
types.Typ[types.UntypedComplex],
|
||||||
|
types.Typ[types.UntypedString],
|
||||||
|
types.Typ[types.UntypedNil],
|
||||||
|
|
||||||
|
// package unsafe
|
||||||
|
types.Typ[types.UnsafePointer],
|
||||||
|
|
||||||
|
// invalid type
|
||||||
|
types.Typ[types.Invalid], // only appears in packages with errors
|
||||||
|
|
||||||
|
// used internally by gc; never used by this package or in .a files
|
||||||
|
anyType{},
|
||||||
|
|
||||||
|
// comparable
|
||||||
|
types.Universe.Lookup("comparable").Type(),
|
||||||
|
|
||||||
|
// any
|
||||||
|
anyt,
|
||||||
|
}
|
||||||
|
|
||||||
|
predecl[anyt] = decls
|
||||||
|
return decls
|
||||||
|
}
|
||||||
|
|
||||||
|
type anyType struct{}
|
||||||
|
|
||||||
|
func (t anyType) Underlying() types.Type { return t }
|
||||||
|
func (t anyType) String() string { return "any" }
|
34
vendor/golang.org/x/tools/internal/gcimporter/support_go118.go
generated
vendored
34
vendor/golang.org/x/tools/internal/gcimporter/support_go118.go
generated
vendored
|
@ -1,34 +0,0 @@
|
||||||
// Copyright 2021 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package gcimporter
|
|
||||||
|
|
||||||
import "go/types"
|
|
||||||
|
|
||||||
const iexportVersion = iexportVersionGenerics
|
|
||||||
|
|
||||||
// additionalPredeclared returns additional predeclared types in go.1.18.
|
|
||||||
func additionalPredeclared() []types.Type {
|
|
||||||
return []types.Type{
|
|
||||||
// comparable
|
|
||||||
types.Universe.Lookup("comparable").Type(),
|
|
||||||
|
|
||||||
// any
|
|
||||||
types.Universe.Lookup("any").Type(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See cmd/compile/internal/types.SplitVargenSuffix.
|
|
||||||
func splitVargenSuffix(name string) (base, suffix string) {
|
|
||||||
i := len(name)
|
|
||||||
for i > 0 && name[i-1] >= '0' && name[i-1] <= '9' {
|
|
||||||
i--
|
|
||||||
}
|
|
||||||
const dot = "·"
|
|
||||||
if i >= len(dot) && name[i-len(dot):i] == dot {
|
|
||||||
i -= len(dot)
|
|
||||||
return name[:i], name[i:]
|
|
||||||
}
|
|
||||||
return name, ""
|
|
||||||
}
|
|
10
vendor/golang.org/x/tools/internal/gcimporter/unified_no.go
generated
vendored
10
vendor/golang.org/x/tools/internal/gcimporter/unified_no.go
generated
vendored
|
@ -1,10 +0,0 @@
|
||||||
// Copyright 2022 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !goexperiment.unified
|
|
||||||
// +build !goexperiment.unified
|
|
||||||
|
|
||||||
package gcimporter
|
|
||||||
|
|
||||||
const unifiedIR = false
|
|
10
vendor/golang.org/x/tools/internal/gcimporter/unified_yes.go
generated
vendored
10
vendor/golang.org/x/tools/internal/gcimporter/unified_yes.go
generated
vendored
|
@ -1,10 +0,0 @@
|
||||||
// Copyright 2022 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build goexperiment.unified
|
|
||||||
// +build goexperiment.unified
|
|
||||||
|
|
||||||
package gcimporter
|
|
||||||
|
|
||||||
const unifiedIR = true
|
|
16
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
16
vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go
generated
vendored
|
@ -562,7 +562,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
|
||||||
// If the underlying type is an interface, we need to
|
// If the underlying type is an interface, we need to
|
||||||
// duplicate its methods so we can replace the receiver
|
// duplicate its methods so we can replace the receiver
|
||||||
// parameter's type (#49906).
|
// parameter's type (#49906).
|
||||||
if iface, ok := aliases.Unalias(underlying).(*types.Interface); ok && iface.NumExplicitMethods() != 0 {
|
if iface, ok := types.Unalias(underlying).(*types.Interface); ok && iface.NumExplicitMethods() != 0 {
|
||||||
methods := make([]*types.Func, iface.NumExplicitMethods())
|
methods := make([]*types.Func, iface.NumExplicitMethods())
|
||||||
for i := range methods {
|
for i := range methods {
|
||||||
fn := iface.ExplicitMethod(i)
|
fn := iface.ExplicitMethod(i)
|
||||||
|
@ -738,3 +738,17 @@ func pkgScope(pkg *types.Package) *types.Scope {
|
||||||
}
|
}
|
||||||
return types.Universe
|
return types.Universe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See cmd/compile/internal/types.SplitVargenSuffix.
|
||||||
|
func splitVargenSuffix(name string) (base, suffix string) {
|
||||||
|
i := len(name)
|
||||||
|
for i > 0 && name[i-1] >= '0' && name[i-1] <= '9' {
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
const dot = "·"
|
||||||
|
if i >= len(dot) && name[i-len(dot):i] == dot {
|
||||||
|
i -= len(dot)
|
||||||
|
return name[:i], name[i:]
|
||||||
|
}
|
||||||
|
return name, ""
|
||||||
|
}
|
||||||
|
|
18
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
18
vendor/golang.org/x/tools/internal/gocommand/invoke.go
generated
vendored
|
@ -16,7 +16,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -250,16 +249,13 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||||
cmd.Stdout = stdout
|
cmd.Stdout = stdout
|
||||||
cmd.Stderr = stderr
|
cmd.Stderr = stderr
|
||||||
|
|
||||||
// cmd.WaitDelay was added only in go1.20 (see #50436).
|
// https://go.dev/issue/59541: don't wait forever copying stderr
|
||||||
if waitDelay := reflect.ValueOf(cmd).Elem().FieldByName("WaitDelay"); waitDelay.IsValid() {
|
// after the command has exited.
|
||||||
// https://go.dev/issue/59541: don't wait forever copying stderr
|
// After CL 484741 we copy stdout manually, so we we'll stop reading that as
|
||||||
// after the command has exited.
|
// soon as ctx is done. However, we also don't want to wait around forever
|
||||||
// After CL 484741 we copy stdout manually, so we we'll stop reading that as
|
// for stderr. Give a much-longer-than-reasonable delay and then assume that
|
||||||
// soon as ctx is done. However, we also don't want to wait around forever
|
// something has wedged in the kernel or runtime.
|
||||||
// for stderr. Give a much-longer-than-reasonable delay and then assume that
|
cmd.WaitDelay = 30 * time.Second
|
||||||
// something has wedged in the kernel or runtime.
|
|
||||||
waitDelay.Set(reflect.ValueOf(30 * time.Second))
|
|
||||||
}
|
|
||||||
|
|
||||||
// The cwd gets resolved to the real path. On Darwin, where
|
// The cwd gets resolved to the real path. On Darwin, where
|
||||||
// /tmp is a symlink, this breaks anything that expects the
|
// /tmp is a symlink, this breaks anything that expects the
|
||||||
|
|
2
vendor/golang.org/x/tools/internal/packagesinternal/packages.go
generated
vendored
2
vendor/golang.org/x/tools/internal/packagesinternal/packages.go
generated
vendored
|
@ -5,7 +5,6 @@
|
||||||
// Package packagesinternal exposes internal-only fields from go/packages.
|
// Package packagesinternal exposes internal-only fields from go/packages.
|
||||||
package packagesinternal
|
package packagesinternal
|
||||||
|
|
||||||
var GetForTest = func(p interface{}) string { return "" }
|
|
||||||
var GetDepsErrors = func(p interface{}) []*PackageError { return nil }
|
var GetDepsErrors = func(p interface{}) []*PackageError { return nil }
|
||||||
|
|
||||||
type PackageError struct {
|
type PackageError struct {
|
||||||
|
@ -16,7 +15,6 @@ type PackageError struct {
|
||||||
|
|
||||||
var TypecheckCgo int
|
var TypecheckCgo int
|
||||||
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
|
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
|
||||||
var ForTest int // must be set as a LoadMode to call GetForTest
|
|
||||||
|
|
||||||
var SetModFlag = func(config interface{}, value string) {}
|
var SetModFlag = func(config interface{}, value string) {}
|
||||||
var SetModFile = func(config interface{}, value string) {}
|
var SetModFile = func(config interface{}, value string) {}
|
||||||
|
|
137
vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go
generated
vendored
137
vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go
generated
vendored
|
@ -1,137 +0,0 @@
|
||||||
// Copyright 2023 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// package tokeninternal provides access to some internal features of the token
|
|
||||||
// package.
|
|
||||||
package tokeninternal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/token"
|
|
||||||
"sort"
|
|
||||||
"sync"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetLines returns the table of line-start offsets from a token.File.
|
|
||||||
func GetLines(file *token.File) []int {
|
|
||||||
// token.File has a Lines method on Go 1.21 and later.
|
|
||||||
if file, ok := (interface{})(file).(interface{ Lines() []int }); ok {
|
|
||||||
return file.Lines()
|
|
||||||
}
|
|
||||||
|
|
||||||
// This declaration must match that of token.File.
|
|
||||||
// This creates a risk of dependency skew.
|
|
||||||
// For now we check that the size of the two
|
|
||||||
// declarations is the same, on the (fragile) assumption
|
|
||||||
// that future changes would add fields.
|
|
||||||
type tokenFile119 struct {
|
|
||||||
_ string
|
|
||||||
_ int
|
|
||||||
_ int
|
|
||||||
mu sync.Mutex // we're not complete monsters
|
|
||||||
lines []int
|
|
||||||
_ []struct{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if unsafe.Sizeof(*file) != unsafe.Sizeof(tokenFile119{}) {
|
|
||||||
panic("unexpected token.File size")
|
|
||||||
}
|
|
||||||
var ptr *tokenFile119
|
|
||||||
type uP = unsafe.Pointer
|
|
||||||
*(*uP)(uP(&ptr)) = uP(file)
|
|
||||||
ptr.mu.Lock()
|
|
||||||
defer ptr.mu.Unlock()
|
|
||||||
return ptr.lines
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddExistingFiles adds the specified files to the FileSet if they
|
|
||||||
// are not already present. It panics if any pair of files in the
|
|
||||||
// resulting FileSet would overlap.
|
|
||||||
func AddExistingFiles(fset *token.FileSet, files []*token.File) {
|
|
||||||
// Punch through the FileSet encapsulation.
|
|
||||||
type tokenFileSet struct {
|
|
||||||
// This type remained essentially consistent from go1.16 to go1.21.
|
|
||||||
mutex sync.RWMutex
|
|
||||||
base int
|
|
||||||
files []*token.File
|
|
||||||
_ *token.File // changed to atomic.Pointer[token.File] in go1.19
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the size of token.FileSet changes, this will fail to compile.
|
|
||||||
const delta = int64(unsafe.Sizeof(tokenFileSet{})) - int64(unsafe.Sizeof(token.FileSet{}))
|
|
||||||
var _ [-delta * delta]int
|
|
||||||
|
|
||||||
type uP = unsafe.Pointer
|
|
||||||
var ptr *tokenFileSet
|
|
||||||
*(*uP)(uP(&ptr)) = uP(fset)
|
|
||||||
ptr.mutex.Lock()
|
|
||||||
defer ptr.mutex.Unlock()
|
|
||||||
|
|
||||||
// Merge and sort.
|
|
||||||
newFiles := append(ptr.files, files...)
|
|
||||||
sort.Slice(newFiles, func(i, j int) bool {
|
|
||||||
return newFiles[i].Base() < newFiles[j].Base()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Reject overlapping files.
|
|
||||||
// Discard adjacent identical files.
|
|
||||||
out := newFiles[:0]
|
|
||||||
for i, file := range newFiles {
|
|
||||||
if i > 0 {
|
|
||||||
prev := newFiles[i-1]
|
|
||||||
if file == prev {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if prev.Base()+prev.Size()+1 > file.Base() {
|
|
||||||
panic(fmt.Sprintf("file %s (%d-%d) overlaps with file %s (%d-%d)",
|
|
||||||
prev.Name(), prev.Base(), prev.Base()+prev.Size(),
|
|
||||||
file.Name(), file.Base(), file.Base()+file.Size()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out = append(out, file)
|
|
||||||
}
|
|
||||||
newFiles = out
|
|
||||||
|
|
||||||
ptr.files = newFiles
|
|
||||||
|
|
||||||
// Advance FileSet.Base().
|
|
||||||
if len(newFiles) > 0 {
|
|
||||||
last := newFiles[len(newFiles)-1]
|
|
||||||
newBase := last.Base() + last.Size() + 1
|
|
||||||
if ptr.base < newBase {
|
|
||||||
ptr.base = newBase
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FileSetFor returns a new FileSet containing a sequence of new Files with
|
|
||||||
// the same base, size, and line as the input files, for use in APIs that
|
|
||||||
// require a FileSet.
|
|
||||||
//
|
|
||||||
// Precondition: the input files must be non-overlapping, and sorted in order
|
|
||||||
// of their Base.
|
|
||||||
func FileSetFor(files ...*token.File) *token.FileSet {
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
for _, f := range files {
|
|
||||||
f2 := fset.AddFile(f.Name(), f.Base(), f.Size())
|
|
||||||
lines := GetLines(f)
|
|
||||||
f2.SetLines(lines)
|
|
||||||
}
|
|
||||||
return fset
|
|
||||||
}
|
|
||||||
|
|
||||||
// CloneFileSet creates a new FileSet holding all files in fset. It does not
|
|
||||||
// create copies of the token.Files in fset: they are added to the resulting
|
|
||||||
// FileSet unmodified.
|
|
||||||
func CloneFileSet(fset *token.FileSet) *token.FileSet {
|
|
||||||
var files []*token.File
|
|
||||||
fset.Iterate(func(f *token.File) bool {
|
|
||||||
files = append(files, f)
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
newFileSet := token.NewFileSet()
|
|
||||||
AddExistingFiles(newFileSet, files)
|
|
||||||
return newFileSet
|
|
||||||
}
|
|
140
vendor/golang.org/x/tools/internal/typeparams/common.go
generated
vendored
Normal file
140
vendor/golang.org/x/tools/internal/typeparams/common.go
generated
vendored
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package typeparams contains common utilities for writing tools that
|
||||||
|
// interact with generic Go code, as introduced with Go 1.18. It
|
||||||
|
// supplements the standard library APIs. Notably, the StructuralTerms
|
||||||
|
// API computes a minimal representation of the structural
|
||||||
|
// restrictions on a type parameter.
|
||||||
|
//
|
||||||
|
// An external version of these APIs is available in the
|
||||||
|
// golang.org/x/exp/typeparams module.
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UnpackIndexExpr extracts data from AST nodes that represent index
|
||||||
|
// expressions.
|
||||||
|
//
|
||||||
|
// For an ast.IndexExpr, the resulting indices slice will contain exactly one
|
||||||
|
// index expression. For an ast.IndexListExpr (go1.18+), it may have a variable
|
||||||
|
// number of index expressions.
|
||||||
|
//
|
||||||
|
// For nodes that don't represent index expressions, the first return value of
|
||||||
|
// UnpackIndexExpr will be nil.
|
||||||
|
func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) {
|
||||||
|
switch e := n.(type) {
|
||||||
|
case *ast.IndexExpr:
|
||||||
|
return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack
|
||||||
|
case *ast.IndexListExpr:
|
||||||
|
return e.X, e.Lbrack, e.Indices, e.Rbrack
|
||||||
|
}
|
||||||
|
return nil, token.NoPos, nil, token.NoPos
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackIndexExpr returns an *ast.IndexExpr or *ast.IndexListExpr, depending on
|
||||||
|
// the cardinality of indices. Calling PackIndexExpr with len(indices) == 0
|
||||||
|
// will panic.
|
||||||
|
func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr {
|
||||||
|
switch len(indices) {
|
||||||
|
case 0:
|
||||||
|
panic("empty indices")
|
||||||
|
case 1:
|
||||||
|
return &ast.IndexExpr{
|
||||||
|
X: x,
|
||||||
|
Lbrack: lbrack,
|
||||||
|
Index: indices[0],
|
||||||
|
Rbrack: rbrack,
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return &ast.IndexListExpr{
|
||||||
|
X: x,
|
||||||
|
Lbrack: lbrack,
|
||||||
|
Indices: indices,
|
||||||
|
Rbrack: rbrack,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsTypeParam reports whether t is a type parameter (or an alias of one).
|
||||||
|
func IsTypeParam(t types.Type) bool {
|
||||||
|
_, ok := types.Unalias(t).(*types.TypeParam)
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// GenericAssignableTo is a generalization of types.AssignableTo that
|
||||||
|
// implements the following rule for uninstantiated generic types:
|
||||||
|
//
|
||||||
|
// If V and T are generic named types, then V is considered assignable to T if,
|
||||||
|
// for every possible instantiation of V[A_1, ..., A_N], the instantiation
|
||||||
|
// T[A_1, ..., A_N] is valid and V[A_1, ..., A_N] implements T[A_1, ..., A_N].
|
||||||
|
//
|
||||||
|
// If T has structural constraints, they must be satisfied by V.
|
||||||
|
//
|
||||||
|
// For example, consider the following type declarations:
|
||||||
|
//
|
||||||
|
// type Interface[T any] interface {
|
||||||
|
// Accept(T)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// type Container[T any] struct {
|
||||||
|
// Element T
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func (c Container[T]) Accept(t T) { c.Element = t }
|
||||||
|
//
|
||||||
|
// In this case, GenericAssignableTo reports that instantiations of Container
|
||||||
|
// are assignable to the corresponding instantiation of Interface.
|
||||||
|
func GenericAssignableTo(ctxt *types.Context, V, T types.Type) bool {
|
||||||
|
V = types.Unalias(V)
|
||||||
|
T = types.Unalias(T)
|
||||||
|
|
||||||
|
// If V and T are not both named, or do not have matching non-empty type
|
||||||
|
// parameter lists, fall back on types.AssignableTo.
|
||||||
|
|
||||||
|
VN, Vnamed := V.(*types.Named)
|
||||||
|
TN, Tnamed := T.(*types.Named)
|
||||||
|
if !Vnamed || !Tnamed {
|
||||||
|
return types.AssignableTo(V, T)
|
||||||
|
}
|
||||||
|
|
||||||
|
vtparams := VN.TypeParams()
|
||||||
|
ttparams := TN.TypeParams()
|
||||||
|
if vtparams.Len() == 0 || vtparams.Len() != ttparams.Len() || VN.TypeArgs().Len() != 0 || TN.TypeArgs().Len() != 0 {
|
||||||
|
return types.AssignableTo(V, T)
|
||||||
|
}
|
||||||
|
|
||||||
|
// V and T have the same (non-zero) number of type params. Instantiate both
|
||||||
|
// with the type parameters of V. This must always succeed for V, and will
|
||||||
|
// succeed for T if and only if the type set of each type parameter of V is a
|
||||||
|
// subset of the type set of the corresponding type parameter of T, meaning
|
||||||
|
// that every instantiation of V corresponds to a valid instantiation of T.
|
||||||
|
|
||||||
|
// Minor optimization: ensure we share a context across the two
|
||||||
|
// instantiations below.
|
||||||
|
if ctxt == nil {
|
||||||
|
ctxt = types.NewContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
var targs []types.Type
|
||||||
|
for i := 0; i < vtparams.Len(); i++ {
|
||||||
|
targs = append(targs, vtparams.At(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
vinst, err := types.Instantiate(ctxt, V, targs, true)
|
||||||
|
if err != nil {
|
||||||
|
panic("type parameters should satisfy their own constraints")
|
||||||
|
}
|
||||||
|
|
||||||
|
tinst, err := types.Instantiate(ctxt, T, targs, true)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return types.AssignableTo(vinst, tinst)
|
||||||
|
}
|
150
vendor/golang.org/x/tools/internal/typeparams/coretype.go
generated
vendored
Normal file
150
vendor/golang.org/x/tools/internal/typeparams/coretype.go
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
// Copyright 2022 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CoreType returns the core type of T or nil if T does not have a core type.
|
||||||
|
//
|
||||||
|
// See https://go.dev/ref/spec#Core_types for the definition of a core type.
|
||||||
|
func CoreType(T types.Type) types.Type {
|
||||||
|
U := T.Underlying()
|
||||||
|
if _, ok := U.(*types.Interface); !ok {
|
||||||
|
return U // for non-interface types,
|
||||||
|
}
|
||||||
|
|
||||||
|
terms, err := NormalTerms(U)
|
||||||
|
if len(terms) == 0 || err != nil {
|
||||||
|
// len(terms) -> empty type set of interface.
|
||||||
|
// err != nil => U is invalid, exceeds complexity bounds, or has an empty type set.
|
||||||
|
return nil // no core type.
|
||||||
|
}
|
||||||
|
|
||||||
|
U = terms[0].Type().Underlying()
|
||||||
|
var identical int // i in [0,identical) => Identical(U, terms[i].Type().Underlying())
|
||||||
|
for identical = 1; identical < len(terms); identical++ {
|
||||||
|
if !types.Identical(U, terms[identical].Type().Underlying()) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if identical == len(terms) {
|
||||||
|
// https://go.dev/ref/spec#Core_types
|
||||||
|
// "There is a single type U which is the underlying type of all types in the type set of T"
|
||||||
|
return U
|
||||||
|
}
|
||||||
|
ch, ok := U.(*types.Chan)
|
||||||
|
if !ok {
|
||||||
|
return nil // no core type as identical < len(terms) and U is not a channel.
|
||||||
|
}
|
||||||
|
// https://go.dev/ref/spec#Core_types
|
||||||
|
// "the type chan E if T contains only bidirectional channels, or the type chan<- E or
|
||||||
|
// <-chan E depending on the direction of the directional channels present."
|
||||||
|
for chans := identical; chans < len(terms); chans++ {
|
||||||
|
curr, ok := terms[chans].Type().Underlying().(*types.Chan)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !types.Identical(ch.Elem(), curr.Elem()) {
|
||||||
|
return nil // channel elements are not identical.
|
||||||
|
}
|
||||||
|
if ch.Dir() == types.SendRecv {
|
||||||
|
// ch is bidirectional. We can safely always use curr's direction.
|
||||||
|
ch = curr
|
||||||
|
} else if curr.Dir() != types.SendRecv && ch.Dir() != curr.Dir() {
|
||||||
|
// ch and curr are not bidirectional and not the same direction.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
|
// NormalTerms returns a slice of terms representing the normalized structural
|
||||||
|
// type restrictions of a type, if any.
|
||||||
|
//
|
||||||
|
// For all types other than *types.TypeParam, *types.Interface, and
|
||||||
|
// *types.Union, this is just a single term with Tilde() == false and
|
||||||
|
// Type() == typ. For *types.TypeParam, *types.Interface, and *types.Union, see
|
||||||
|
// below.
|
||||||
|
//
|
||||||
|
// Structural type restrictions of a type parameter are created via
|
||||||
|
// non-interface types embedded in its constraint interface (directly, or via a
|
||||||
|
// chain of interface embeddings). For example, in the declaration type
|
||||||
|
// T[P interface{~int; m()}] int the structural restriction of the type
|
||||||
|
// parameter P is ~int.
|
||||||
|
//
|
||||||
|
// With interface embedding and unions, the specification of structural type
|
||||||
|
// restrictions may be arbitrarily complex. For example, consider the
|
||||||
|
// following:
|
||||||
|
//
|
||||||
|
// type A interface{ ~string|~[]byte }
|
||||||
|
//
|
||||||
|
// type B interface{ int|string }
|
||||||
|
//
|
||||||
|
// type C interface { ~string|~int }
|
||||||
|
//
|
||||||
|
// type T[P interface{ A|B; C }] int
|
||||||
|
//
|
||||||
|
// In this example, the structural type restriction of P is ~string|int: A|B
|
||||||
|
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,
|
||||||
|
// which when intersected with C (~string|~int) yields ~string|int.
|
||||||
|
//
|
||||||
|
// NormalTerms computes these expansions and reductions, producing a
|
||||||
|
// "normalized" form of the embeddings. A structural restriction is normalized
|
||||||
|
// if it is a single union containing no interface terms, and is minimal in the
|
||||||
|
// sense that removing any term changes the set of types satisfying the
|
||||||
|
// constraint. It is left as a proof for the reader that, modulo sorting, there
|
||||||
|
// is exactly one such normalized form.
|
||||||
|
//
|
||||||
|
// Because the minimal representation always takes this form, NormalTerms
|
||||||
|
// returns a slice of tilde terms corresponding to the terms of the union in
|
||||||
|
// the normalized structural restriction. An error is returned if the type is
|
||||||
|
// invalid, exceeds complexity bounds, or has an empty type set. In the latter
|
||||||
|
// case, NormalTerms returns ErrEmptyTypeSet.
|
||||||
|
//
|
||||||
|
// NormalTerms makes no guarantees about the order of terms, except that it
|
||||||
|
// is deterministic.
|
||||||
|
func NormalTerms(typ types.Type) ([]*types.Term, error) {
|
||||||
|
switch typ := typ.Underlying().(type) {
|
||||||
|
case *types.TypeParam:
|
||||||
|
return StructuralTerms(typ)
|
||||||
|
case *types.Union:
|
||||||
|
return UnionTermSet(typ)
|
||||||
|
case *types.Interface:
|
||||||
|
return InterfaceTermSet(typ)
|
||||||
|
default:
|
||||||
|
return []*types.Term{types.NewTerm(false, typ)}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deref returns the type of the variable pointed to by t,
|
||||||
|
// if t's core type is a pointer; otherwise it returns t.
|
||||||
|
//
|
||||||
|
// Do not assume that Deref(T)==T implies T is not a pointer:
|
||||||
|
// consider "type T *T", for example.
|
||||||
|
//
|
||||||
|
// TODO(adonovan): ideally this would live in typesinternal, but that
|
||||||
|
// creates an import cycle. Move there when we melt this package down.
|
||||||
|
func Deref(t types.Type) types.Type {
|
||||||
|
if ptr, ok := CoreType(t).(*types.Pointer); ok {
|
||||||
|
return ptr.Elem()
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
// MustDeref returns the type of the variable pointed to by t.
|
||||||
|
// It panics if t's core type is not a pointer.
|
||||||
|
//
|
||||||
|
// TODO(adonovan): ideally this would live in typesinternal, but that
|
||||||
|
// creates an import cycle. Move there when we melt this package down.
|
||||||
|
func MustDeref(t types.Type) types.Type {
|
||||||
|
if ptr, ok := CoreType(t).(*types.Pointer); ok {
|
||||||
|
return ptr.Elem()
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("%v is not a pointer", t))
|
||||||
|
}
|
131
vendor/golang.org/x/tools/internal/typeparams/free.go
generated
vendored
Normal file
131
vendor/golang.org/x/tools/internal/typeparams/free.go
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/types"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/aliases"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Free is a memoization of the set of free type parameters within a
|
||||||
|
// type. It makes a sequence of calls to [Free.Has] for overlapping
|
||||||
|
// types more efficient. The zero value is ready for use.
|
||||||
|
//
|
||||||
|
// NOTE: Adapted from go/types/infer.go. If it is later exported, factor.
|
||||||
|
type Free struct {
|
||||||
|
seen map[types.Type]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Has reports whether the specified type has a free type parameter.
|
||||||
|
func (w *Free) Has(typ types.Type) (res bool) {
|
||||||
|
// detect cycles
|
||||||
|
if x, ok := w.seen[typ]; ok {
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
if w.seen == nil {
|
||||||
|
w.seen = make(map[types.Type]bool)
|
||||||
|
}
|
||||||
|
w.seen[typ] = false
|
||||||
|
defer func() {
|
||||||
|
w.seen[typ] = res
|
||||||
|
}()
|
||||||
|
|
||||||
|
switch t := typ.(type) {
|
||||||
|
case nil, *types.Basic: // TODO(gri) should nil be handled here?
|
||||||
|
break
|
||||||
|
|
||||||
|
case *types.Alias:
|
||||||
|
if aliases.TypeParams(t).Len() > aliases.TypeArgs(t).Len() {
|
||||||
|
return true // This is an uninstantiated Alias.
|
||||||
|
}
|
||||||
|
// The expansion of an alias can have free type parameters,
|
||||||
|
// whether or not the alias itself has type parameters:
|
||||||
|
//
|
||||||
|
// func _[K comparable]() {
|
||||||
|
// type Set = map[K]bool // free(Set) = {K}
|
||||||
|
// type MapTo[V] = map[K]V // free(Map[foo]) = {V}
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// So, we must Unalias.
|
||||||
|
return w.Has(types.Unalias(t))
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
return w.Has(t.Elem())
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
return w.Has(t.Elem())
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
for i, n := 0, t.NumFields(); i < n; i++ {
|
||||||
|
if w.Has(t.Field(i).Type()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
return w.Has(t.Elem())
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
n := t.Len()
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
if w.Has(t.At(i).Type()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
// t.tparams may not be nil if we are looking at a signature
|
||||||
|
// of a generic function type (or an interface method) that is
|
||||||
|
// part of the type we're testing. We don't care about these type
|
||||||
|
// parameters.
|
||||||
|
// Similarly, the receiver of a method may declare (rather than
|
||||||
|
// use) type parameters, we don't care about those either.
|
||||||
|
// Thus, we only need to look at the input and result parameters.
|
||||||
|
return w.Has(t.Params()) || w.Has(t.Results())
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
for i, n := 0, t.NumMethods(); i < n; i++ {
|
||||||
|
if w.Has(t.Method(i).Type()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
terms, err := InterfaceTermSet(t)
|
||||||
|
if err != nil {
|
||||||
|
return false // ill typed
|
||||||
|
}
|
||||||
|
for _, term := range terms {
|
||||||
|
if w.Has(term.Type()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
return w.Has(t.Key()) || w.Has(t.Elem())
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
return w.Has(t.Elem())
|
||||||
|
|
||||||
|
case *types.Named:
|
||||||
|
args := t.TypeArgs()
|
||||||
|
if params := t.TypeParams(); params.Len() > args.Len() {
|
||||||
|
return true // this is an uninstantiated named type.
|
||||||
|
}
|
||||||
|
for i, n := 0, args.Len(); i < n; i++ {
|
||||||
|
if w.Has(args.At(i)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return w.Has(t.Underlying()) // recurse for types local to parameterized functions
|
||||||
|
|
||||||
|
case *types.TypeParam:
|
||||||
|
return true
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(t) // unreachable
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
218
vendor/golang.org/x/tools/internal/typeparams/normalize.go
generated
vendored
Normal file
218
vendor/golang.org/x/tools/internal/typeparams/normalize.go
generated
vendored
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:generate go run copytermlist.go
|
||||||
|
|
||||||
|
const debug = false
|
||||||
|
|
||||||
|
var ErrEmptyTypeSet = errors.New("empty type set")
|
||||||
|
|
||||||
|
// StructuralTerms returns a slice of terms representing the normalized
|
||||||
|
// structural type restrictions of a type parameter, if any.
|
||||||
|
//
|
||||||
|
// Structural type restrictions of a type parameter are created via
|
||||||
|
// non-interface types embedded in its constraint interface (directly, or via a
|
||||||
|
// chain of interface embeddings). For example, in the declaration
|
||||||
|
//
|
||||||
|
// type T[P interface{~int; m()}] int
|
||||||
|
//
|
||||||
|
// the structural restriction of the type parameter P is ~int.
|
||||||
|
//
|
||||||
|
// With interface embedding and unions, the specification of structural type
|
||||||
|
// restrictions may be arbitrarily complex. For example, consider the
|
||||||
|
// following:
|
||||||
|
//
|
||||||
|
// type A interface{ ~string|~[]byte }
|
||||||
|
//
|
||||||
|
// type B interface{ int|string }
|
||||||
|
//
|
||||||
|
// type C interface { ~string|~int }
|
||||||
|
//
|
||||||
|
// type T[P interface{ A|B; C }] int
|
||||||
|
//
|
||||||
|
// In this example, the structural type restriction of P is ~string|int: A|B
|
||||||
|
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,
|
||||||
|
// which when intersected with C (~string|~int) yields ~string|int.
|
||||||
|
//
|
||||||
|
// StructuralTerms computes these expansions and reductions, producing a
|
||||||
|
// "normalized" form of the embeddings. A structural restriction is normalized
|
||||||
|
// if it is a single union containing no interface terms, and is minimal in the
|
||||||
|
// sense that removing any term changes the set of types satisfying the
|
||||||
|
// constraint. It is left as a proof for the reader that, modulo sorting, there
|
||||||
|
// is exactly one such normalized form.
|
||||||
|
//
|
||||||
|
// Because the minimal representation always takes this form, StructuralTerms
|
||||||
|
// returns a slice of tilde terms corresponding to the terms of the union in
|
||||||
|
// the normalized structural restriction. An error is returned if the
|
||||||
|
// constraint interface is invalid, exceeds complexity bounds, or has an empty
|
||||||
|
// type set. In the latter case, StructuralTerms returns ErrEmptyTypeSet.
|
||||||
|
//
|
||||||
|
// StructuralTerms makes no guarantees about the order of terms, except that it
|
||||||
|
// is deterministic.
|
||||||
|
func StructuralTerms(tparam *types.TypeParam) ([]*types.Term, error) {
|
||||||
|
constraint := tparam.Constraint()
|
||||||
|
if constraint == nil {
|
||||||
|
return nil, fmt.Errorf("%s has nil constraint", tparam)
|
||||||
|
}
|
||||||
|
iface, _ := constraint.Underlying().(*types.Interface)
|
||||||
|
if iface == nil {
|
||||||
|
return nil, fmt.Errorf("constraint is %T, not *types.Interface", constraint.Underlying())
|
||||||
|
}
|
||||||
|
return InterfaceTermSet(iface)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InterfaceTermSet computes the normalized terms for a constraint interface,
|
||||||
|
// returning an error if the term set cannot be computed or is empty. In the
|
||||||
|
// latter case, the error will be ErrEmptyTypeSet.
|
||||||
|
//
|
||||||
|
// See the documentation of StructuralTerms for more information on
|
||||||
|
// normalization.
|
||||||
|
func InterfaceTermSet(iface *types.Interface) ([]*types.Term, error) {
|
||||||
|
return computeTermSet(iface)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnionTermSet computes the normalized terms for a union, returning an error
|
||||||
|
// if the term set cannot be computed or is empty. In the latter case, the
|
||||||
|
// error will be ErrEmptyTypeSet.
|
||||||
|
//
|
||||||
|
// See the documentation of StructuralTerms for more information on
|
||||||
|
// normalization.
|
||||||
|
func UnionTermSet(union *types.Union) ([]*types.Term, error) {
|
||||||
|
return computeTermSet(union)
|
||||||
|
}
|
||||||
|
|
||||||
|
func computeTermSet(typ types.Type) ([]*types.Term, error) {
|
||||||
|
tset, err := computeTermSetInternal(typ, make(map[types.Type]*termSet), 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if tset.terms.isEmpty() {
|
||||||
|
return nil, ErrEmptyTypeSet
|
||||||
|
}
|
||||||
|
if tset.terms.isAll() {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
var terms []*types.Term
|
||||||
|
for _, term := range tset.terms {
|
||||||
|
terms = append(terms, types.NewTerm(term.tilde, term.typ))
|
||||||
|
}
|
||||||
|
return terms, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// A termSet holds the normalized set of terms for a given type.
|
||||||
|
//
|
||||||
|
// The name termSet is intentionally distinct from 'type set': a type set is
|
||||||
|
// all types that implement a type (and includes method restrictions), whereas
|
||||||
|
// a term set just represents the structural restrictions on a type.
|
||||||
|
type termSet struct {
|
||||||
|
complete bool
|
||||||
|
terms termlist
|
||||||
|
}
|
||||||
|
|
||||||
|
func indentf(depth int, format string, args ...interface{}) {
|
||||||
|
fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth int) (res *termSet, err error) {
|
||||||
|
if t == nil {
|
||||||
|
panic("nil type")
|
||||||
|
}
|
||||||
|
|
||||||
|
if debug {
|
||||||
|
indentf(depth, "%s", t.String())
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
indentf(depth, "=> %s", err)
|
||||||
|
} else {
|
||||||
|
indentf(depth, "=> %s", res.terms.String())
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
const maxTermCount = 100
|
||||||
|
if tset, ok := seen[t]; ok {
|
||||||
|
if !tset.complete {
|
||||||
|
return nil, fmt.Errorf("cycle detected in the declaration of %s", t)
|
||||||
|
}
|
||||||
|
return tset, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark the current type as seen to avoid infinite recursion.
|
||||||
|
tset := new(termSet)
|
||||||
|
defer func() {
|
||||||
|
tset.complete = true
|
||||||
|
}()
|
||||||
|
seen[t] = tset
|
||||||
|
|
||||||
|
switch u := t.Underlying().(type) {
|
||||||
|
case *types.Interface:
|
||||||
|
// The term set of an interface is the intersection of the term sets of its
|
||||||
|
// embedded types.
|
||||||
|
tset.terms = allTermlist
|
||||||
|
for i := 0; i < u.NumEmbeddeds(); i++ {
|
||||||
|
embedded := u.EmbeddedType(i)
|
||||||
|
if _, ok := embedded.Underlying().(*types.TypeParam); ok {
|
||||||
|
return nil, fmt.Errorf("invalid embedded type %T", embedded)
|
||||||
|
}
|
||||||
|
tset2, err := computeTermSetInternal(embedded, seen, depth+1)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tset.terms = tset.terms.intersect(tset2.terms)
|
||||||
|
}
|
||||||
|
case *types.Union:
|
||||||
|
// The term set of a union is the union of term sets of its terms.
|
||||||
|
tset.terms = nil
|
||||||
|
for i := 0; i < u.Len(); i++ {
|
||||||
|
t := u.Term(i)
|
||||||
|
var terms termlist
|
||||||
|
switch t.Type().Underlying().(type) {
|
||||||
|
case *types.Interface:
|
||||||
|
tset2, err := computeTermSetInternal(t.Type(), seen, depth+1)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
terms = tset2.terms
|
||||||
|
case *types.TypeParam, *types.Union:
|
||||||
|
// A stand-alone type parameter or union is not permitted as union
|
||||||
|
// term.
|
||||||
|
return nil, fmt.Errorf("invalid union term %T", t)
|
||||||
|
default:
|
||||||
|
if t.Type() == types.Typ[types.Invalid] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
terms = termlist{{t.Tilde(), t.Type()}}
|
||||||
|
}
|
||||||
|
tset.terms = tset.terms.union(terms)
|
||||||
|
if len(tset.terms) > maxTermCount {
|
||||||
|
return nil, fmt.Errorf("exceeded max term count %d", maxTermCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case *types.TypeParam:
|
||||||
|
panic("unreachable")
|
||||||
|
default:
|
||||||
|
// For all other types, the term set is just a single non-tilde term
|
||||||
|
// holding the type itself.
|
||||||
|
if u != types.Typ[types.Invalid] {
|
||||||
|
tset.terms = termlist{{false, t}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tset, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// under is a facade for the go/types internal function of the same name. It is
|
||||||
|
// used by typeterm.go.
|
||||||
|
func under(t types.Type) types.Type {
|
||||||
|
return t.Underlying()
|
||||||
|
}
|
163
vendor/golang.org/x/tools/internal/typeparams/termlist.go
generated
vendored
Normal file
163
vendor/golang.org/x/tools/internal/typeparams/termlist.go
generated
vendored
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by copytermlist.go DO NOT EDIT.
|
||||||
|
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A termlist represents the type set represented by the union
|
||||||
|
// t1 ∪ y2 ∪ ... tn of the type sets of the terms t1 to tn.
|
||||||
|
// A termlist is in normal form if all terms are disjoint.
|
||||||
|
// termlist operations don't require the operands to be in
|
||||||
|
// normal form.
|
||||||
|
type termlist []*term
|
||||||
|
|
||||||
|
// allTermlist represents the set of all types.
|
||||||
|
// It is in normal form.
|
||||||
|
var allTermlist = termlist{new(term)}
|
||||||
|
|
||||||
|
// String prints the termlist exactly (without normalization).
|
||||||
|
func (xl termlist) String() string {
|
||||||
|
if len(xl) == 0 {
|
||||||
|
return "∅"
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
for i, x := range xl {
|
||||||
|
if i > 0 {
|
||||||
|
buf.WriteString(" | ")
|
||||||
|
}
|
||||||
|
buf.WriteString(x.String())
|
||||||
|
}
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// isEmpty reports whether the termlist xl represents the empty set of types.
|
||||||
|
func (xl termlist) isEmpty() bool {
|
||||||
|
// If there's a non-nil term, the entire list is not empty.
|
||||||
|
// If the termlist is in normal form, this requires at most
|
||||||
|
// one iteration.
|
||||||
|
for _, x := range xl {
|
||||||
|
if x != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// isAll reports whether the termlist xl represents the set of all types.
|
||||||
|
func (xl termlist) isAll() bool {
|
||||||
|
// If there's a 𝓤 term, the entire list is 𝓤.
|
||||||
|
// If the termlist is in normal form, this requires at most
|
||||||
|
// one iteration.
|
||||||
|
for _, x := range xl {
|
||||||
|
if x != nil && x.typ == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// norm returns the normal form of xl.
|
||||||
|
func (xl termlist) norm() termlist {
|
||||||
|
// Quadratic algorithm, but good enough for now.
|
||||||
|
// TODO(gri) fix asymptotic performance
|
||||||
|
used := make([]bool, len(xl))
|
||||||
|
var rl termlist
|
||||||
|
for i, xi := range xl {
|
||||||
|
if xi == nil || used[i] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for j := i + 1; j < len(xl); j++ {
|
||||||
|
xj := xl[j]
|
||||||
|
if xj == nil || used[j] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if u1, u2 := xi.union(xj); u2 == nil {
|
||||||
|
// If we encounter a 𝓤 term, the entire list is 𝓤.
|
||||||
|
// Exit early.
|
||||||
|
// (Note that this is not just an optimization;
|
||||||
|
// if we continue, we may end up with a 𝓤 term
|
||||||
|
// and other terms and the result would not be
|
||||||
|
// in normal form.)
|
||||||
|
if u1.typ == nil {
|
||||||
|
return allTermlist
|
||||||
|
}
|
||||||
|
xi = u1
|
||||||
|
used[j] = true // xj is now unioned into xi - ignore it in future iterations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rl = append(rl, xi)
|
||||||
|
}
|
||||||
|
return rl
|
||||||
|
}
|
||||||
|
|
||||||
|
// union returns the union xl ∪ yl.
|
||||||
|
func (xl termlist) union(yl termlist) termlist {
|
||||||
|
return append(xl, yl...).norm()
|
||||||
|
}
|
||||||
|
|
||||||
|
// intersect returns the intersection xl ∩ yl.
|
||||||
|
func (xl termlist) intersect(yl termlist) termlist {
|
||||||
|
if xl.isEmpty() || yl.isEmpty() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quadratic algorithm, but good enough for now.
|
||||||
|
// TODO(gri) fix asymptotic performance
|
||||||
|
var rl termlist
|
||||||
|
for _, x := range xl {
|
||||||
|
for _, y := range yl {
|
||||||
|
if r := x.intersect(y); r != nil {
|
||||||
|
rl = append(rl, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rl.norm()
|
||||||
|
}
|
||||||
|
|
||||||
|
// equal reports whether xl and yl represent the same type set.
|
||||||
|
func (xl termlist) equal(yl termlist) bool {
|
||||||
|
// TODO(gri) this should be more efficient
|
||||||
|
return xl.subsetOf(yl) && yl.subsetOf(xl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// includes reports whether t ∈ xl.
|
||||||
|
func (xl termlist) includes(t types.Type) bool {
|
||||||
|
for _, x := range xl {
|
||||||
|
if x.includes(t) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// supersetOf reports whether y ⊆ xl.
|
||||||
|
func (xl termlist) supersetOf(y *term) bool {
|
||||||
|
for _, x := range xl {
|
||||||
|
if y.subsetOf(x) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// subsetOf reports whether xl ⊆ yl.
|
||||||
|
func (xl termlist) subsetOf(yl termlist) bool {
|
||||||
|
if yl.isEmpty() {
|
||||||
|
return xl.isEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
// each term x of xl must be a subset of yl
|
||||||
|
for _, x := range xl {
|
||||||
|
if !yl.supersetOf(x) {
|
||||||
|
return false // x is not a subset yl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
169
vendor/golang.org/x/tools/internal/typeparams/typeterm.go
generated
vendored
Normal file
169
vendor/golang.org/x/tools/internal/typeparams/typeterm.go
generated
vendored
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by copytermlist.go DO NOT EDIT.
|
||||||
|
|
||||||
|
package typeparams
|
||||||
|
|
||||||
|
import "go/types"
|
||||||
|
|
||||||
|
// A term describes elementary type sets:
|
||||||
|
//
|
||||||
|
// ∅: (*term)(nil) == ∅ // set of no types (empty set)
|
||||||
|
// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
|
||||||
|
// T: &term{false, T} == {T} // set of type T
|
||||||
|
// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
|
||||||
|
type term struct {
|
||||||
|
tilde bool // valid if typ != nil
|
||||||
|
typ types.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *term) String() string {
|
||||||
|
switch {
|
||||||
|
case x == nil:
|
||||||
|
return "∅"
|
||||||
|
case x.typ == nil:
|
||||||
|
return "𝓤"
|
||||||
|
case x.tilde:
|
||||||
|
return "~" + x.typ.String()
|
||||||
|
default:
|
||||||
|
return x.typ.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// equal reports whether x and y represent the same type set.
|
||||||
|
func (x *term) equal(y *term) bool {
|
||||||
|
// easy cases
|
||||||
|
switch {
|
||||||
|
case x == nil || y == nil:
|
||||||
|
return x == y
|
||||||
|
case x.typ == nil || y.typ == nil:
|
||||||
|
return x.typ == y.typ
|
||||||
|
}
|
||||||
|
// ∅ ⊂ x, y ⊂ 𝓤
|
||||||
|
|
||||||
|
return x.tilde == y.tilde && types.Identical(x.typ, y.typ)
|
||||||
|
}
|
||||||
|
|
||||||
|
// union returns the union x ∪ y: zero, one, or two non-nil terms.
|
||||||
|
func (x *term) union(y *term) (_, _ *term) {
|
||||||
|
// easy cases
|
||||||
|
switch {
|
||||||
|
case x == nil && y == nil:
|
||||||
|
return nil, nil // ∅ ∪ ∅ == ∅
|
||||||
|
case x == nil:
|
||||||
|
return y, nil // ∅ ∪ y == y
|
||||||
|
case y == nil:
|
||||||
|
return x, nil // x ∪ ∅ == x
|
||||||
|
case x.typ == nil:
|
||||||
|
return x, nil // 𝓤 ∪ y == 𝓤
|
||||||
|
case y.typ == nil:
|
||||||
|
return y, nil // x ∪ 𝓤 == 𝓤
|
||||||
|
}
|
||||||
|
// ∅ ⊂ x, y ⊂ 𝓤
|
||||||
|
|
||||||
|
if x.disjoint(y) {
|
||||||
|
return x, y // x ∪ y == (x, y) if x ∩ y == ∅
|
||||||
|
}
|
||||||
|
// x.typ == y.typ
|
||||||
|
|
||||||
|
// ~t ∪ ~t == ~t
|
||||||
|
// ~t ∪ T == ~t
|
||||||
|
// T ∪ ~t == ~t
|
||||||
|
// T ∪ T == T
|
||||||
|
if x.tilde || !y.tilde {
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
return y, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// intersect returns the intersection x ∩ y.
|
||||||
|
func (x *term) intersect(y *term) *term {
|
||||||
|
// easy cases
|
||||||
|
switch {
|
||||||
|
case x == nil || y == nil:
|
||||||
|
return nil // ∅ ∩ y == ∅ and ∩ ∅ == ∅
|
||||||
|
case x.typ == nil:
|
||||||
|
return y // 𝓤 ∩ y == y
|
||||||
|
case y.typ == nil:
|
||||||
|
return x // x ∩ 𝓤 == x
|
||||||
|
}
|
||||||
|
// ∅ ⊂ x, y ⊂ 𝓤
|
||||||
|
|
||||||
|
if x.disjoint(y) {
|
||||||
|
return nil // x ∩ y == ∅ if x ∩ y == ∅
|
||||||
|
}
|
||||||
|
// x.typ == y.typ
|
||||||
|
|
||||||
|
// ~t ∩ ~t == ~t
|
||||||
|
// ~t ∩ T == T
|
||||||
|
// T ∩ ~t == T
|
||||||
|
// T ∩ T == T
|
||||||
|
if !x.tilde || y.tilde {
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
return y
|
||||||
|
}
|
||||||
|
|
||||||
|
// includes reports whether t ∈ x.
|
||||||
|
func (x *term) includes(t types.Type) bool {
|
||||||
|
// easy cases
|
||||||
|
switch {
|
||||||
|
case x == nil:
|
||||||
|
return false // t ∈ ∅ == false
|
||||||
|
case x.typ == nil:
|
||||||
|
return true // t ∈ 𝓤 == true
|
||||||
|
}
|
||||||
|
// ∅ ⊂ x ⊂ 𝓤
|
||||||
|
|
||||||
|
u := t
|
||||||
|
if x.tilde {
|
||||||
|
u = under(u)
|
||||||
|
}
|
||||||
|
return types.Identical(x.typ, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// subsetOf reports whether x ⊆ y.
|
||||||
|
func (x *term) subsetOf(y *term) bool {
|
||||||
|
// easy cases
|
||||||
|
switch {
|
||||||
|
case x == nil:
|
||||||
|
return true // ∅ ⊆ y == true
|
||||||
|
case y == nil:
|
||||||
|
return false // x ⊆ ∅ == false since x != ∅
|
||||||
|
case y.typ == nil:
|
||||||
|
return true // x ⊆ 𝓤 == true
|
||||||
|
case x.typ == nil:
|
||||||
|
return false // 𝓤 ⊆ y == false since y != 𝓤
|
||||||
|
}
|
||||||
|
// ∅ ⊂ x, y ⊂ 𝓤
|
||||||
|
|
||||||
|
if x.disjoint(y) {
|
||||||
|
return false // x ⊆ y == false if x ∩ y == ∅
|
||||||
|
}
|
||||||
|
// x.typ == y.typ
|
||||||
|
|
||||||
|
// ~t ⊆ ~t == true
|
||||||
|
// ~t ⊆ T == false
|
||||||
|
// T ⊆ ~t == true
|
||||||
|
// T ⊆ T == true
|
||||||
|
return !x.tilde || y.tilde
|
||||||
|
}
|
||||||
|
|
||||||
|
// disjoint reports whether x ∩ y == ∅.
|
||||||
|
// x.typ and y.typ must not be nil.
|
||||||
|
func (x *term) disjoint(y *term) bool {
|
||||||
|
if debug && (x.typ == nil || y.typ == nil) {
|
||||||
|
panic("invalid argument(s)")
|
||||||
|
}
|
||||||
|
ux := x.typ
|
||||||
|
if y.tilde {
|
||||||
|
ux = under(ux)
|
||||||
|
}
|
||||||
|
uy := y.typ
|
||||||
|
if x.tilde {
|
||||||
|
uy = under(uy)
|
||||||
|
}
|
||||||
|
return !types.Identical(ux, uy)
|
||||||
|
}
|
133
vendor/golang.org/x/tools/internal/typesinternal/element.go
generated
vendored
Normal file
133
vendor/golang.org/x/tools/internal/typesinternal/element.go
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typesinternal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
|
||||||
|
"golang.org/x/tools/go/types/typeutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ForEachElement calls f for type T and each type reachable from its
|
||||||
|
// type through reflection. It does this by recursively stripping off
|
||||||
|
// type constructors; in addition, for each named type N, the type *N
|
||||||
|
// is added to the result as it may have additional methods.
|
||||||
|
//
|
||||||
|
// The caller must provide an initially empty set used to de-duplicate
|
||||||
|
// identical types, potentially across multiple calls to ForEachElement.
|
||||||
|
// (Its final value holds all the elements seen, matching the arguments
|
||||||
|
// passed to f.)
|
||||||
|
//
|
||||||
|
// TODO(adonovan): share/harmonize with go/callgraph/rta.
|
||||||
|
func ForEachElement(rtypes *typeutil.Map, msets *typeutil.MethodSetCache, T types.Type, f func(types.Type)) {
|
||||||
|
var visit func(T types.Type, skip bool)
|
||||||
|
visit = func(T types.Type, skip bool) {
|
||||||
|
if !skip {
|
||||||
|
if seen, _ := rtypes.Set(T, true).(bool); seen {
|
||||||
|
return // de-dup
|
||||||
|
}
|
||||||
|
|
||||||
|
f(T) // notify caller of new element type
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursion over signatures of each method.
|
||||||
|
tmset := msets.MethodSet(T)
|
||||||
|
for i := 0; i < tmset.Len(); i++ {
|
||||||
|
sig := tmset.At(i).Type().(*types.Signature)
|
||||||
|
// It is tempting to call visit(sig, false)
|
||||||
|
// but, as noted in golang.org/cl/65450043,
|
||||||
|
// the Signature.Recv field is ignored by
|
||||||
|
// types.Identical and typeutil.Map, which
|
||||||
|
// is confusing at best.
|
||||||
|
//
|
||||||
|
// More importantly, the true signature rtype
|
||||||
|
// reachable from a method using reflection
|
||||||
|
// has no receiver but an extra ordinary parameter.
|
||||||
|
// For the Read method of io.Reader we want:
|
||||||
|
// func(Reader, []byte) (int, error)
|
||||||
|
// but here sig is:
|
||||||
|
// func([]byte) (int, error)
|
||||||
|
// with .Recv = Reader (though it is hard to
|
||||||
|
// notice because it doesn't affect Signature.String
|
||||||
|
// or types.Identical).
|
||||||
|
//
|
||||||
|
// TODO(adonovan): construct and visit the correct
|
||||||
|
// non-method signature with an extra parameter
|
||||||
|
// (though since unnamed func types have no methods
|
||||||
|
// there is essentially no actual demand for this).
|
||||||
|
//
|
||||||
|
// TODO(adonovan): document whether or not it is
|
||||||
|
// safe to skip non-exported methods (as RTA does).
|
||||||
|
visit(sig.Params(), true) // skip the Tuple
|
||||||
|
visit(sig.Results(), true) // skip the Tuple
|
||||||
|
}
|
||||||
|
|
||||||
|
switch T := T.(type) {
|
||||||
|
case *types.Alias:
|
||||||
|
visit(types.Unalias(T), skip) // emulates the pre-Alias behavior
|
||||||
|
|
||||||
|
case *types.Basic:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
// nop---handled by recursion over method set.
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
visit(T.Elem(), false)
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
visit(T.Elem(), false)
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
visit(T.Elem(), false)
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
visit(T.Key(), false)
|
||||||
|
visit(T.Elem(), false)
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
if T.Recv() != nil {
|
||||||
|
panic(fmt.Sprintf("Signature %s has Recv %s", T, T.Recv()))
|
||||||
|
}
|
||||||
|
visit(T.Params(), true) // skip the Tuple
|
||||||
|
visit(T.Results(), true) // skip the Tuple
|
||||||
|
|
||||||
|
case *types.Named:
|
||||||
|
// A pointer-to-named type can be derived from a named
|
||||||
|
// type via reflection. It may have methods too.
|
||||||
|
visit(types.NewPointer(T), false)
|
||||||
|
|
||||||
|
// Consider 'type T struct{S}' where S has methods.
|
||||||
|
// Reflection provides no way to get from T to struct{S},
|
||||||
|
// only to S, so the method set of struct{S} is unwanted,
|
||||||
|
// so set 'skip' flag during recursion.
|
||||||
|
visit(T.Underlying(), true) // skip the unnamed type
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
visit(T.Elem(), false)
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
for i, n := 0, T.NumFields(); i < n; i++ {
|
||||||
|
// TODO(adonovan): document whether or not
|
||||||
|
// it is safe to skip non-exported fields.
|
||||||
|
visit(T.Field(i).Type(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
for i, n := 0, T.Len(); i < n; i++ {
|
||||||
|
visit(T.At(i).Type(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.TypeParam, *types.Union:
|
||||||
|
// forEachReachable must not be called on parameterized types.
|
||||||
|
panic(T)
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(T)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visit(T, false)
|
||||||
|
}
|
8
vendor/golang.org/x/tools/internal/typesinternal/recv.go
generated
vendored
8
vendor/golang.org/x/tools/internal/typesinternal/recv.go
generated
vendored
|
@ -6,8 +6,6 @@ package typesinternal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go/types"
|
"go/types"
|
||||||
|
|
||||||
"golang.org/x/tools/internal/aliases"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReceiverNamed returns the named type (if any) associated with the
|
// ReceiverNamed returns the named type (if any) associated with the
|
||||||
|
@ -15,11 +13,11 @@ import (
|
||||||
// It also reports whether a Pointer was present.
|
// It also reports whether a Pointer was present.
|
||||||
func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) {
|
func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) {
|
||||||
t := recv.Type()
|
t := recv.Type()
|
||||||
if ptr, ok := aliases.Unalias(t).(*types.Pointer); ok {
|
if ptr, ok := types.Unalias(t).(*types.Pointer); ok {
|
||||||
isPtr = true
|
isPtr = true
|
||||||
t = ptr.Elem()
|
t = ptr.Elem()
|
||||||
}
|
}
|
||||||
named, _ = aliases.Unalias(t).(*types.Named)
|
named, _ = types.Unalias(t).(*types.Named)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +34,7 @@ func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) {
|
||||||
// indirection from the type, regardless of named types (analogous to
|
// indirection from the type, regardless of named types (analogous to
|
||||||
// a LOAD instruction).
|
// a LOAD instruction).
|
||||||
func Unpointer(t types.Type) types.Type {
|
func Unpointer(t types.Type) types.Type {
|
||||||
if ptr, ok := aliases.Unalias(t).(*types.Pointer); ok {
|
if ptr, ok := types.Unalias(t).(*types.Pointer); ok {
|
||||||
return ptr.Elem()
|
return ptr.Elem()
|
||||||
}
|
}
|
||||||
return t
|
return t
|
||||||
|
|
56
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
56
vendor/golang.org/x/tools/internal/typesinternal/types.go
generated
vendored
|
@ -11,6 +11,8 @@ import (
|
||||||
"go/types"
|
"go/types"
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/aliases"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetUsesCgo(conf *types.Config) bool {
|
func SetUsesCgo(conf *types.Config) bool {
|
||||||
|
@ -63,3 +65,57 @@ func NameRelativeTo(pkg *types.Package) types.Qualifier {
|
||||||
return other.Name()
|
return other.Name()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A NamedOrAlias is a [types.Type] that is named (as
|
||||||
|
// defined by the spec) and capable of bearing type parameters: it
|
||||||
|
// abstracts aliases ([types.Alias]) and defined types
|
||||||
|
// ([types.Named]).
|
||||||
|
//
|
||||||
|
// Every type declared by an explicit "type" declaration is a
|
||||||
|
// NamedOrAlias. (Built-in type symbols may additionally
|
||||||
|
// have type [types.Basic], which is not a NamedOrAlias,
|
||||||
|
// though the spec regards them as "named".)
|
||||||
|
//
|
||||||
|
// NamedOrAlias cannot expose the Origin method, because
|
||||||
|
// [types.Alias.Origin] and [types.Named.Origin] have different
|
||||||
|
// (covariant) result types; use [Origin] instead.
|
||||||
|
type NamedOrAlias interface {
|
||||||
|
types.Type
|
||||||
|
Obj() *types.TypeName
|
||||||
|
}
|
||||||
|
|
||||||
|
// TypeParams is a light shim around t.TypeParams().
|
||||||
|
// (go/types.Alias).TypeParams requires >= 1.23.
|
||||||
|
func TypeParams(t NamedOrAlias) *types.TypeParamList {
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Alias:
|
||||||
|
return aliases.TypeParams(t)
|
||||||
|
case *types.Named:
|
||||||
|
return t.TypeParams()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TypeArgs is a light shim around t.TypeArgs().
|
||||||
|
// (go/types.Alias).TypeArgs requires >= 1.23.
|
||||||
|
func TypeArgs(t NamedOrAlias) *types.TypeList {
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Alias:
|
||||||
|
return aliases.TypeArgs(t)
|
||||||
|
case *types.Named:
|
||||||
|
return t.TypeArgs()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Origin returns the generic type of the Named or Alias type t if it
|
||||||
|
// is instantiated, otherwise it returns t.
|
||||||
|
func Origin(t NamedOrAlias) NamedOrAlias {
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Alias:
|
||||||
|
return aliases.Origin(t)
|
||||||
|
case *types.Named:
|
||||||
|
return t.Origin()
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
282
vendor/golang.org/x/tools/internal/typesinternal/zerovalue.go
generated
vendored
Normal file
282
vendor/golang.org/x/tools/internal/typesinternal/zerovalue.go
generated
vendored
Normal file
|
@ -0,0 +1,282 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package typesinternal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ZeroString returns the string representation of the "zero" value of the type t.
|
||||||
|
// This string can be used on the right-hand side of an assignment where the
|
||||||
|
// left-hand side has that explicit type.
|
||||||
|
// Exception: This does not apply to tuples. Their string representation is
|
||||||
|
// informational only and cannot be used in an assignment.
|
||||||
|
// When assigning to a wider type (such as 'any'), it's the caller's
|
||||||
|
// responsibility to handle any necessary type conversions.
|
||||||
|
// See [ZeroExpr] for a variant that returns an [ast.Expr].
|
||||||
|
func ZeroString(t types.Type, qf types.Qualifier) string {
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
switch {
|
||||||
|
case t.Info()&types.IsBoolean != 0:
|
||||||
|
return "false"
|
||||||
|
case t.Info()&types.IsNumeric != 0:
|
||||||
|
return "0"
|
||||||
|
case t.Info()&types.IsString != 0:
|
||||||
|
return `""`
|
||||||
|
case t.Kind() == types.UnsafePointer:
|
||||||
|
fallthrough
|
||||||
|
case t.Kind() == types.UntypedNil:
|
||||||
|
return "nil"
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprint("ZeroString for unexpected type:", t))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Pointer, *types.Slice, *types.Interface, *types.Chan, *types.Map, *types.Signature:
|
||||||
|
return "nil"
|
||||||
|
|
||||||
|
case *types.Named, *types.Alias:
|
||||||
|
switch under := t.Underlying().(type) {
|
||||||
|
case *types.Struct, *types.Array:
|
||||||
|
return types.TypeString(t, qf) + "{}"
|
||||||
|
default:
|
||||||
|
return ZeroString(under, qf)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Array, *types.Struct:
|
||||||
|
return types.TypeString(t, qf) + "{}"
|
||||||
|
|
||||||
|
case *types.TypeParam:
|
||||||
|
// Assumes func new is not shadowed.
|
||||||
|
return "*new(" + types.TypeString(t, qf) + ")"
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
// Tuples are not normal values.
|
||||||
|
// We are currently format as "(t[0], ..., t[n])". Could be something else.
|
||||||
|
components := make([]string, t.Len())
|
||||||
|
for i := 0; i < t.Len(); i++ {
|
||||||
|
components[i] = ZeroString(t.At(i).Type(), qf)
|
||||||
|
}
|
||||||
|
return "(" + strings.Join(components, ", ") + ")"
|
||||||
|
|
||||||
|
case *types.Union:
|
||||||
|
// Variables of these types cannot be created, so it makes
|
||||||
|
// no sense to ask for their zero value.
|
||||||
|
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(t) // unreachable.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ZeroExpr returns the ast.Expr representation of the "zero" value of the type t.
|
||||||
|
// ZeroExpr is defined for types that are suitable for variables.
|
||||||
|
// It may panic for other types such as Tuple or Union.
|
||||||
|
// See [ZeroString] for a variant that returns a string.
|
||||||
|
func ZeroExpr(f *ast.File, pkg *types.Package, typ types.Type) ast.Expr {
|
||||||
|
switch t := typ.(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
switch {
|
||||||
|
case t.Info()&types.IsBoolean != 0:
|
||||||
|
return &ast.Ident{Name: "false"}
|
||||||
|
case t.Info()&types.IsNumeric != 0:
|
||||||
|
return &ast.BasicLit{Kind: token.INT, Value: "0"}
|
||||||
|
case t.Info()&types.IsString != 0:
|
||||||
|
return &ast.BasicLit{Kind: token.STRING, Value: `""`}
|
||||||
|
case t.Kind() == types.UnsafePointer:
|
||||||
|
fallthrough
|
||||||
|
case t.Kind() == types.UntypedNil:
|
||||||
|
return ast.NewIdent("nil")
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprint("ZeroExpr for unexpected type:", t))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Pointer, *types.Slice, *types.Interface, *types.Chan, *types.Map, *types.Signature:
|
||||||
|
return ast.NewIdent("nil")
|
||||||
|
|
||||||
|
case *types.Named, *types.Alias:
|
||||||
|
switch under := t.Underlying().(type) {
|
||||||
|
case *types.Struct, *types.Array:
|
||||||
|
return &ast.CompositeLit{
|
||||||
|
Type: TypeExpr(f, pkg, typ),
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return ZeroExpr(f, pkg, under)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Array, *types.Struct:
|
||||||
|
return &ast.CompositeLit{
|
||||||
|
Type: TypeExpr(f, pkg, typ),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.TypeParam:
|
||||||
|
return &ast.StarExpr{ // *new(T)
|
||||||
|
X: &ast.CallExpr{
|
||||||
|
// Assumes func new is not shadowed.
|
||||||
|
Fun: ast.NewIdent("new"),
|
||||||
|
Args: []ast.Expr{
|
||||||
|
ast.NewIdent(t.Obj().Name()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
// Unlike ZeroString, there is no ast.Expr can express tuple by
|
||||||
|
// "(t[0], ..., t[n])".
|
||||||
|
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||||
|
|
||||||
|
case *types.Union:
|
||||||
|
// Variables of these types cannot be created, so it makes
|
||||||
|
// no sense to ask for their zero value.
|
||||||
|
panic(fmt.Sprintf("invalid type for a variable: %v", t))
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(t) // unreachable.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsZeroExpr uses simple syntactic heuristics to report whether expr
|
||||||
|
// is a obvious zero value, such as 0, "", nil, or false.
|
||||||
|
// It cannot do better without type information.
|
||||||
|
func IsZeroExpr(expr ast.Expr) bool {
|
||||||
|
switch e := expr.(type) {
|
||||||
|
case *ast.BasicLit:
|
||||||
|
return e.Value == "0" || e.Value == `""`
|
||||||
|
case *ast.Ident:
|
||||||
|
return e.Name == "nil" || e.Name == "false"
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TypeExpr returns syntax for the specified type. References to named types
|
||||||
|
// from packages other than pkg are qualified by an appropriate package name, as
|
||||||
|
// defined by the import environment of file.
|
||||||
|
// It may panic for types such as Tuple or Union.
|
||||||
|
func TypeExpr(f *ast.File, pkg *types.Package, typ types.Type) ast.Expr {
|
||||||
|
switch t := typ.(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
switch t.Kind() {
|
||||||
|
case types.UnsafePointer:
|
||||||
|
// TODO(hxjiang): replace the implementation with types.Qualifier.
|
||||||
|
return &ast.SelectorExpr{X: ast.NewIdent("unsafe"), Sel: ast.NewIdent("Pointer")}
|
||||||
|
default:
|
||||||
|
return ast.NewIdent(t.Name())
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
return &ast.UnaryExpr{
|
||||||
|
Op: token.MUL,
|
||||||
|
X: TypeExpr(f, pkg, t.Elem()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
return &ast.ArrayType{
|
||||||
|
Len: &ast.BasicLit{
|
||||||
|
Kind: token.INT,
|
||||||
|
Value: fmt.Sprintf("%d", t.Len()),
|
||||||
|
},
|
||||||
|
Elt: TypeExpr(f, pkg, t.Elem()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
return &ast.ArrayType{
|
||||||
|
Elt: TypeExpr(f, pkg, t.Elem()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
return &ast.MapType{
|
||||||
|
Key: TypeExpr(f, pkg, t.Key()),
|
||||||
|
Value: TypeExpr(f, pkg, t.Elem()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
dir := ast.ChanDir(t.Dir())
|
||||||
|
if t.Dir() == types.SendRecv {
|
||||||
|
dir = ast.SEND | ast.RECV
|
||||||
|
}
|
||||||
|
return &ast.ChanType{
|
||||||
|
Dir: dir,
|
||||||
|
Value: TypeExpr(f, pkg, t.Elem()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
var params []*ast.Field
|
||||||
|
for i := 0; i < t.Params().Len(); i++ {
|
||||||
|
params = append(params, &ast.Field{
|
||||||
|
Type: TypeExpr(f, pkg, t.Params().At(i).Type()),
|
||||||
|
Names: []*ast.Ident{
|
||||||
|
{
|
||||||
|
Name: t.Params().At(i).Name(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if t.Variadic() {
|
||||||
|
last := params[len(params)-1]
|
||||||
|
last.Type = &ast.Ellipsis{Elt: last.Type.(*ast.ArrayType).Elt}
|
||||||
|
}
|
||||||
|
var returns []*ast.Field
|
||||||
|
for i := 0; i < t.Results().Len(); i++ {
|
||||||
|
returns = append(returns, &ast.Field{
|
||||||
|
Type: TypeExpr(f, pkg, t.Results().At(i).Type()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &ast.FuncType{
|
||||||
|
Params: &ast.FieldList{
|
||||||
|
List: params,
|
||||||
|
},
|
||||||
|
Results: &ast.FieldList{
|
||||||
|
List: returns,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
case interface{ Obj() *types.TypeName }: // *types.{Alias,Named,TypeParam}
|
||||||
|
switch t.Obj().Pkg() {
|
||||||
|
case pkg, nil:
|
||||||
|
return ast.NewIdent(t.Obj().Name())
|
||||||
|
}
|
||||||
|
pkgName := t.Obj().Pkg().Name()
|
||||||
|
|
||||||
|
// TODO(hxjiang): replace the implementation with types.Qualifier.
|
||||||
|
// If the file already imports the package under another name, use that.
|
||||||
|
for _, cand := range f.Imports {
|
||||||
|
if path, _ := strconv.Unquote(cand.Path.Value); path == t.Obj().Pkg().Path() {
|
||||||
|
if cand.Name != nil && cand.Name.Name != "" {
|
||||||
|
pkgName = cand.Name.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if pkgName == "." {
|
||||||
|
return ast.NewIdent(t.Obj().Name())
|
||||||
|
}
|
||||||
|
return &ast.SelectorExpr{
|
||||||
|
X: ast.NewIdent(pkgName),
|
||||||
|
Sel: ast.NewIdent(t.Obj().Name()),
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
return ast.NewIdent(t.String())
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
return ast.NewIdent(t.String())
|
||||||
|
|
||||||
|
case *types.Union:
|
||||||
|
// TODO(hxjiang): handle the union through syntax (~A | ... | ~Z).
|
||||||
|
// Remove nil check when calling typesinternal.TypeExpr.
|
||||||
|
return nil
|
||||||
|
|
||||||
|
case *types.Tuple:
|
||||||
|
panic("invalid input type types.Tuple")
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
}
|
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
13
vendor/golang.org/x/tools/internal/versions/constraint.go
generated
vendored
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2024 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package versions
|
|
||||||
|
|
||||||
import "go/build/constraint"
|
|
||||||
|
|
||||||
// ConstraintGoVersion is constraint.GoVersion (if built with go1.21+).
|
|
||||||
// Otherwise nil.
|
|
||||||
//
|
|
||||||
// Deprecate once x/tools is after go1.21.
|
|
||||||
var ConstraintGoVersion func(x constraint.Expr) string
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue