Updated and re-enabled statickcheck

This commit is contained in:
kolaente 2019-04-23 10:34:06 +02:00
parent 07bdb08f9c
commit 6bab8fb769
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
72 changed files with 3698 additions and 2843 deletions

View file

@ -34,8 +34,7 @@ steps:
- make misspell-check - make misspell-check
- make goconst-check - make goconst-check
- make gocyclo-check - make gocyclo-check
# Disabled until the memory leak on their side is resolved. See https://github.com/dominikh/go-tools/issues/419. - make static-check
# - make static-check
- make build - make build
when: when:
event: [ push, tag, pull_request ] event: [ push, tag, pull_request ]

8
go.mod
View file

@ -64,11 +64,11 @@ require (
github.com/swaggo/swag v1.4.1-0.20181210033626-0e12fd5eb026 github.com/swaggo/swag v1.4.1-0.20181210033626-0e12fd5eb026
github.com/urfave/cli v1.20.0 // indirect github.com/urfave/cli v1.20.0 // indirect
github.com/valyala/fasttemplate v1.0.1 // indirect github.com/valyala/fasttemplate v1.0.1 // indirect
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
golang.org/x/net v0.0.0-20181217023233-e147a9138326 // indirect golang.org/x/net v0.0.0-20190420063019-afa5a82059c6 // indirect
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 // indirect golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect
golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081 // indirect golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/d4l3k/messagediff.v1 v1.2.1 gopkg.in/d4l3k/messagediff.v1 v1.2.1
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df

12
go.sum
View file

@ -212,10 +212,13 @@ golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85 h1:et7+NAX3lLIk5qUCTA9Qel
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ56NFcDtcBNkYP7yv8YbUE= golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ56NFcDtcBNkYP7yv8YbUE=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/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-20190320223903-b7391e95e576 h1:aUX/1G2gFSs4AsJJg2cL3HuoRhCSCz733FE5GUSuaT4= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576 h1:aUX/1G2gFSs4AsJJg2cL3HuoRhCSCz733FE5GUSuaT4=
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd h1:sMHc2rZHuzQmrbVoSpt9HgerkXPyIeCSO6k0zUMGfFk=
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -226,6 +229,10 @@ golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsq
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181217023233-e147a9138326 h1:iCzOf0xz39Tstp+Tu/WwyGjUXCk34QhQORRxBeXXTA4= golang.org/x/net v0.0.0-20181217023233-e147a9138326 h1:iCzOf0xz39Tstp+Tu/WwyGjUXCk34QhQORRxBeXXTA4=
golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6 h1:HdqqaWmYAUI7/dmByKKEw+yxDksGSo+9GjkUc9Zp34E=
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
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=
@ -242,10 +249,15 @@ golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc h1:4gbWbmmPFp4ySWICouJl6emP0
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 h1:hOY+O8MxdkPV10pNf7/XEHaySCiPKxixMKUshfHsGn0= golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 h1:hOY+O8MxdkPV10pNf7/XEHaySCiPKxixMKUshfHsGn0=
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
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/tools v0.0.0-20181026183834-f60e5f99f081 h1:QJP9sxq2/KbTxFnGduVryxJOt6r/UVGyom3tLaqu7tc= golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081 h1:QJP9sxq2/KbTxFnGduVryxJOt6r/UVGyom3tLaqu7tc=
golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b h1:NVD8gBK33xpdqCaZVVtd6OFJp+3dxkXuz7+U7KaVN6s=
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk= google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=

View file

@ -44,7 +44,7 @@ type User struct {
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"` Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"`
Password string `xorm:"varchar(250) not null" json:"-"` Password string `xorm:"varchar(250) not null" json:"-"`
// The user's email address. // The user's email address.
Email string `xorm:"varchar(250) null" json:"email,omitonempty" valid:"email,length(0|250)" maxLength:"250"` Email string `xorm:"varchar(250) null" json:"email,omitempty" valid:"email,length(0|250)" maxLength:"250"`
IsActive bool `xorm:"null" json:"-"` IsActive bool `xorm:"null" json:"-"`
PasswordResetToken string `xorm:"varchar(450) null" json:"-"` PasswordResetToken string `xorm:"varchar(450) null" json:"-"`

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
//lint:file-ignore ST1018 The const below is not ours
package v1 package v1
import ( import (

View file

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2019-04-01 20:03:30.060598671 +0200 CEST m=+0.311389858 // 2019-04-23 10:33:26.759897853 +0200 CEST m=+0.130092850
package swagger package swagger
@ -14,7 +14,7 @@ import (
var doc = `{ var doc = `{
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer \u003cjwt-token\u003e` + "`" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API", "title": "Vikunja API",
"contact": { "contact": {
"name": "General Vikunja contact", "name": "General Vikunja contact",
@ -391,7 +391,7 @@ var doc = `{
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -399,13 +399,13 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -413,14 +413,14 @@ var doc = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError" "$ref": "#/definitions/code.vikunja.io.web.HTTPError"
@ -2288,13 +2288,13 @@ var doc = `{
}, },
{ {
"type": "integer", "type": "integer",
"description": "The start date parameter to filter by. Expects a unix timestamp.", "description": "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time.",
"name": "startdate", "name": "startdate",
"in": "query" "in": "query"
}, },
{ {
"type": "integer", "type": "integer",
"description": "The end date parameter to filter by. Expects a unix timestamp.", "description": "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time.",
"name": "enddate", "name": "enddate",
"in": "query" "in": "query"
} }

View file

@ -1,7 +1,7 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + \"`\" + `Authorization: Bearer \u003cjwt-token\u003e` + \"`\" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API", "title": "Vikunja API",
"contact": { "contact": {
"name": "General Vikunja contact", "name": "General Vikunja contact",
@ -378,7 +378,7 @@
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -386,13 +386,13 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -400,14 +400,14 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError" "$ref": "#/definitions/code.vikunja.io/web.HTTPError"
@ -2275,13 +2275,13 @@
}, },
{ {
"type": "integer", "type": "integer",
"description": "The start date parameter to filter by. Expects a unix timestamp.", "description": "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time.",
"name": "startdate", "name": "startdate",
"in": "query" "in": "query"
}, },
{ {
"type": "integer", "type": "integer",
"description": "The end date parameter to filter by. Expects a unix timestamp.", "description": "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time.",
"name": "enddate", "name": "enddate",
"in": "query" "in": "query"
} }

View file

@ -631,7 +631,13 @@ info:
email: hello@vikunja.io email: hello@vikunja.io
name: General Vikunja contact name: General Vikunja contact
url: http://vikunja.io/en/contact/ url: http://vikunja.io/en/contact/
description: '<!-- ReDoc-Inject: <security-definitions> -->' description: |-
This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> -->
# Authorization
**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer <jwt-token>` + "`" + `-header to authenticate successfully.
**BasicAuth:** Only used when requesting tasks via caldav.
<!-- ReDoc-Inject: <security-definitions> -->
license: license:
name: GPLv3 name: GPLv3
url: http://code.vikunja.io/api/src/branch/master/LICENSE url: http://code.vikunja.io/api/src/branch/master/LICENSE
@ -916,9 +922,9 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns a team by its ID. description: Returns a list by its ID.
parameters: parameters:
- description: Team ID - description: List ID
in: path in: path
name: id name: id
required: true required: true
@ -927,12 +933,12 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The team description: The list
schema: schema:
$ref: '#/definitions/models.Team' $ref: '#/definitions/models.List'
type: object type: object
"403": "403":
description: The user does not have access to the team description: The user does not have access to the list
schema: schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError' $ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object type: object
@ -943,9 +949,9 @@ paths:
type: object type: object
security: security:
- JWTKeyAuth: [] - JWTKeyAuth: []
summary: Gets one team summary: Gets one list
tags: tags:
- team - list
post: post:
consumes: consumes:
- application/json - application/json
@ -2545,10 +2551,14 @@ paths:
name: sort name: sort
type: string type: string
- description: The start date parameter to filter by. Expects a unix timestamp. - description: The start date parameter to filter by. Expects a unix timestamp.
If no end date, but a start date is specified, the end date is set to the
current time.
in: query in: query
name: startdate name: startdate
type: integer type: integer
- description: The end date parameter to filter by. Expects a unix timestamp. - description: The end date parameter to filter by. Expects a unix timestamp.
If no start date, but an end date is specified, the start date is set to
the current time.
in: query in: query
name: enddate name: enddate
type: integer type: integer

View file

@ -32,6 +32,7 @@ import (
"time" "time"
"golang.org/x/crypto/acme" "golang.org/x/crypto/acme"
"golang.org/x/net/idna"
) )
// createCertRetryAfter is how much time to wait before removing a failed state // createCertRetryAfter is how much time to wait before removing a failed state
@ -62,11 +63,17 @@ type HostPolicy func(ctx context.Context, host string) error
// HostWhitelist returns a policy where only the specified host names are allowed. // HostWhitelist returns a policy where only the specified host names are allowed.
// Only exact matches are currently supported. Subdomains, regexp or wildcard // Only exact matches are currently supported. Subdomains, regexp or wildcard
// will not match. // will not match.
//
// Note that all hosts will be converted to Punycode via idna.Lookup.ToASCII so that
// Manager.GetCertificate can handle the Unicode IDN and mixedcase hosts correctly.
// Invalid hosts will be silently ignored.
func HostWhitelist(hosts ...string) HostPolicy { func HostWhitelist(hosts ...string) HostPolicy {
whitelist := make(map[string]bool, len(hosts)) whitelist := make(map[string]bool, len(hosts))
for _, h := range hosts { for _, h := range hosts {
if h, err := idna.Lookup.ToASCII(h); err == nil {
whitelist[h] = true whitelist[h] = true
} }
}
return func(_ context.Context, host string) error { return func(_ context.Context, host string) error {
if !whitelist[host] { if !whitelist[host] {
return fmt.Errorf("acme/autocert: host %q not configured in HostWhitelist", host) return fmt.Errorf("acme/autocert: host %q not configured in HostWhitelist", host)
@ -243,7 +250,17 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate,
if !strings.Contains(strings.Trim(name, "."), ".") { if !strings.Contains(strings.Trim(name, "."), ".") {
return nil, errors.New("acme/autocert: server name component count invalid") return nil, errors.New("acme/autocert: server name component count invalid")
} }
if strings.ContainsAny(name, `+/\`) {
// Note that this conversion is necessary because some server names in the handshakes
// started by some clients (such as cURL) are not converted to Punycode, which will
// prevent us from obtaining certificates for them. In addition, we should also treat
// example.com and EXAMPLE.COM as equivalent and return the same certificate for them.
// Fortunately, this conversion also helped us deal with this kind of mixedcase problems.
//
// Due to the "σςΣ" problem (see https://unicode.org/faq/idn.html#22), we can't use
// idna.Punycode.ToASCII (or just idna.ToASCII) here.
name, err := idna.Lookup.ToASCII(name)
if err != nil {
return nil, errors.New("acme/autocert: server name contains invalid character") return nil, errors.New("acme/autocert: server name contains invalid character")
} }

View file

@ -153,6 +153,11 @@ func main() {
} }
funct, inps, outps, sysname := f[2], f[3], f[4], f[5] funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
if goos == "darwin" && !libc && funct == "ClockGettime" {
continue
}
// Split argument lists on comma. // Split argument lists on comma.
in := parseParamList(inps) in := parseParamList(inps)
out := parseParamList(outps) out := parseParamList(outps)

View file

@ -214,6 +214,11 @@ func main() {
} }
if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" { if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
cExtern += "#define c_select select\n"
}
// Imports of system calls from libc // Imports of system calls from libc
cExtern += fmt.Sprintf("%s %s", cRettype, sysname) cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
cIn := strings.Join(cIn, ", ") cIn := strings.Join(cIn, ", ")
@ -328,7 +333,13 @@ func main() {
} else { } else {
call += "" call += ""
} }
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist)
} else {
call += fmt.Sprintf("C.%s(%s)", sysname, arglist) call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
}
// Assign return values. // Assign return values.
body := "" body := ""

View file

@ -282,6 +282,11 @@ func main() {
if !onlyCommon { if !onlyCommon {
// GCCGO Prototype Generation // GCCGO Prototype Generation
// Imports of system calls from libc // Imports of system calls from libc
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
cExtern += "#define c_select select\n"
}
cExtern += fmt.Sprintf("%s %s", cRettype, sysname) cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
cIn := strings.Join(cIn, ", ") cIn := strings.Join(cIn, ", ")
cExtern += fmt.Sprintf("(%s);\n", cIn) cExtern += fmt.Sprintf("(%s);\n", cIn)
@ -490,7 +495,14 @@ func main() {
// GCCGO function generation // GCCGO function generation
argsgccgolist := strings.Join(argsgccgo, ", ") argsgccgolist := strings.Join(argsgccgo, ", ")
callgccgo := fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) var callgccgo string
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist)
} else {
callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
}
textgccgo += callProto textgccgo += callProto
textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo) textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
textgccgo += "\te1 = syscall.GetErrno()\n" textgccgo += "\te1 = syscall.GetErrno()\n"

View file

@ -18,6 +18,9 @@ func cmsgAlignOf(salen int) int {
salign := SizeofPtr salign := SizeofPtr
switch runtime.GOOS { switch runtime.GOOS {
case "aix":
// There is no alignment on AIX.
salign = 1
case "darwin", "dragonfly", "solaris": case "darwin", "dragonfly", "solaris":
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and // NOTE: It seems like 64-bit Darwin, DragonFly BSD and
// Solaris kernels still require 32-bit aligned access to // Solaris kernels still require 32-bit aligned access to

View file

@ -444,8 +444,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
//sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Times(tms *Tms) (ticks uintptr, err error)
//sysnb Umask(mask int) (oldmask int) //sysnb Umask(mask int) (oldmask int)
//sysnb Uname(buf *Utsname) (err error) //sysnb Uname(buf *Utsname) (err error)
//TODO umount
// //sys Unmount(target string, flags int) (err error) = umount
//sys Unlink(path string) (err error) //sys Unlink(path string) (err error)
//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error)
@ -470,8 +468,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
//sys Pause() (err error) //sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64 //sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
//TODO Select //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
// //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
//sysnb Setregid(rgid int, egid int) (err error) //sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setreuid(ruid int, euid int) (err error)
@ -493,8 +490,10 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) // In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used.
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
//sys munmap(addr uintptr, length uintptr) (err error) //sys munmap(addr uintptr, length uintptr) (err error)
@ -547,3 +546,12 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
//sys Utime(path string, buf *Utimbuf) (err error) //sys Utime(path string, buf *Utimbuf) (err error)
//sys Getsystemcfg(label int) (n uint64) //sys Getsystemcfg(label int) (n uint64)
//sys umount(target string) (err error)
func Unmount(target string, flags int) (err error) {
if flags != 0 {
// AIX doesn't have any flags for umount.
return ENOSYS
}
return umount(target)
}

View file

@ -144,6 +144,23 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) //sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofClockinfo)
var ci Clockinfo
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofClockinfo {
return nil, EIO
}
return &ci, nil
}
//sysnb pipe() (r int, w int, err error) //sysnb pipe() (r int, w int, err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {

View file

@ -1662,6 +1662,19 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return EACCES return EACCES
} }
//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
// fileHandle is the argument to nameToHandleAt and openByHandleAt. We
// originally tried to generate it via unix/linux/types.go with "type
// fileHandle C.struct_file_handle" but that generated empty structs
// for mips64 and mips64le. Instead, hard code it for now (it's the
// same everywhere else) until the mips64 generator issue is fixed.
type fileHandle struct {
Bytes uint32
Type int32
}
/* /*
* Unimplemented * Unimplemented
*/ */

View file

@ -351,7 +351,11 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) {
} }
func SetsockoptString(fd, level, opt int, s string) (err error) { func SetsockoptString(fd, level, opt int, s string) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s))) var p unsafe.Pointer
if len(s) > 0 {
p = unsafe.Pointer(&[]byte(s)[0])
}
return setsockopt(fd, level, opt, p, uintptr(len(s)))
} }
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {

View file

@ -275,3 +275,9 @@ const (
// uname // uname
type Utsname C.struct_utsname type Utsname C.struct_utsname
// Clockinfo
const SizeofClockinfo = C.sizeof_struct_clockinfo
type Clockinfo C.struct_clockinfo

View file

@ -926,6 +926,8 @@ const (
TCSETSF = 0x5404 TCSETSF = 0x5404
TCSETSW = 0x5403 TCSETSW = 0x5403
TCXONC = 0x540b TCXONC = 0x540b
TIMER_ABSTIME = 0x3e7
TIMER_MAX = 0x20
TIOC = 0x5400 TIOC = 0x5400
TIOCCBRK = 0x2000747a TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478 TIOCCDTR = 0x20007478

View file

@ -3,7 +3,7 @@
// +build ppc64,aix // +build ppc64,aix
// Created by cgo -godefs - DO NOT EDIT // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -maix64 _const.go // cgo -godefs -- -maix64 _const.go
package unix package unix
@ -926,6 +926,8 @@ const (
TCSETSF = 0x5404 TCSETSF = 0x5404
TCSETSW = 0x5403 TCSETSW = 0x5403
TCXONC = 0x540b TCXONC = 0x540b
TIMER_ABSTIME = 0x3e7
TIMER_MAX = 0x20
TIOC = 0x5400 TIOC = 0x5400
TIOCCBRK = 0x2000747a TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478 TIOCCDTR = 0x20007478

View file

@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t);
int pause(); int pause();
int pread64(int, uintptr_t, size_t, long long); int pread64(int, uintptr_t, size_t, long long);
int pwrite64(int, uintptr_t, size_t, long long); int pwrite64(int, uintptr_t, size_t, long long);
#define c_select select
int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
int setregid(int, int); int setregid(int, int);
int setreuid(int, int); int setreuid(int, int);
@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t);
int getsockname(int, uintptr_t, uintptr_t); int getsockname(int, uintptr_t, uintptr_t);
int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t);
int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t);
int recvmsg(int, uintptr_t, int); int nrecvmsg(int, uintptr_t, int);
int sendmsg(int, uintptr_t, int); int nsendmsg(int, uintptr_t, int);
int munmap(uintptr_t, uintptr_t); int munmap(uintptr_t, uintptr_t);
int madvise(uintptr_t, size_t, int); int madvise(uintptr_t, size_t, int);
int mprotect(uintptr_t, size_t, int); int mprotect(uintptr_t, size_t, int);
@ -118,6 +120,8 @@ int poll(uintptr_t, int, int);
int gettimeofday(uintptr_t, uintptr_t); int gettimeofday(uintptr_t, uintptr_t);
int time(uintptr_t); int time(uintptr_t);
int utime(uintptr_t, uintptr_t); int utime(uintptr_t, uintptr_t);
unsigned long long getsystemcfg(int);
int umount(uintptr_t);
int getrlimit64(int, uintptr_t); int getrlimit64(int, uintptr_t);
int setrlimit64(int, uintptr_t); int setrlimit64(int, uintptr_t);
long long lseek64(int, long long, int); long long lseek64(int, long long, int);
@ -1004,6 +1008,17 @@ func Pwrite(fd int, p []byte, offset int64) (n 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 Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
r0, er := C.c_select(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))))
n = int(r0)
if r0 == -1 && er != nil {
err = er
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask)))) r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask))))
n = int(r0) n = int(r0)
@ -1225,7 +1240,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
// 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 recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, er := C.recvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) r0, er := C.nrecvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags))
n = int(r0) n = int(r0)
if r0 == -1 && er != nil { if r0 == -1 && er != nil {
err = er err = er
@ -1236,7 +1251,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n 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 sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, er := C.sendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) r0, er := C.nsendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags))
n = int(r0) n = int(r0)
if r0 == -1 && er != nil { if r0 == -1 && er != nil {
err = er err = er
@ -1409,6 +1424,25 @@ func Utime(path string, buf *Utimbuf) (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 Getsystemcfg(label int) (n uint64) {
r0, _ := C.getsystemcfg(C.int(label))
n = uint64(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func umount(target string) (err error) {
_p0 := uintptr(unsafe.Pointer(C.CString(target)))
r0, er := C.umount(C.uintptr_t(_p0))
if r0 == -1 && er != nil {
err = er
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(resource int, rlim *Rlimit) (err error) { func Getrlimit(resource int, rlim *Rlimit) (err error) {
r0, er := C.getrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) r0, er := C.getrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim))))
if r0 == -1 && er != nil { if r0 == -1 && er != nil {

View file

@ -960,6 +960,17 @@ func Pwrite(fd int, p []byte, offset int64) (n 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 Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
r0, e1 := callselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))
n = int(r0) n = int(r0)
@ -1189,7 +1200,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
// 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 recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, e1 := callrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) r0, e1 := callnrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags)
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1200,7 +1211,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n 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 sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, e1 := callsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) r0, e1 := callnsendmsg(s, uintptr(unsafe.Pointer(msg)), flags)
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1375,6 +1386,21 @@ func Getsystemcfg(label int) (n uint64) {
// 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 umount(target string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(target)
if err != nil {
return
}
_, e1 := callumount(uintptr(unsafe.Pointer(_p0)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(resource int, rlim *Rlimit) (err error) { func Getrlimit(resource int, rlim *Rlimit) (err error) {
_, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim))) _, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim)))
if e1 != 0 { if e1 != 0 {

View file

@ -85,6 +85,7 @@ import (
//go:cgo_import_dynamic libc_pause pause "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pause pause "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_pread64 pread64 "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pread64 pread64 "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_pwrite64 pwrite64 "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pwrite64 pwrite64 "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_select select "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_pselect pselect "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pselect pselect "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setregid setregid "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setregid setregid "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setreuid setreuid "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setreuid setreuid "libc.a/shr_64.o"
@ -105,8 +106,8 @@ import (
//go:cgo_import_dynamic libc_getsockname getsockname "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getsockname getsockname "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.a/shr_64.o" //go:cgo_import_dynamic libc_recvfrom recvfrom "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_sendto sendto "libc.a/shr_64.o" //go:cgo_import_dynamic libc_sendto sendto "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.a/shr_64.o" //go:cgo_import_dynamic libc_nrecvmsg nrecvmsg "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.a/shr_64.o" //go:cgo_import_dynamic libc_nsendmsg nsendmsg "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o" //go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_madvise madvise "libc.a/shr_64.o" //go:cgo_import_dynamic libc_madvise madvise "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_mprotect mprotect "libc.a/shr_64.o" //go:cgo_import_dynamic libc_mprotect mprotect "libc.a/shr_64.o"
@ -121,6 +122,7 @@ import (
//go:cgo_import_dynamic libc_time time "libc.a/shr_64.o" //go:cgo_import_dynamic libc_time time "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_utime utime "libc.a/shr_64.o" //go:cgo_import_dynamic libc_utime utime "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o" //go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o"
@ -201,6 +203,7 @@ import (
//go:linkname libc_pause libc_pause //go:linkname libc_pause libc_pause
//go:linkname libc_pread64 libc_pread64 //go:linkname libc_pread64 libc_pread64
//go:linkname libc_pwrite64 libc_pwrite64 //go:linkname libc_pwrite64 libc_pwrite64
//go:linkname libc_select libc_select
//go:linkname libc_pselect libc_pselect //go:linkname libc_pselect libc_pselect
//go:linkname libc_setregid libc_setregid //go:linkname libc_setregid libc_setregid
//go:linkname libc_setreuid libc_setreuid //go:linkname libc_setreuid libc_setreuid
@ -221,8 +224,8 @@ import (
//go:linkname libc_getsockname libc_getsockname //go:linkname libc_getsockname libc_getsockname
//go:linkname libc_recvfrom libc_recvfrom //go:linkname libc_recvfrom libc_recvfrom
//go:linkname libc_sendto libc_sendto //go:linkname libc_sendto libc_sendto
//go:linkname libc_recvmsg libc_recvmsg //go:linkname libc_nrecvmsg libc_nrecvmsg
//go:linkname libc_sendmsg libc_sendmsg //go:linkname libc_nsendmsg libc_nsendmsg
//go:linkname libc_munmap libc_munmap //go:linkname libc_munmap libc_munmap
//go:linkname libc_madvise libc_madvise //go:linkname libc_madvise libc_madvise
//go:linkname libc_mprotect libc_mprotect //go:linkname libc_mprotect libc_mprotect
@ -237,6 +240,7 @@ import (
//go:linkname libc_time libc_time //go:linkname libc_time libc_time
//go:linkname libc_utime libc_utime //go:linkname libc_utime libc_utime
//go:linkname libc_getsystemcfg libc_getsystemcfg //go:linkname libc_getsystemcfg libc_getsystemcfg
//go:linkname libc_umount libc_umount
//go:linkname libc_getrlimit libc_getrlimit //go:linkname libc_getrlimit libc_getrlimit
//go:linkname libc_setrlimit libc_setrlimit //go:linkname libc_setrlimit libc_setrlimit
//go:linkname libc_lseek libc_lseek //go:linkname libc_lseek libc_lseek
@ -320,6 +324,7 @@ var (
libc_pause, libc_pause,
libc_pread64, libc_pread64,
libc_pwrite64, libc_pwrite64,
libc_select,
libc_pselect, libc_pselect,
libc_setregid, libc_setregid,
libc_setreuid, libc_setreuid,
@ -340,8 +345,8 @@ var (
libc_getsockname, libc_getsockname,
libc_recvfrom, libc_recvfrom,
libc_sendto, libc_sendto,
libc_recvmsg, libc_nrecvmsg,
libc_sendmsg, libc_nsendmsg,
libc_munmap, libc_munmap,
libc_madvise, libc_madvise,
libc_mprotect, libc_mprotect,
@ -356,6 +361,7 @@ var (
libc_time, libc_time,
libc_utime, libc_utime,
libc_getsystemcfg, libc_getsystemcfg,
libc_umount,
libc_getrlimit, libc_getrlimit,
libc_setrlimit, libc_setrlimit,
libc_lseek, libc_lseek,
@ -893,6 +899,13 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1
// 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 callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_select)), 5, uintptr(nfd), r, w, e, timeout, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pselect)), 6, uintptr(nfd), r, w, e, timeout, sigmask) r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pselect)), 6, uintptr(nfd), r, w, e, timeout, sigmask)
return return
@ -1033,15 +1046,15 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u
// 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 callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_recvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nrecvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0)
return return
} }
// 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 callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nsendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0)
return return
} }
@ -1145,6 +1158,13 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) {
// 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 callumount(_p0 uintptr) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_umount)), 1, _p0, 0, 0, 0, 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0)
return return

View file

@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t);
int pause(); int pause();
int pread64(int, uintptr_t, size_t, long long); int pread64(int, uintptr_t, size_t, long long);
int pwrite64(int, uintptr_t, size_t, long long); int pwrite64(int, uintptr_t, size_t, long long);
#define c_select select
int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
int setregid(int, int); int setregid(int, int);
int setreuid(int, int); int setreuid(int, int);
@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t);
int getsockname(int, uintptr_t, uintptr_t); int getsockname(int, uintptr_t, uintptr_t);
int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t);
int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t);
int recvmsg(int, uintptr_t, int); int nrecvmsg(int, uintptr_t, int);
int sendmsg(int, uintptr_t, int); int nsendmsg(int, uintptr_t, int);
int munmap(uintptr_t, uintptr_t); int munmap(uintptr_t, uintptr_t);
int madvise(uintptr_t, size_t, int); int madvise(uintptr_t, size_t, int);
int mprotect(uintptr_t, size_t, int); int mprotect(uintptr_t, size_t, int);
@ -119,6 +121,7 @@ int gettimeofday(uintptr_t, uintptr_t);
int time(uintptr_t); int time(uintptr_t);
int utime(uintptr_t, uintptr_t); int utime(uintptr_t, uintptr_t);
unsigned long long getsystemcfg(int); unsigned long long getsystemcfg(int);
int umount(uintptr_t);
int getrlimit(int, uintptr_t); int getrlimit(int, uintptr_t);
int setrlimit(int, uintptr_t); int setrlimit(int, uintptr_t);
long long lseek(int, long long, int); long long lseek(int, long long, int);
@ -732,6 +735,14 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1
// 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 callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.c_select(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout)))
e1 = syscall.GetErrno()
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.pselect(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout), C.uintptr_t(sigmask))) r1 = uintptr(C.pselect(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout), C.uintptr_t(sigmask)))
e1 = syscall.GetErrno() e1 = syscall.GetErrno()
@ -892,16 +903,16 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u
// 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 callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.recvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) r1 = uintptr(C.nrecvmsg(C.int(s), C.uintptr_t(msg), C.int(flags)))
e1 = syscall.GetErrno() e1 = syscall.GetErrno()
return return
} }
// 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 callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.sendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) r1 = uintptr(C.nsendmsg(C.int(s), C.uintptr_t(msg), C.int(flags)))
e1 = syscall.GetErrno() e1 = syscall.GetErrno()
return return
} }
@ -1020,6 +1031,14 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) {
// 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 callumount(_p0 uintptr) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.umount(C.uintptr_t(_p0)))
e1 = syscall.GetErrno()
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.getrlimit(C.int(resource), C.uintptr_t(rlim))) r1 = uintptr(C.getrlimit(C.int(resource), C.uintptr_t(rlim)))
e1 = syscall.GetErrno() e1 = syscall.GetErrno()

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe(p *[2]_C_int) (err error) { func pipe(p *[2]_C_int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe(p *[2]_C_int) (err error) { func pipe(p *[2]_C_int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(events) > 0 { if len(events) > 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(events) > 0 { if len(events) > 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) { func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 { if e1 != 0 {

View file

@ -1679,6 +1679,32 @@ func faccessat(dirfd int, path string, mode uint32) (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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(events) > 0 { if len(events) > 0 {

View file

@ -103,7 +103,6 @@ type Stat_t struct {
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
Ssize int32 Ssize int32
_ [4]byte
Atim StTimespec Atim StTimespec
Mtim StTimespec Mtim StTimespec
Ctim StTimespec Ctim StTimespec
@ -205,10 +204,8 @@ type Linger struct {
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
_ [4]byte
Iov *Iovec Iov *Iovec
Iovlen int32 Iovlen int32
_ [4]byte
Control *byte Control *byte
Controllen uint32 Controllen uint32
Flags int32 Flags int32
@ -339,7 +336,6 @@ type Statfs_t struct {
Ffree uint64 Ffree uint64
Fsid Fsid64_t Fsid Fsid64_t
Vfstype int32 Vfstype int32
_ [4]byte
Fsize uint64 Fsize uint64
Vfsnumber int32 Vfsnumber int32
Vfsoff int32 Vfsoff int32

View file

@ -487,3 +487,13 @@ type Utsname struct {
Version [256]byte Version [256]byte
Machine [256]byte Machine [256]byte
} }
const SizeofClockinfo = 0x14
type Clockinfo struct {
Hz int32
Tick int32
Tickadj int32
Stathz int32
Profhz int32
}

View file

@ -497,3 +497,13 @@ type Utsname struct {
Version [256]byte Version [256]byte
Machine [256]byte Machine [256]byte
} }
const SizeofClockinfo = 0x14
type Clockinfo struct {
Hz int32
Tick int32
Tickadj int32
Stathz int32
Profhz int32
}

View file

@ -488,3 +488,13 @@ type Utsname struct {
Version [256]byte Version [256]byte
Machine [256]byte Machine [256]byte
} }
const SizeofClockinfo = 0x14
type Clockinfo struct {
Hz int32
Tick int32
Tickadj int32
Stathz int32
Profhz int32
}

View file

@ -497,3 +497,13 @@ type Utsname struct {
Version [256]byte Version [256]byte
Machine [256]byte Machine [256]byte
} }
const SizeofClockinfo = 0x14
type Clockinfo struct {
Hz int32
Tick int32
Tickadj int32
Stathz int32
Profhz int32
}

View file

@ -443,6 +443,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -451,11 +479,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -499,7 +529,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -576,6 +617,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -652,6 +694,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x8 SizeofSockFprog = 0x8

View file

@ -444,6 +444,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -452,11 +480,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -500,7 +530,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -577,6 +618,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -653,6 +695,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -447,6 +447,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -455,11 +483,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -503,7 +533,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -580,6 +621,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -656,6 +698,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x8 SizeofSockFprog = 0x8

View file

@ -445,6 +445,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -453,11 +481,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -501,7 +531,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -578,6 +619,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -654,6 +696,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -446,6 +446,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -454,11 +482,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -502,7 +532,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -579,6 +620,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -655,6 +697,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x8 SizeofSockFprog = 0x8

View file

@ -445,6 +445,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -453,11 +481,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -501,7 +531,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -578,6 +619,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -654,6 +696,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -445,6 +445,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -453,11 +481,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -501,7 +531,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -578,6 +619,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -654,6 +696,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -446,6 +446,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -454,11 +482,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -502,7 +532,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -579,6 +620,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -655,6 +697,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x8 SizeofSockFprog = 0x8

View file

@ -446,6 +446,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -454,11 +482,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -502,7 +532,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -579,6 +620,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -655,6 +697,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -446,6 +446,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -454,11 +482,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -502,7 +532,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -579,6 +620,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -655,6 +697,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -445,6 +445,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -453,11 +481,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -501,7 +531,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -578,6 +619,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -654,6 +696,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -444,6 +444,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -452,11 +480,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -500,7 +530,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -577,6 +618,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -653,6 +695,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -448,6 +448,34 @@ const (
) )
const ( const (
NDA_UNSPEC = 0x0
NDA_DST = 0x1
NDA_LLADDR = 0x2
NDA_CACHEINFO = 0x3
NDA_PROBES = 0x4
NDA_VLAN = 0x5
NDA_PORT = 0x6
NDA_VNI = 0x7
NDA_IFINDEX = 0x8
NDA_MASTER = 0x9
NDA_LINK_NETNSID = 0xa
NDA_SRC_VNI = 0xb
NTF_USE = 0x1
NTF_SELF = 0x2
NTF_MASTER = 0x4
NTF_PROXY = 0x8
NTF_EXT_LEARNED = 0x10
NTF_OFFLOADED = 0x20
NTF_ROUTER = 0x80
NUD_INCOMPLETE = 0x1
NUD_REACHABLE = 0x2
NUD_STALE = 0x4
NUD_DELAY = 0x8
NUD_PROBE = 0x10
NUD_FAILED = 0x20
NUD_NOARP = 0x40
NUD_PERMANENT = 0x80
NUD_NONE = 0x0
IFA_UNSPEC = 0x0 IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1 IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2 IFA_LOCAL = 0x2
@ -456,11 +484,13 @@ const (
IFA_ANYCAST = 0x5 IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6 IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7 IFA_MULTICAST = 0x7
IFA_FLAGS = 0x8
IFA_RT_PRIORITY = 0x9
IFA_TARGET_NETNSID = 0xa
IFLA_UNSPEC = 0x0 IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1 IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2 IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3 IFLA_IFNAME = 0x3
IFLA_INFO_KIND = 0x1
IFLA_MTU = 0x4 IFLA_MTU = 0x4
IFLA_LINK = 0x5 IFLA_LINK = 0x5
IFLA_QDISC = 0x6 IFLA_QDISC = 0x6
@ -504,7 +534,18 @@ const (
IFLA_EVENT = 0x2c IFLA_EVENT = 0x2c
IFLA_NEW_NETNSID = 0x2d IFLA_NEW_NETNSID = 0x2d
IFLA_IF_NETNSID = 0x2e IFLA_IF_NETNSID = 0x2e
IFLA_TARGET_NETNSID = 0x2e
IFLA_CARRIER_UP_COUNT = 0x2f
IFLA_CARRIER_DOWN_COUNT = 0x30
IFLA_NEW_IFINDEX = 0x31
IFLA_MIN_MTU = 0x32
IFLA_MAX_MTU = 0x33
IFLA_MAX = 0x33 IFLA_MAX = 0x33
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
IFLA_INFO_XSTATS = 0x3
IFLA_INFO_SLAVE_KIND = 0x4
IFLA_INFO_SLAVE_DATA = 0x5
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -581,6 +622,7 @@ const (
SizeofRtMsg = 0xc SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8 SizeofRtNexthop = 0x8
SizeofNdUseroptmsg = 0x10 SizeofNdUseroptmsg = 0x10
SizeofNdMsg = 0xc
) )
type NlMsghdr struct { type NlMsghdr struct {
@ -657,6 +699,16 @@ type NdUseroptmsg struct {
Pad3 uint32 Pad3 uint32
} }
type NdMsg struct {
Family uint8
Pad1 uint8
Pad2 uint16
Ifindex int32
State uint16
Flags uint8
Type uint8
}
const ( const (
SizeofSockFilter = 0x8 SizeofSockFilter = 0x8
SizeofSockFprog = 0x10 SizeofSockFprog = 0x10

View file

@ -14,26 +14,26 @@ import (
) )
// AddImport adds the import path to the file f, if absent. // AddImport adds the import path to the file f, if absent.
func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool) { func AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) {
return AddNamedImport(fset, f, "", ipath) return AddNamedImport(fset, f, "", path)
} }
// AddNamedImport adds the import path to the file f, if absent. // AddNamedImport adds the import with the given name and path to the file f, if absent.
// If name is not empty, it is used to rename the import. // If name is not empty, it is used to rename the import.
// //
// For example, calling // For example, calling
// AddNamedImport(fset, f, "pathpkg", "path") // AddNamedImport(fset, f, "pathpkg", "path")
// adds // adds
// import pathpkg "path" // import pathpkg "path"
func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added bool) { func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) {
if imports(f, ipath) { if imports(f, name, path) {
return false return false
} }
newImport := &ast.ImportSpec{ newImport := &ast.ImportSpec{
Path: &ast.BasicLit{ Path: &ast.BasicLit{
Kind: token.STRING, Kind: token.STRING,
Value: strconv.Quote(ipath), Value: strconv.Quote(path),
}, },
} }
if name != "" { if name != "" {
@ -43,14 +43,14 @@ func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added
// Find an import decl to add to. // Find an import decl to add to.
// The goal is to find an existing import // The goal is to find an existing import
// whose import path has the longest shared // whose import path has the longest shared
// prefix with ipath. // prefix with path.
var ( var (
bestMatch = -1 // length of longest shared prefix bestMatch = -1 // length of longest shared prefix
lastImport = -1 // index in f.Decls of the file's final import decl lastImport = -1 // index in f.Decls of the file's final import decl
impDecl *ast.GenDecl // import decl containing the best match impDecl *ast.GenDecl // import decl containing the best match
impIndex = -1 // spec index in impDecl containing the best match impIndex = -1 // spec index in impDecl containing the best match
isThirdPartyPath = isThirdParty(ipath) isThirdPartyPath = isThirdParty(path)
) )
for i, decl := range f.Decls { for i, decl := range f.Decls {
gen, ok := decl.(*ast.GenDecl) gen, ok := decl.(*ast.GenDecl)
@ -81,7 +81,7 @@ func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added
for j, spec := range gen.Specs { for j, spec := range gen.Specs {
impspec := spec.(*ast.ImportSpec) impspec := spec.(*ast.ImportSpec)
p := importPath(impspec) p := importPath(impspec)
n := matchLen(p, ipath) n := matchLen(p, path)
if n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) { if n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) {
bestMatch = n bestMatch = n
impDecl = gen impDecl = gen
@ -197,11 +197,13 @@ func isThirdParty(importPath string) bool {
} }
// DeleteImport deletes the import path from the file f, if present. // DeleteImport deletes the import path from the file f, if present.
// If there are duplicate import declarations, all matching ones are deleted.
func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) {
return DeleteNamedImport(fset, f, "", path) return DeleteNamedImport(fset, f, "", path)
} }
// DeleteNamedImport deletes the import with the given name and path from the file f, if present. // DeleteNamedImport deletes the import with the given name and path from the file f, if present.
// If there are duplicate import declarations, all matching ones are deleted.
func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) {
var delspecs []*ast.ImportSpec var delspecs []*ast.ImportSpec
var delcomments []*ast.CommentGroup var delcomments []*ast.CommentGroup
@ -216,13 +218,7 @@ func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (del
for j := 0; j < len(gen.Specs); j++ { for j := 0; j < len(gen.Specs); j++ {
spec := gen.Specs[j] spec := gen.Specs[j]
impspec := spec.(*ast.ImportSpec) impspec := spec.(*ast.ImportSpec)
if impspec.Name == nil && name != "" { if importName(impspec) != name || importPath(impspec) != path {
continue
}
if impspec.Name != nil && impspec.Name.Name != name {
continue
}
if importPath(impspec) != path {
continue continue
} }
@ -383,9 +379,14 @@ func (fn visitFn) Visit(node ast.Node) ast.Visitor {
return fn return fn
} }
// imports returns true if f imports path. // imports reports whether f has an import with the specified name and path.
func imports(f *ast.File, path string) bool { func imports(f *ast.File, name, path string) bool {
return importSpec(f, path) != nil for _, s := range f.Imports {
if importName(s) == name && importPath(s) == path {
return true
}
}
return false
} }
// importSpec returns the import spec if f imports path, // importSpec returns the import spec if f imports path,
@ -399,15 +400,24 @@ func importSpec(f *ast.File, path string) *ast.ImportSpec {
return nil return nil
} }
// importName returns the name of s,
// or "" if the import is not named.
func importName(s *ast.ImportSpec) string {
if s.Name == nil {
return ""
}
return s.Name.Name
}
// importPath returns the unquoted import path of s, // importPath returns the unquoted import path of s,
// or "" if the path is not properly quoted. // or "" if the path is not properly quoted.
func importPath(s *ast.ImportSpec) string { func importPath(s *ast.ImportSpec) string {
t, err := strconv.Unquote(s.Path.Value) t, err := strconv.Unquote(s.Path.Value)
if err == nil { if err != nil {
return t
}
return "" return ""
} }
return t
}
// declImports reports whether gen contains an import of path. // declImports reports whether gen contains an import of path.
func declImports(gen *ast.GenDecl, path string) bool { func declImports(gen *ast.GenDecl, path string) bool {

View file

@ -14,7 +14,7 @@
// Experiments suggest the inspector's traversals are about 2.5x faster // Experiments suggest the inspector's traversals are about 2.5x faster
// than ast.Inspect, but it may take around 5 traversals for this // than ast.Inspect, but it may take around 5 traversals for this
// benefit to amortize the inspector's construction cost. // benefit to amortize the inspector's construction cost.
// If efficiency is the primary concern, do not use use Inspector for // If efficiency is the primary concern, do not use Inspector for
// one-off traversals. // one-off traversals.
package inspector package inspector

View file

@ -16,7 +16,7 @@
// time before the Go 1.8 release and rebuild and redeploy their // time before the Go 1.8 release and rebuild and redeploy their
// developer tools, which will then be able to consume both Go 1.7 and // developer tools, which will then be able to consume both Go 1.7 and
// Go 1.8 export data files, so they will work before and after the // Go 1.8 export data files, so they will work before and after the
// Go update. (See discussion at https://github.com/golang/go/issues/15651.) // Go update. (See discussion at https://golang.org/issue/15651.)
// //
package gcexportdata // import "golang.org/x/tools/go/gcexportdata" package gcexportdata // import "golang.org/x/tools/go/gcexportdata"

View file

@ -127,10 +127,10 @@ func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error)
// --- generic export data --- // --- generic export data ---
// populate type map with predeclared "known" types // populate type map with predeclared "known" types
for index, typ := range predeclared { for index, typ := range predeclared() {
p.typIndex[typ] = index p.typIndex[typ] = index
} }
if len(p.typIndex) != len(predeclared) { if len(p.typIndex) != len(predeclared()) {
return nil, internalError("duplicate entries in type map?") return nil, internalError("duplicate entries in type map?")
} }

View file

@ -126,7 +126,7 @@ func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []
// --- generic export data --- // --- generic export data ---
// populate typList with predeclared "known" types // populate typList with predeclared "known" types
p.typList = append(p.typList, predeclared...) p.typList = append(p.typList, predeclared()...)
// read package data // read package data
pkg = p.pkg() pkg = p.pkg()
@ -976,8 +976,13 @@ const (
aliasTag aliasTag
) )
var predeclared = []types.Type{ var predecl []types.Type // initialized lazily
// basic types
func predeclared() []types.Type {
if predecl == nil {
// initialize lazily to be sure that all
// elements have been initialized before
predecl = []types.Type{ // basic types
types.Typ[types.Bool], types.Typ[types.Bool],
types.Typ[types.Int], types.Typ[types.Int],
types.Typ[types.Int8], types.Typ[types.Int8],
@ -1021,6 +1026,9 @@ var predeclared = []types.Type{
// used internally by gc; never used by this package or in .a files // used internally by gc; never used by this package or in .a files
anyType{}, anyType{},
} }
}
return predecl
}
type anyType struct{} type anyType struct{}

View file

@ -109,7 +109,7 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []
}, },
} }
for i, pt := range predeclared { for i, pt := range predeclared() {
p.typCache[uint64(i)] = pt p.typCache[uint64(i)] = pt
} }
@ -142,8 +142,12 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []
p.pkgIndex[pkg] = nameIndex p.pkgIndex[pkg] = nameIndex
pkgList[i] = pkg pkgList[i] = pkg
} }
var localpkg *types.Package
localpkg := pkgList[0] for _, pkg := range pkgList {
if pkg.Path() == path {
localpkg = pkg
}
}
names := make([]string, 0, len(p.pkgIndex[localpkg])) names := make([]string, 0, len(p.pkgIndex[localpkg]))
for name := range p.pkgIndex[localpkg] { for name := range p.pkgIndex[localpkg] {
@ -330,6 +334,10 @@ func (r *importReader) value() (typ types.Type, val constant.Value) {
val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im))
default: default:
if b.Kind() == types.Invalid {
val = constant.MakeUnknown()
return
}
errorf("unexpected type %v", typ) // panics errorf("unexpected type %v", typ) // panics
panic("unreachable") panic("unreachable")
} }

View file

@ -780,7 +780,7 @@ func (imp *importer) doImport(from *PackageInfo, to string) (*types.Package, err
if to == "C" { if to == "C" {
// This should be unreachable, but ad hoc packages are // This should be unreachable, but ad hoc packages are
// not currently subject to cgo preprocessing. // not currently subject to cgo preprocessing.
// See https://github.com/golang/go/issues/11627. // See https://golang.org/issue/11627.
return nil, fmt.Errorf(`the loader doesn't cgo-process ad hoc packages like %q; see Go issue 11627`, return nil, fmt.Errorf(`the loader doesn't cgo-process ad hoc packages like %q; see Go issue 11627`,
from.Pkg.Path()) from.Pkg.Path())
} }

View file

@ -5,11 +5,6 @@
/* /*
Package packages loads Go packages for inspection and analysis. Package packages loads Go packages for inspection and analysis.
Note: Though this package is ready for widespread use, we may make minor
breaking changes if absolutely necessary. Any such change will be
announced on golang-tools@ at least one week before it is committed. No
more breaking changes will be made after December 1, 2018.
The Load function takes as input a list of patterns and return a list of Package The Load function takes as input a list of patterns and return a list of Package
structs describing individual packages matched by those patterns. structs describing individual packages matched by those patterns.
The LoadMode controls the amount of detail in the loaded packages. The LoadMode controls the amount of detail in the loaded packages.
@ -19,22 +14,17 @@ but all patterns with the prefix "query=", where query is a
non-empty string of letters from [a-z], are reserved and may be non-empty string of letters from [a-z], are reserved and may be
interpreted as query operators. interpreted as query operators.
Only two query operators are currently supported, "file" and "pattern". Two query operators are currently supported: "file" and "pattern".
The query "file=path/to/file.go" matches the package or packages enclosing The query "file=path/to/file.go" matches the package or packages enclosing
the Go source file path/to/file.go. For example "file=~/go/src/fmt/print.go" the Go source file path/to/file.go. For example "file=~/go/src/fmt/print.go"
might returns the packages "fmt" and "fmt [fmt.test]". might return the packages "fmt" and "fmt [fmt.test]".
The query "pattern=string" causes "string" to be passed directly to The query "pattern=string" causes "string" to be passed directly to
the underlying build tool. In most cases this is unnecessary, the underlying build tool. In most cases this is unnecessary,
but an application can use Load("pattern=" + x) as an escaping mechanism but an application can use Load("pattern=" + x) as an escaping mechanism
to ensure that x is not interpreted as a query operator if it contains '='. to ensure that x is not interpreted as a query operator if it contains '='.
A third query "name=identifier" will be added soon.
It will match packages whose package declaration contains the specified identifier.
For example, "name=rand" would match the packages "math/rand" and "crypto/rand",
and "name=main" would match all executables.
All other query operators are reserved for future use and currently All other query operators are reserved for future use and currently
cause Load to report an error. cause Load to report an error.
@ -180,22 +170,13 @@ Instead, ssadump no longer requests the runtime package,
but seeks it among the dependencies of the user-specified packages, but seeks it among the dependencies of the user-specified packages,
and emits an error if it is not found. and emits an error if it is not found.
Overlays: the ParseFile hook in the API permits clients to vary the way Overlays: The Overlay field in the Config allows providing alternate contents
in which ASTs are obtained from filenames; the default implementation is for Go source files, by providing a mapping from file path to contents.
based on parser.ParseFile. This features enables editor-integrated tools go/packages will pull in new imports added in overlay files when go/packages
that analyze the contents of modified but unsaved buffers: rather than is run in LoadImports mode or greater.
read from the file system, a tool can read from an archive of modified Overlay support for the go list driver isn't complete yet: if the file doesn't
buffers provided by the editor. exist on disk, it will only be recognized in an overlay if it is a non-test file
This approach has its limits. Because package metadata is obtained by and the package would be reported even without the overlay.
fork/execing an external query command for each build system, we can
fake only the file contents seen by the parser, type-checker, and
application, but not by the metadata query, so, for example:
- additional imports in the fake file will not be described by the
metadata, so the type checker will fail to load imports that create
new dependencies.
- in TypeCheck mode, because export data is produced by the query
command, it will not reflect the fake file contents.
- this mechanism cannot add files to a package without first saving them.
Questions & Tasks Questions & Tasks

View file

@ -16,7 +16,17 @@ import (
"strings" "strings"
) )
// findExternalTool returns the file path of a tool that supplies // Driver
type driverRequest struct {
Command string `json:"command"`
Mode LoadMode `json:"mode"`
Env []string `json:"env"`
BuildFlags []string `json:"build_flags"`
Tests bool `json:"tests"`
Overlay map[string][]byte `json:"overlay"`
}
// 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."
// If GOPACKAGESDRIVER is set in the environment findExternalTool returns its // If GOPACKAGESDRIVER is set in the environment findExternalTool returns its
// value, otherwise it searches for a binary named gopackagesdriver on the PATH. // value, otherwise it searches for a binary named gopackagesdriver on the PATH.
@ -39,21 +49,22 @@ func findExternalDriver(cfg *Config) driver {
} }
} }
return func(cfg *Config, words ...string) (*driverResponse, error) { return func(cfg *Config, words ...string) (*driverResponse, error) {
req, err := json.Marshal(driverRequest{
Mode: cfg.Mode,
Env: cfg.Env,
BuildFlags: cfg.BuildFlags,
Tests: cfg.Tests,
Overlay: cfg.Overlay,
})
if err != nil {
return nil, fmt.Errorf("failed to encode message to driver tool: %v", err)
}
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
fullargs := []string{ cmd := exec.CommandContext(cfg.Context, tool, words...)
"list",
fmt.Sprintf("-test=%t", cfg.Tests),
fmt.Sprintf("-export=%t", usesExportData(cfg)),
fmt.Sprintf("-deps=%t", cfg.Mode >= LoadImports),
}
for _, f := range cfg.BuildFlags {
fullargs = append(fullargs, fmt.Sprintf("-buildflag=%v", f))
}
fullargs = append(fullargs, "--")
fullargs = append(fullargs, words...)
cmd := exec.CommandContext(cfg.Context, tool, fullargs...)
cmd.Env = cfg.Env
cmd.Dir = cfg.Dir cmd.Dir = cfg.Dir
cmd.Env = cfg.Env
cmd.Stdin = bytes.NewReader(req)
cmd.Stdout = buf cmd.Stdout = buf
cmd.Stderr = new(bytes.Buffer) cmd.Stderr = new(bytes.Buffer)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {

View file

@ -8,29 +8,84 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"go/types"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"reflect"
"regexp" "regexp"
"strconv"
"strings" "strings"
"sync" "sync"
"time"
"golang.org/x/tools/go/internal/packagesdriver"
"golang.org/x/tools/internal/gopathwalk" "golang.org/x/tools/internal/gopathwalk"
"golang.org/x/tools/internal/semver" "golang.org/x/tools/internal/semver"
) )
// debug controls verbose logging.
var debug, _ = strconv.ParseBool(os.Getenv("GOPACKAGESDEBUG"))
// A goTooOldError reports that the go command // A goTooOldError reports that the go command
// found by exec.LookPath is too old to use the new go list behavior. // found by exec.LookPath is too old to use the new go list behavior.
type goTooOldError struct { type goTooOldError struct {
error error
} }
// responseDeduper wraps a driverResponse, deduplicating its contents.
type responseDeduper struct {
seenRoots map[string]bool
seenPackages map[string]*Package
dr *driverResponse
}
// init fills in r with a driverResponse.
func (r *responseDeduper) init(dr *driverResponse) {
r.dr = dr
r.seenRoots = map[string]bool{}
r.seenPackages = map[string]*Package{}
for _, pkg := range dr.Packages {
r.seenPackages[pkg.ID] = pkg
}
for _, root := range dr.Roots {
r.seenRoots[root] = true
}
}
func (r *responseDeduper) addPackage(p *Package) {
if r.seenPackages[p.ID] != nil {
return
}
r.seenPackages[p.ID] = p
r.dr.Packages = append(r.dr.Packages, p)
}
func (r *responseDeduper) addRoot(id string) {
if r.seenRoots[id] {
return
}
r.seenRoots[id] = true
r.dr.Roots = append(r.dr.Roots, id)
}
// 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, error) { func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) {
var sizes types.Sizes
var sizeserr error
var sizeswg sync.WaitGroup
if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 {
sizeswg.Add(1)
go func() {
sizes, sizeserr = getSizes(cfg)
sizeswg.Done()
}()
}
// Determine files requested in contains patterns // Determine files requested in contains patterns
var containFiles []string var containFiles []string
var packagesNamed []string var packagesNamed []string
@ -49,7 +104,7 @@ extractQueries:
containFiles = append(containFiles, value) containFiles = append(containFiles, value)
case "pattern": case "pattern":
restPatterns = append(restPatterns, value) restPatterns = append(restPatterns, value)
case "name": case "iamashamedtousethedisabledqueryname":
packagesNamed = append(packagesNamed, value) packagesNamed = append(packagesNamed, value)
case "": // not a reserved query case "": // not a reserved query
restPatterns = append(restPatterns, pattern) restPatterns = append(restPatterns, pattern)
@ -65,85 +120,104 @@ extractQueries:
} }
} }
} }
patterns = restPatterns
// Look for the deprecated contains: syntax.
// TODO(matloob): delete this around mid-October 2018.
restPatterns = restPatterns[:0]
for _, pattern := range patterns {
if strings.HasPrefix(pattern, "contains:") {
containFile := strings.TrimPrefix(pattern, "contains:")
containFiles = append(containFiles, containFile)
} else {
restPatterns = append(restPatterns, pattern)
}
}
containFiles = absJoin(cfg.Dir, containFiles)
// TODO(matloob): Remove the definition of listfunc and just use golistPackages once go1.12 is released. response := &responseDeduper{}
var listfunc driver
listfunc = func(cfg *Config, words ...string) (*driverResponse, error) {
response, err := golistDriverCurrent(cfg, words...)
if _, ok := err.(goTooOldError); ok {
listfunc = golistDriverFallback
return listfunc(cfg, words...)
}
listfunc = golistDriverCurrent
return response, err
}
var response *driverResponse
var err error var err error
// see if we have any patterns to pass through to go list. // See if we have any patterns to pass through to go list. Zero initial
if len(restPatterns) > 0 { // patterns also requires a go list call, since it's the equivalent of
response, err = listfunc(cfg, restPatterns...) // ".".
if len(restPatterns) > 0 || len(patterns) == 0 {
dr, err := golistDriver(cfg, restPatterns...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
response.init(dr)
} else { } else {
response = &driverResponse{} response.init(&driverResponse{})
} }
if len(containFiles) == 0 && len(packagesNamed) == 0 { sizeswg.Wait()
return response, nil if sizeserr != nil {
return nil, sizeserr
}
// types.SizesFor always returns nil or a *types.StdSizes
response.dr.Sizes, _ = sizes.(*types.StdSizes)
var containsCandidates []string
if len(containFiles) != 0 {
if err := runContainsQueries(cfg, golistDriver, response, containFiles); err != nil {
return nil, err
}
} }
seenPkgs := make(map[string]*Package) // for deduplication. different containing queries could produce same packages if len(packagesNamed) != 0 {
for _, pkg := range response.Packages { if err := runNamedQueries(cfg, golistDriver, response, packagesNamed); err != nil {
seenPkgs[pkg.ID] = pkg return nil, err
} }
addPkg := func(p *Package) {
if _, ok := seenPkgs[p.ID]; ok {
return
}
seenPkgs[p.ID] = p
response.Packages = append(response.Packages, p)
} }
containsResults, err := runContainsQueries(cfg, listfunc, addPkg, containFiles) modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response.dr)
if err != nil { if err != nil {
return nil, err return nil, err
} }
response.Roots = append(response.Roots, containsResults...) if len(containFiles) > 0 {
containsCandidates = append(containsCandidates, modifiedPkgs...)
namedResults, err := runNamedQueries(cfg, listfunc, addPkg, packagesNamed) containsCandidates = append(containsCandidates, needPkgs...)
if err != nil { }
if err := addNeededOverlayPackages(cfg, golistDriver, response, needPkgs); err != nil {
return nil, err return nil, err
} }
response.Roots = append(response.Roots, namedResults...) // Check candidate packages for containFiles.
if len(containFiles) > 0 {
return response, nil for _, id := range containsCandidates {
pkg := response.seenPackages[id]
for _, f := range containFiles {
for _, g := range pkg.GoFiles {
if sameFile(f, g) {
response.addRoot(id)
}
}
}
}
} }
func runContainsQueries(cfg *Config, driver driver, addPkg func(*Package), queries []string) ([]string, error) { return response.dr, nil
var results []string }
func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string) error {
if len(pkgs) == 0 {
return nil
}
dr, err := driver(cfg, pkgs...)
if err != nil {
return err
}
for _, pkg := range dr.Packages {
response.addPackage(pkg)
}
_, needPkgs, err := processGolistOverlay(cfg, response.dr)
if err != nil {
return err
}
addNeededOverlayPackages(cfg, driver, response, needPkgs)
return nil
}
func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error {
for _, query := range queries { for _, query := range queries {
// TODO(matloob): Do only one query per directory. // TODO(matloob): Do only one query per directory.
fdir := filepath.Dir(query) fdir := filepath.Dir(query)
cfg.Dir = fdir // Pass absolute path of directory to go list so that it knows to treat it as a directory,
dirResponse, err := driver(cfg, ".") // not a package path.
pattern, err := filepath.Abs(fdir)
if err != nil { if err != nil {
return nil, err return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err)
}
dirResponse, err := driver(cfg, pattern)
if err != nil {
return err
} }
isRoot := make(map[string]bool, len(dirResponse.Roots)) isRoot := make(map[string]bool, len(dirResponse.Roots))
for _, root := range dirResponse.Roots { for _, root := range dirResponse.Roots {
@ -154,30 +228,34 @@ func runContainsQueries(cfg *Config, driver driver, addPkg func(*Package), queri
// We don't bother to filter packages that will be dropped by the changes of roots, // We don't bother to filter packages that will be dropped by the changes of roots,
// that will happen anyway during graph construction outside this function. // that will happen anyway during graph construction outside this function.
// Over-reporting packages is not a problem. // Over-reporting packages is not a problem.
addPkg(pkg) response.addPackage(pkg)
// if the package was not a root one, it cannot have the file // if the package was not a root one, it cannot have the file
if !isRoot[pkg.ID] { if !isRoot[pkg.ID] {
continue continue
} }
for _, pkgFile := range pkg.GoFiles { for _, pkgFile := range pkg.GoFiles {
if filepath.Base(query) == filepath.Base(pkgFile) { if filepath.Base(query) == filepath.Base(pkgFile) {
results = append(results, pkg.ID) response.addRoot(pkg.ID)
break break
} }
} }
} }
} }
return results, nil return nil
} }
// modCacheRegexp splits a path in a module cache into module, module version, and package. // modCacheRegexp splits a path in a module cache into module, module version, and package.
var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`)
func runNamedQueries(cfg *Config, driver driver, addPkg func(*Package), queries []string) ([]string, error) { func runNamedQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error {
// calling `go env` isn't free; bail out if there's nothing to do.
if len(queries) == 0 {
return nil
}
// Determine which directories are relevant to scan. // Determine which directories are relevant to scan.
roots, modulesEnabled, err := roots(cfg) roots, modRoot, err := roots(cfg)
if err != nil { if err != nil {
return nil, err return err
} }
// Scan the selected directories. Simple matches, from GOPATH/GOROOT // Scan the selected directories. Simple matches, from GOPATH/GOROOT
@ -190,7 +268,10 @@ func runNamedQueries(cfg *Config, driver driver, addPkg func(*Package), queries
matchesMu.Lock() matchesMu.Lock()
defer matchesMu.Unlock() defer matchesMu.Unlock()
path := dir[len(root.Path)+1:] path := dir
if dir != root.Path {
path = dir[len(root.Path)+1:]
}
if pathMatchesQueries(path, queries) { if pathMatchesQueries(path, queries) {
switch root.Type { switch root.Type {
case gopathwalk.RootModuleCache: case gopathwalk.RootModuleCache:
@ -210,15 +291,38 @@ func runNamedQueries(cfg *Config, driver driver, addPkg func(*Package), queries
} }
} }
} }
gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modulesEnabled})
var results []string startWalk := time.Now()
gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modRoot != "", Debug: debug})
if debug {
log.Printf("%v for walk", time.Since(startWalk))
}
// Weird special case: the top-level package in a module will be in
// whatever directory the user checked the repository out into. It's
// more reasonable for that to not match the package name. So, if there
// are any Go files in the mod root, query it just to be safe.
if modRoot != "" {
rel, err := filepath.Rel(cfg.Dir, modRoot)
if err != nil {
panic(err) // See above.
}
files, err := ioutil.ReadDir(modRoot)
for _, f := range files {
if strings.HasSuffix(f.Name(), ".go") {
simpleMatches = append(simpleMatches, rel)
break
}
}
}
addResponse := func(r *driverResponse) { addResponse := func(r *driverResponse) {
for _, pkg := range r.Packages { for _, pkg := range r.Packages {
addPkg(pkg) response.addPackage(pkg)
for _, name := range queries { for _, name := range queries {
if pkg.Name == name { if pkg.Name == name {
results = append(results, pkg.ID) response.addRoot(pkg.ID)
break break
} }
} }
@ -228,7 +332,7 @@ func runNamedQueries(cfg *Config, driver driver, addPkg func(*Package), queries
if len(simpleMatches) != 0 { if len(simpleMatches) != 0 {
resp, err := driver(cfg, simpleMatches...) resp, err := driver(cfg, simpleMatches...)
if err != nil { if err != nil {
return nil, err return err
} }
addResponse(resp) addResponse(resp)
} }
@ -268,60 +372,73 @@ func runNamedQueries(cfg *Config, driver driver, addPkg func(*Package), queries
gomod.WriteString(")\n") gomod.WriteString(")\n")
tmpCfg := *cfg tmpCfg := *cfg
// We're only trying to look at stuff in the module cache, so
// disable the network. This should speed things up, and has
// prevented errors in at least one case, #28518.
tmpCfg.Env = append(append([]string{"GOPROXY=off"}, cfg.Env...))
var err error var err error
tmpCfg.Dir, err = ioutil.TempDir("", "gopackages-modquery") tmpCfg.Dir, err = ioutil.TempDir("", "gopackages-modquery")
if err != nil { if err != nil {
return nil, err return err
} }
defer os.RemoveAll(tmpCfg.Dir) defer os.RemoveAll(tmpCfg.Dir)
if err := ioutil.WriteFile(filepath.Join(tmpCfg.Dir, "go.mod"), gomod.Bytes(), 0777); err != nil { if err := ioutil.WriteFile(filepath.Join(tmpCfg.Dir, "go.mod"), gomod.Bytes(), 0777); err != nil {
return nil, fmt.Errorf("writing go.mod for module cache query: %v", err) return fmt.Errorf("writing go.mod for module cache query: %v", err)
} }
// Run the query, using the import paths calculated from the matches above. // Run the query, using the import paths calculated from the matches above.
resp, err := driver(&tmpCfg, imports...) resp, err := driver(&tmpCfg, imports...)
if err != nil { if err != nil {
return nil, fmt.Errorf("querying module cache matches: %v", err) return fmt.Errorf("querying module cache matches: %v", err)
} }
addResponse(resp) addResponse(resp)
} }
return results, nil return nil
}
func getSizes(cfg *Config) (types.Sizes, error) {
return packagesdriver.GetSizesGolist(cfg.Context, cfg.BuildFlags, cfg.Env, cfg.Dir, usesExportData(cfg))
} }
// roots selects the appropriate paths to walk based on the passed-in configuration, // roots selects the appropriate paths to walk based on the passed-in configuration,
// particularly the environment and the presence of a go.mod in cfg.Dir's parents. // particularly the environment and the presence of a go.mod in cfg.Dir's parents.
func roots(cfg *Config) ([]gopathwalk.Root, bool, error) { func roots(cfg *Config) ([]gopathwalk.Root, string, error) {
stdout, err := invokeGo(cfg, "env", "GOROOT", "GOPATH", "GOMOD") stdout, err := invokeGo(cfg, "env", "GOROOT", "GOPATH", "GOMOD")
if err != nil { if err != nil {
return nil, false, err return nil, "", err
} }
fields := strings.Split(stdout.String(), "\n") fields := strings.Split(stdout.String(), "\n")
if len(fields) != 4 || len(fields[3]) != 0 { if len(fields) != 4 || len(fields[3]) != 0 {
return nil, false, fmt.Errorf("go env returned unexpected output: %q", stdout.String()) return nil, "", fmt.Errorf("go env returned unexpected output: %q", stdout.String())
} }
goroot, gopath, gomod := fields[0], filepath.SplitList(fields[1]), fields[2] goroot, gopath, gomod := fields[0], filepath.SplitList(fields[1]), fields[2]
modsEnabled := gomod != "" var modDir string
if gomod != "" {
modDir = filepath.Dir(gomod)
}
var roots []gopathwalk.Root var roots []gopathwalk.Root
// Always add GOROOT. // Always add GOROOT.
roots = append(roots, gopathwalk.Root{filepath.Join(goroot, "/src"), gopathwalk.RootGOROOT}) roots = append(roots, gopathwalk.Root{filepath.Join(goroot, "/src"), gopathwalk.RootGOROOT})
// If modules are enabled, scan the module dir. // If modules are enabled, scan the module dir.
if modsEnabled { if modDir != "" {
roots = append(roots, gopathwalk.Root{filepath.Dir(gomod), gopathwalk.RootCurrentModule}) roots = append(roots, gopathwalk.Root{modDir, gopathwalk.RootCurrentModule})
} }
// Add either GOPATH/src or GOPATH/pkg/mod, depending on module mode. // Add either GOPATH/src or GOPATH/pkg/mod, depending on module mode.
for _, p := range gopath { for _, p := range gopath {
if modsEnabled { if modDir != "" {
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache}) roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache})
} else { } else {
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/src"), gopathwalk.RootGOPATH}) roots = append(roots, gopathwalk.Root{filepath.Join(p, "/src"), gopathwalk.RootGOPATH})
} }
} }
return roots, modsEnabled, nil return roots, modDir, nil
} }
// These functions were copied from goimports. See further documentation there. // These functions were copied from goimports. See further documentation there.
@ -427,10 +544,10 @@ func otherFiles(p *jsonPackage) [][]string {
return [][]string{p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.SwigFiles, p.SwigCXXFiles, p.SysoFiles} return [][]string{p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.SwigFiles, p.SwigCXXFiles, p.SysoFiles}
} }
// golistDriverCurrent uses the "go list" command to expand the // golistDriver uses the "go list" command to expand the pattern
// pattern words and return metadata for the specified packages. // words and return metadata for the specified packages. dir may be
// dir may be "" and env may be nil, as per os/exec.Command. // "" and env may be nil, as per os/exec.Command.
func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error) { func golistDriver(cfg *Config, words ...string) (*driverResponse, error) {
// go list uses the following identifiers in ImportPath and Imports: // go list uses the following identifiers in ImportPath and Imports:
// //
// "p" -- importable package or main (command) // "p" -- importable package or main (command)
@ -448,6 +565,7 @@ func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error)
if err != nil { if err != nil {
return nil, err return nil, err
} }
seen := make(map[string]*jsonPackage)
// Decode the JSON and convert it to Package form. // Decode the JSON and convert it to Package form.
var response driverResponse var response driverResponse
for dec := json.NewDecoder(buf); dec.More(); { for dec := json.NewDecoder(buf); dec.More(); {
@ -470,6 +588,15 @@ func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error)
return nil, fmt.Errorf("package missing import path: %+v", p) return nil, fmt.Errorf("package missing import path: %+v", p)
} }
if old, found := seen[p.ImportPath]; found {
if !reflect.DeepEqual(p, old) {
return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath)
}
// skip the duplicate
continue
}
seen[p.ImportPath] = p
pkg := &Package{ pkg := &Package{
Name: p.Name, Name: p.Name,
ID: p.ImportPath, ID: p.ImportPath,
@ -478,6 +605,26 @@ func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error)
OtherFiles: absJoin(p.Dir, otherFiles(p)...), OtherFiles: absJoin(p.Dir, otherFiles(p)...),
} }
// Work around https://golang.org/issue/28749:
// cmd/go puts assembly, C, and C++ files in CompiledGoFiles.
// Filter out any elements of CompiledGoFiles that are also in OtherFiles.
// We have to keep this workaround in place until go1.12 is a distant memory.
if len(pkg.OtherFiles) > 0 {
other := make(map[string]bool, len(pkg.OtherFiles))
for _, f := range pkg.OtherFiles {
other[f] = true
}
out := pkg.CompiledGoFiles[:0]
for _, f := range pkg.CompiledGoFiles {
if other[f] {
continue
}
out = append(out, f)
}
pkg.CompiledGoFiles = out
}
// Extract the PkgPath from the package's ID. // Extract the PkgPath from the package's ID.
if i := strings.IndexByte(pkg.ID, ' '); i >= 0 { if i := strings.IndexByte(pkg.ID, ' '); i >= 0 {
pkg.PkgPath = pkg.ID[:i] pkg.PkgPath = pkg.ID[:i]
@ -524,7 +671,9 @@ func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error)
response.Roots = append(response.Roots, pkg.ID) response.Roots = append(response.Roots, pkg.ID)
} }
// TODO(matloob): Temporary hack since CompiledGoFiles isn't always set. // Work around for pre-go.1.11 versions of go list.
// TODO(matloob): they should be handled by the fallback.
// Can we delete this?
if len(pkg.CompiledGoFiles) == 0 { if len(pkg.CompiledGoFiles) == 0 {
pkg.CompiledGoFiles = pkg.GoFiles pkg.CompiledGoFiles = pkg.GoFiles
} }
@ -556,11 +705,16 @@ func absJoin(dir string, fileses ...[]string) (res []string) {
} }
func golistargs(cfg *Config, words []string) []string { func golistargs(cfg *Config, words []string) []string {
const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo
fullargs := []string{ fullargs := []string{
"list", "-e", "-json", "-compiled", "list", "-e", "-json",
fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypesInfo|NeedTypesSizes) != 0),
fmt.Sprintf("-test=%t", cfg.Tests), fmt.Sprintf("-test=%t", cfg.Tests),
fmt.Sprintf("-export=%t", usesExportData(cfg)), fmt.Sprintf("-export=%t", usesExportData(cfg)),
fmt.Sprintf("-deps=%t", cfg.Mode >= LoadImports), fmt.Sprintf("-deps=%t", cfg.Mode&NeedDeps != 0),
// go list doesn't let you pass -test and -find together,
// probably because you'd just get the TestMain.
fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0),
} }
fullargs = append(fullargs, cfg.BuildFlags...) fullargs = append(fullargs, cfg.BuildFlags...)
fullargs = append(fullargs, "--") fullargs = append(fullargs, "--")
@ -583,11 +737,21 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) {
cmd.Dir = cfg.Dir cmd.Dir = cfg.Dir
cmd.Stdout = stdout cmd.Stdout = stdout
cmd.Stderr = stderr cmd.Stderr = stderr
if debug {
defer func(start time.Time) {
log.Printf("%s for %v, stderr: <<%s>>\n", time.Since(start), cmdDebugStr(cmd, args...), stderr)
}(time.Now())
}
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
// Check for 'go' executable not being found.
if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
return nil, fmt.Errorf("'go list' driver requires 'go', but %s", exec.ErrNotFound)
}
exitErr, ok := err.(*exec.ExitError) exitErr, ok := err.(*exec.ExitError)
if !ok { if !ok {
// Catastrophic error: // Catastrophic error:
// - executable not found
// - context cancellation // - context cancellation
return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err) return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err)
} }
@ -597,29 +761,72 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) {
return nil, goTooOldError{fmt.Errorf("unsupported version of go: %s: %s", exitErr, stderr)} return nil, goTooOldError{fmt.Errorf("unsupported version of go: %s: %s", exitErr, stderr)}
} }
// This error only appears in stderr. See golang.org/cl/166398 for a fix in go list to show
// the error in the Err section of stdout in case -e option is provided.
// This fix is provided for backwards compatibility.
if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "named files must be .go files") {
output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`,
strings.Trim(stderr.String(), "\n"))
return bytes.NewBufferString(output), nil
}
// Workaround for #29280: go list -e has incorrect behavior when an ad-hoc package doesn't exist.
if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no such file or directory") {
output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`,
strings.Trim(stderr.String(), "\n"))
return bytes.NewBufferString(output), nil
}
// Export mode entails a build. // Export mode entails a build.
// If that build fails, errors appear on stderr // If that build fails, errors appear on stderr
// (despite the -e flag) and the Export field is blank. // (despite the -e flag) and the Export field is blank.
// Do not fail in that case. // Do not fail in that case.
if !usesExportData(cfg) { // The same is true if an ad-hoc package given to go list doesn't exist.
// TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when
// packages don't exist or a build fails.
if !usesExportData(cfg) && !containsGoFile(args) {
return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr)
} }
} }
// As of writing, go list -export prints some non-fatal compilation // As of writing, go list -export prints some non-fatal compilation
// errors to stderr, even with -e set. We would prefer that it put // errors to stderr, even with -e set. We would prefer that it put
// them in the Package.Error JSON (see http://golang.org/issue/26319). // them in the Package.Error JSON (see https://golang.org/issue/26319).
// In the meantime, there's nowhere good to put them, but they can // In the meantime, there's nowhere good to put them, but they can
// be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS // be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS
// is set. // is set.
if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" { if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" {
fmt.Fprintf(os.Stderr, "go %v stderr: <<%s>>\n", args, stderr) fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd, args...), stderr)
} }
// debugging // debugging
if false { if false {
fmt.Fprintf(os.Stderr, "go %v stdout: <<%s>>\n", args, stdout) fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(cmd, args...), stdout)
} }
return stdout, nil return stdout, nil
} }
func containsGoFile(s []string) bool {
for _, f := range s {
if strings.HasSuffix(f, ".go") {
return true
}
}
return false
}
func cmdDebugStr(cmd *exec.Cmd, args ...string) string {
env := make(map[string]string)
for _, kv := range cmd.Env {
split := strings.Split(kv, "=")
k, v := split[0], split[1]
env[k] = v
}
var quotedArgs []string
for _, arg := range args {
quotedArgs = append(quotedArgs, strconv.Quote(arg))
}
return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %s", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], strings.Join(quotedArgs, " "))
}

View file

@ -1,457 +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.
package packages
import (
"encoding/json"
"fmt"
"go/build"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"golang.org/x/tools/go/internal/cgo"
)
// TODO(matloob): Delete this file once Go 1.12 is released.
// This file provides backwards compatibility support for
// loading for versions of Go earlier than 1.10.4. This support is meant to
// assist with migration to the Package API until there's
// widespread adoption of these newer Go versions.
// This support will be removed once Go 1.12 is released
// in Q1 2019.
func golistDriverFallback(cfg *Config, words ...string) (*driverResponse, error) {
// Turn absolute paths into GOROOT and GOPATH-relative paths to provide to go list.
// This will have surprising behavior if GOROOT or GOPATH contain multiple packages with the same
// path and a user provides an absolute path to a directory that's shadowed by an earlier
// directory in GOROOT or GOPATH with the same package path.
words = cleanAbsPaths(cfg, words)
original, deps, err := getDeps(cfg, words...)
if err != nil {
return nil, err
}
var tmpdir string // used for generated cgo files
var needsTestVariant []struct {
pkg, xtestPkg *Package
}
var response driverResponse
allPkgs := make(map[string]bool)
addPackage := func(p *jsonPackage) {
id := p.ImportPath
if allPkgs[id] {
return
}
allPkgs[id] = true
isRoot := original[id] != nil
pkgpath := id
if pkgpath == "unsafe" {
p.GoFiles = nil // ignore fake unsafe.go file
}
importMap := func(importlist []string) map[string]*Package {
importMap := make(map[string]*Package)
for _, id := range importlist {
if id == "C" {
for _, path := range []string{"unsafe", "syscall", "runtime/cgo"} {
if pkgpath != path && importMap[path] == nil {
importMap[path] = &Package{ID: path}
}
}
continue
}
importMap[vendorlessPath(id)] = &Package{ID: id}
}
return importMap
}
compiledGoFiles := absJoin(p.Dir, p.GoFiles)
// Use a function to simplify control flow. It's just a bunch of gotos.
var cgoErrors []error
var outdir string
getOutdir := func() (string, error) {
if outdir != "" {
return outdir, nil
}
if tmpdir == "" {
if tmpdir, err = ioutil.TempDir("", "gopackages"); err != nil {
return "", err
}
}
// Add a "go-build" component to the path to make the tests think the files are in the cache.
// This allows the same test to test the pre- and post-Go 1.11 go list logic because the Go 1.11
// go list generates test mains in the cache, and the test code knows not to rely on paths in the
// cache to stay stable.
outdir = filepath.Join(tmpdir, "go-build", strings.Replace(p.ImportPath, "/", "_", -1))
if err := os.MkdirAll(outdir, 0755); err != nil {
outdir = ""
return "", err
}
return outdir, nil
}
processCgo := func() bool {
// Suppress any cgo errors. Any relevant errors will show up in typechecking.
// TODO(matloob): Skip running cgo if Mode < LoadTypes.
outdir, err := getOutdir()
if err != nil {
cgoErrors = append(cgoErrors, err)
return false
}
files, _, err := runCgo(p.Dir, outdir, cfg.Env)
if err != nil {
cgoErrors = append(cgoErrors, err)
return false
}
compiledGoFiles = append(compiledGoFiles, files...)
return true
}
if len(p.CgoFiles) == 0 || !processCgo() {
compiledGoFiles = append(compiledGoFiles, absJoin(p.Dir, p.CgoFiles)...) // Punt to typechecker.
}
if isRoot {
response.Roots = append(response.Roots, id)
}
pkg := &Package{
ID: id,
Name: p.Name,
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles),
CompiledGoFiles: compiledGoFiles,
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
PkgPath: pkgpath,
Imports: importMap(p.Imports),
// TODO(matloob): set errors on the Package to cgoErrors
}
if p.Error != nil {
pkg.Errors = append(pkg.Errors, Error{
Pos: p.Error.Pos,
Msg: p.Error.Err,
})
}
response.Packages = append(response.Packages, pkg)
if cfg.Tests && isRoot {
testID := fmt.Sprintf("%s [%s.test]", id, id)
if len(p.TestGoFiles) > 0 || len(p.XTestGoFiles) > 0 {
response.Roots = append(response.Roots, testID)
testPkg := &Package{
ID: testID,
Name: p.Name,
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles, p.TestGoFiles),
CompiledGoFiles: append(compiledGoFiles, absJoin(p.Dir, p.TestGoFiles)...),
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
PkgPath: pkgpath,
Imports: importMap(append(p.Imports, p.TestImports...)),
// TODO(matloob): set errors on the Package to cgoErrors
}
response.Packages = append(response.Packages, testPkg)
var xtestPkg *Package
if len(p.XTestGoFiles) > 0 {
xtestID := fmt.Sprintf("%s_test [%s.test]", id, id)
response.Roots = append(response.Roots, xtestID)
// Generate test variants for all packages q where a path exists
// such that xtestPkg -> ... -> q -> ... -> p (where p is the package under test)
// and rewrite all import map entries of p to point to testPkg (the test variant of
// p), and of each q to point to the test variant of that q.
xtestPkg = &Package{
ID: xtestID,
Name: p.Name + "_test",
GoFiles: absJoin(p.Dir, p.XTestGoFiles),
CompiledGoFiles: absJoin(p.Dir, p.XTestGoFiles),
PkgPath: pkgpath + "_test",
Imports: importMap(p.XTestImports),
}
// Add to list of packages we need to rewrite imports for to refer to test variants.
// We may need to create a test variant of a package that hasn't been loaded yet, so
// the test variants need to be created later.
needsTestVariant = append(needsTestVariant, struct{ pkg, xtestPkg *Package }{pkg, xtestPkg})
response.Packages = append(response.Packages, xtestPkg)
}
// testmain package
testmainID := id + ".test"
response.Roots = append(response.Roots, testmainID)
imports := map[string]*Package{}
imports[testPkg.PkgPath] = &Package{ID: testPkg.ID}
if xtestPkg != nil {
imports[xtestPkg.PkgPath] = &Package{ID: xtestPkg.ID}
}
testmainPkg := &Package{
ID: testmainID,
Name: "main",
PkgPath: testmainID,
Imports: imports,
}
response.Packages = append(response.Packages, testmainPkg)
outdir, err := getOutdir()
if err != nil {
testmainPkg.Errors = append(testmainPkg.Errors, Error{
Pos: "-",
Msg: fmt.Sprintf("failed to generate testmain: %v", err),
Kind: ListError,
})
return
}
testmain := filepath.Join(outdir, "testmain.go")
extraimports, extradeps, err := generateTestmain(testmain, testPkg, xtestPkg)
if err != nil {
testmainPkg.Errors = append(testmainPkg.Errors, Error{
Pos: "-",
Msg: fmt.Sprintf("failed to generate testmain: %v", err),
Kind: ListError,
})
}
deps = append(deps, extradeps...)
for _, imp := range extraimports { // testing, testing/internal/testdeps, and maybe os
imports[imp] = &Package{ID: imp}
}
testmainPkg.GoFiles = []string{testmain}
testmainPkg.CompiledGoFiles = []string{testmain}
}
}
}
for _, pkg := range original {
addPackage(pkg)
}
if cfg.Mode < LoadImports || len(deps) == 0 {
return &response, nil
}
buf, err := invokeGo(cfg, golistArgsFallback(cfg, deps)...)
if err != nil {
return nil, err
}
// Decode the JSON and convert it to Package form.
for dec := json.NewDecoder(buf); dec.More(); {
p := new(jsonPackage)
if err := dec.Decode(p); err != nil {
return nil, fmt.Errorf("JSON decoding failed: %v", err)
}
addPackage(p)
}
for _, v := range needsTestVariant {
createTestVariants(&response, v.pkg, v.xtestPkg)
}
// TODO(matloob): Is this the right ordering?
sort.SliceStable(response.Packages, func(i, j int) bool {
return response.Packages[i].PkgPath < response.Packages[j].PkgPath
})
return &response, nil
}
func createTestVariants(response *driverResponse, pkgUnderTest, xtestPkg *Package) {
allPkgs := make(map[string]*Package)
for _, pkg := range response.Packages {
allPkgs[pkg.ID] = pkg
}
needsTestVariant := make(map[string]bool)
needsTestVariant[pkgUnderTest.ID] = true
var needsVariantRec func(p *Package) bool
needsVariantRec = func(p *Package) bool {
if needsTestVariant[p.ID] {
return true
}
for _, imp := range p.Imports {
if needsVariantRec(allPkgs[imp.ID]) {
// Don't break because we want to make sure all dependencies
// have been processed, and all required test variants of our dependencies
// exist.
needsTestVariant[p.ID] = true
}
}
if !needsTestVariant[p.ID] {
return false
}
// Create a clone of the package. It will share the same strings and lists of source files,
// but that's okay. It's only necessary for the Imports map to have a separate identity.
testVariant := *p
testVariant.ID = fmt.Sprintf("%s [%s.test]", p.ID, pkgUnderTest.ID)
testVariant.Imports = make(map[string]*Package)
for imp, pkg := range p.Imports {
testVariant.Imports[imp] = pkg
if needsTestVariant[pkg.ID] {
testVariant.Imports[imp] = &Package{ID: fmt.Sprintf("%s [%s.test]", pkg.ID, pkgUnderTest.ID)}
}
}
response.Packages = append(response.Packages, &testVariant)
return needsTestVariant[p.ID]
}
// finally, update the xtest package's imports
for imp, pkg := range xtestPkg.Imports {
if allPkgs[pkg.ID] == nil {
fmt.Printf("for %s: package %s doesn't exist\n", xtestPkg.ID, pkg.ID)
}
if needsVariantRec(allPkgs[pkg.ID]) {
xtestPkg.Imports[imp] = &Package{ID: fmt.Sprintf("%s [%s.test]", pkg.ID, pkgUnderTest.ID)}
}
}
}
// cleanAbsPaths replaces all absolute paths with GOPATH- and GOROOT-relative
// paths. If an absolute path is not GOPATH- or GOROOT- relative, it is left as an
// absolute path so an error can be returned later.
func cleanAbsPaths(cfg *Config, words []string) []string {
var searchpaths []string
var cleaned = make([]string, len(words))
for i := range cleaned {
cleaned[i] = words[i]
// Ignore relative directory paths (they must already be goroot-relative) and Go source files
// (absolute source files are already allowed for ad-hoc packages).
// TODO(matloob): Can there be non-.go files in ad-hoc packages.
if !filepath.IsAbs(cleaned[i]) || strings.HasSuffix(cleaned[i], ".go") {
continue
}
// otherwise, it's an absolute path. Search GOPATH and GOROOT to find it.
if searchpaths == nil {
cmd := exec.Command("go", "env", "GOPATH", "GOROOT")
cmd.Env = cfg.Env
out, err := cmd.Output()
if err != nil {
searchpaths = []string{}
continue // suppress the error, it will show up again when running go list
}
lines := strings.Split(string(out), "\n")
if len(lines) != 3 || lines[0] == "" || lines[1] == "" || lines[2] != "" {
continue // suppress error
}
// first line is GOPATH
for _, path := range filepath.SplitList(lines[0]) {
searchpaths = append(searchpaths, filepath.Join(path, "src"))
}
// second line is GOROOT
searchpaths = append(searchpaths, filepath.Join(lines[1], "src"))
}
for _, sp := range searchpaths {
if strings.HasPrefix(cleaned[i], sp) {
cleaned[i] = strings.TrimPrefix(cleaned[i], sp)
cleaned[i] = strings.TrimLeft(cleaned[i], string(filepath.Separator))
}
}
}
return cleaned
}
// vendorlessPath returns the devendorized version of the import path ipath.
// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b".
// Copied from golang.org/x/tools/imports/fix.go.
func vendorlessPath(ipath string) string {
// Devendorize for use in import statement.
if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 {
return ipath[i+len("/vendor/"):]
}
if strings.HasPrefix(ipath, "vendor/") {
return ipath[len("vendor/"):]
}
return ipath
}
// getDeps runs an initial go list to determine all the dependency packages.
func getDeps(cfg *Config, words ...string) (originalSet map[string]*jsonPackage, deps []string, err error) {
buf, err := invokeGo(cfg, golistArgsFallback(cfg, words)...)
if err != nil {
return nil, nil, err
}
depsSet := make(map[string]bool)
originalSet = make(map[string]*jsonPackage)
var testImports []string
// Extract deps from the JSON.
for dec := json.NewDecoder(buf); dec.More(); {
p := new(jsonPackage)
if err := dec.Decode(p); err != nil {
return nil, nil, fmt.Errorf("JSON decoding failed: %v", err)
}
originalSet[p.ImportPath] = p
for _, dep := range p.Deps {
depsSet[dep] = true
}
if cfg.Tests {
// collect the additional imports of the test packages.
pkgTestImports := append(p.TestImports, p.XTestImports...)
for _, imp := range pkgTestImports {
if depsSet[imp] {
continue
}
depsSet[imp] = true
testImports = append(testImports, imp)
}
}
}
// Get the deps of the packages imported by tests.
if len(testImports) > 0 {
buf, err = invokeGo(cfg, golistArgsFallback(cfg, testImports)...)
if err != nil {
return nil, nil, err
}
// Extract deps from the JSON.
for dec := json.NewDecoder(buf); dec.More(); {
p := new(jsonPackage)
if err := dec.Decode(p); err != nil {
return nil, nil, fmt.Errorf("JSON decoding failed: %v", err)
}
for _, dep := range p.Deps {
depsSet[dep] = true
}
}
}
for orig := range originalSet {
delete(depsSet, orig)
}
deps = make([]string, 0, len(depsSet))
for dep := range depsSet {
deps = append(deps, dep)
}
sort.Strings(deps) // ensure output is deterministic
return originalSet, deps, nil
}
func golistArgsFallback(cfg *Config, words []string) []string {
fullargs := []string{"list", "-e", "-json"}
fullargs = append(fullargs, cfg.BuildFlags...)
fullargs = append(fullargs, "--")
fullargs = append(fullargs, words...)
return fullargs
}
func runCgo(pkgdir, tmpdir string, env []string) (files, displayfiles []string, err error) {
// Use go/build to open cgo files and determine the cgo flags, etc, from them.
// This is tricky so it's best to avoid reimplementing as much as we can, and
// we plan to delete this support once Go 1.12 is released anyways.
// TODO(matloob): This isn't completely correct because we're using the Default
// context. Perhaps we should more accurately fill in the context.
bp, err := build.ImportDir(pkgdir, build.ImportMode(0))
if err != nil {
return nil, nil, err
}
for _, ev := range env {
if v := strings.TrimPrefix(ev, "CGO_CPPFLAGS"); v != ev {
bp.CgoCPPFLAGS = append(bp.CgoCPPFLAGS, strings.Fields(v)...)
} else if v := strings.TrimPrefix(ev, "CGO_CFLAGS"); v != ev {
bp.CgoCFLAGS = append(bp.CgoCFLAGS, strings.Fields(v)...)
} else if v := strings.TrimPrefix(ev, "CGO_CXXFLAGS"); v != ev {
bp.CgoCXXFLAGS = append(bp.CgoCXXFLAGS, strings.Fields(v)...)
} else if v := strings.TrimPrefix(ev, "CGO_LDFLAGS"); v != ev {
bp.CgoLDFLAGS = append(bp.CgoLDFLAGS, strings.Fields(v)...)
}
}
return cgo.Run(bp, pkgdir, tmpdir, true)
}

View file

@ -1,318 +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.
// This file is largely based on the Go 1.10-era cmd/go/internal/test/test.go
// testmain generation code.
package packages
import (
"errors"
"fmt"
"go/ast"
"go/doc"
"go/parser"
"go/token"
"os"
"sort"
"strings"
"text/template"
"unicode"
"unicode/utf8"
)
// TODO(matloob): Delete this file once Go 1.12 is released.
// This file complements golist_fallback.go by providing
// support for generating testmains.
func generateTestmain(out string, testPkg, xtestPkg *Package) (extraimports, extradeps []string, err error) {
testFuncs, err := loadTestFuncs(testPkg, xtestPkg)
if err != nil {
return nil, nil, err
}
extraimports = []string{"testing", "testing/internal/testdeps"}
if testFuncs.TestMain == nil {
extraimports = append(extraimports, "os")
}
// Transitive dependencies of ("testing", "testing/internal/testdeps").
// os is part of the transitive closure so it and its transitive dependencies are
// included regardless of whether it's imported in the template below.
extradeps = []string{
"errors",
"internal/cpu",
"unsafe",
"internal/bytealg",
"internal/race",
"runtime/internal/atomic",
"runtime/internal/sys",
"runtime",
"sync/atomic",
"sync",
"io",
"unicode",
"unicode/utf8",
"bytes",
"math",
"syscall",
"time",
"internal/poll",
"internal/syscall/unix",
"internal/testlog",
"os",
"math/bits",
"strconv",
"reflect",
"fmt",
"sort",
"strings",
"flag",
"runtime/debug",
"context",
"runtime/trace",
"testing",
"bufio",
"regexp/syntax",
"regexp",
"compress/flate",
"encoding/binary",
"hash",
"hash/crc32",
"compress/gzip",
"path/filepath",
"io/ioutil",
"text/tabwriter",
"runtime/pprof",
"testing/internal/testdeps",
}
return extraimports, extradeps, writeTestmain(out, testFuncs)
}
// The following is adapted from the cmd/go testmain generation code.
// isTestFunc tells whether fn has the type of a testing function. arg
// specifies the parameter type we look for: B, M or T.
func isTestFunc(fn *ast.FuncDecl, arg string) bool {
if fn.Type.Results != nil && len(fn.Type.Results.List) > 0 ||
fn.Type.Params.List == nil ||
len(fn.Type.Params.List) != 1 ||
len(fn.Type.Params.List[0].Names) > 1 {
return false
}
ptr, ok := fn.Type.Params.List[0].Type.(*ast.StarExpr)
if !ok {
return false
}
// We can't easily check that the type is *testing.M
// because we don't know how testing has been imported,
// but at least check that it's *M or *something.M.
// Same applies for B and T.
if name, ok := ptr.X.(*ast.Ident); ok && name.Name == arg {
return true
}
if sel, ok := ptr.X.(*ast.SelectorExpr); ok && sel.Sel.Name == arg {
return true
}
return false
}
// isTest tells whether name looks like a test (or benchmark, according to prefix).
// It is a Test (say) if there is a character after Test that is not a lower-case letter.
// We don't want TesticularCancer.
func isTest(name, prefix string) bool {
if !strings.HasPrefix(name, prefix) {
return false
}
if len(name) == len(prefix) { // "Test" is ok
return true
}
rune, _ := utf8.DecodeRuneInString(name[len(prefix):])
return !unicode.IsLower(rune)
}
// loadTestFuncs returns the testFuncs describing the tests that will be run.
func loadTestFuncs(ptest, pxtest *Package) (*testFuncs, error) {
t := &testFuncs{
TestPackage: ptest,
XTestPackage: pxtest,
}
for _, file := range ptest.GoFiles {
if !strings.HasSuffix(file, "_test.go") {
continue
}
if err := t.load(file, "_test", &t.ImportTest, &t.NeedTest); err != nil {
return nil, err
}
}
if pxtest != nil {
for _, file := range pxtest.GoFiles {
if err := t.load(file, "_xtest", &t.ImportXtest, &t.NeedXtest); err != nil {
return nil, err
}
}
}
return t, nil
}
// writeTestmain writes the _testmain.go file for t to the file named out.
func writeTestmain(out string, t *testFuncs) error {
f, err := os.Create(out)
if err != nil {
return err
}
defer f.Close()
if err := testmainTmpl.Execute(f, t); err != nil {
return err
}
return nil
}
type testFuncs struct {
Tests []testFunc
Benchmarks []testFunc
Examples []testFunc
TestMain *testFunc
TestPackage *Package
XTestPackage *Package
ImportTest bool
NeedTest bool
ImportXtest bool
NeedXtest bool
}
// Tested returns the name of the package being tested.
func (t *testFuncs) Tested() string {
return t.TestPackage.Name
}
type testFunc struct {
Package string // imported package name (_test or _xtest)
Name string // function name
Output string // output, for examples
Unordered bool // output is allowed to be unordered.
}
func (t *testFuncs) load(filename, pkg string, doImport, seen *bool) error {
var fset = token.NewFileSet()
f, err := parser.ParseFile(fset, filename, nil, parser.ParseComments)
if err != nil {
return errors.New("failed to parse test file " + filename)
}
for _, d := range f.Decls {
n, ok := d.(*ast.FuncDecl)
if !ok {
continue
}
if n.Recv != nil {
continue
}
name := n.Name.String()
switch {
case name == "TestMain":
if isTestFunc(n, "T") {
t.Tests = append(t.Tests, testFunc{pkg, name, "", false})
*doImport, *seen = true, true
continue
}
err := checkTestFunc(fset, n, "M")
if err != nil {
return err
}
if t.TestMain != nil {
return errors.New("multiple definitions of TestMain")
}
t.TestMain = &testFunc{pkg, name, "", false}
*doImport, *seen = true, true
case isTest(name, "Test"):
err := checkTestFunc(fset, n, "T")
if err != nil {
return err
}
t.Tests = append(t.Tests, testFunc{pkg, name, "", false})
*doImport, *seen = true, true
case isTest(name, "Benchmark"):
err := checkTestFunc(fset, n, "B")
if err != nil {
return err
}
t.Benchmarks = append(t.Benchmarks, testFunc{pkg, name, "", false})
*doImport, *seen = true, true
}
}
ex := doc.Examples(f)
sort.Slice(ex, func(i, j int) bool { return ex[i].Order < ex[j].Order })
for _, e := range ex {
*doImport = true // import test file whether executed or not
if e.Output == "" && !e.EmptyOutput {
// Don't run examples with no output.
continue
}
t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output, e.Unordered})
*seen = true
}
return nil
}
func checkTestFunc(fset *token.FileSet, fn *ast.FuncDecl, arg string) error {
if !isTestFunc(fn, arg) {
name := fn.Name.String()
pos := fset.Position(fn.Pos())
return fmt.Errorf("%s: wrong signature for %s, must be: func %s(%s *testing.%s)", pos, name, name, strings.ToLower(arg), arg)
}
return nil
}
var testmainTmpl = template.Must(template.New("main").Parse(`
package main
import (
{{if not .TestMain}}
"os"
{{end}}
"testing"
"testing/internal/testdeps"
{{if .ImportTest}}
{{if .NeedTest}}_test{{else}}_{{end}} {{.TestPackage.PkgPath | printf "%q"}}
{{end}}
{{if .ImportXtest}}
{{if .NeedXtest}}_xtest{{else}}_{{end}} {{.XTestPackage.PkgPath | printf "%q"}}
{{end}}
)
var tests = []testing.InternalTest{
{{range .Tests}}
{"{{.Name}}", {{.Package}}.{{.Name}}},
{{end}}
}
var benchmarks = []testing.InternalBenchmark{
{{range .Benchmarks}}
{"{{.Name}}", {{.Package}}.{{.Name}}},
{{end}}
}
var examples = []testing.InternalExample{
{{range .Examples}}
{"{{.Name}}", {{.Package}}.{{.Name}}, {{.Output | printf "%q"}}, {{.Unordered}}},
{{end}}
}
func init() {
testdeps.ImportPath = {{.TestPackage.PkgPath | printf "%q"}}
}
func main() {
m := testing.MainStart(testdeps.TestDeps{}, tests, benchmarks, examples)
{{with .TestMain}}
{{.Package}}.{{.Name}}(m)
{{else}}
os.Exit(m.Run())
{{end}}
}
`))

View file

@ -19,7 +19,6 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"sync" "sync"
@ -31,35 +30,81 @@ import (
// but may be slower. Load may return more information than requested. // but may be slower. Load may return more information than requested.
type LoadMode int type LoadMode int
const (
// The following constants are used to specify which fields of the Package
// should be filled when loading is done. As a special case to provide
// backwards compatibility, a LoadMode of 0 is equivalent to LoadFiles.
// For all other LoadModes, the bits below specify which fields will be filled
// in the result packages.
// WARNING: This part of the go/packages API is EXPERIMENTAL. It might
// be changed or removed up until April 15 2019. After that date it will
// be frozen.
// TODO(matloob): Remove this comment on April 15.
// ID and Errors (if present) will always be filled.
// NeedName adds Name and PkgPath.
NeedName LoadMode = 1 << iota
// NeedFiles adds GoFiles and OtherFiles.
NeedFiles
// NeedCompiledGoFiles adds CompiledGoFiles.
NeedCompiledGoFiles
// NeedImports adds Imports. If NeedDeps is not set, the Imports field will contain
// "placeholder" Packages with only the ID set.
NeedImports
// NeedDeps adds the fields requested by the LoadMode in the packages in Imports. If NeedImports
// is not set NeedDeps has no effect.
NeedDeps
// NeedExportsFile adds ExportsFile.
NeedExportsFile
// NeedTypes adds Types, Fset, and IllTyped.
NeedTypes
// NeedSyntax adds Syntax.
NeedSyntax
// NeedTypesInfo adds TypesInfo.
NeedTypesInfo
// NeedTypesSizes adds TypesSizes.
NeedTypesSizes
)
const ( const (
// LoadFiles finds the packages and computes their source file lists. // LoadFiles finds the packages and computes their source file lists.
// Package fields: ID, Name, Errors, GoFiles, and OtherFiles. // Package fields: ID, Name, Errors, GoFiles, CompiledGoFiles, and OtherFiles.
LoadFiles LoadMode = iota LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
// LoadImports adds import information for each package // LoadImports adds import information for each package
// and its dependencies. // and its dependencies.
// Package fields added: Imports. // Package fields added: Imports.
LoadImports LoadImports = LoadFiles | NeedImports | NeedDeps
// LoadTypes adds type information for package-level // LoadTypes adds type information for package-level
// declarations in the packages matching the patterns. // declarations in the packages matching the patterns.
// Package fields added: Types, Fset, and IllTyped. // Package fields added: Types, TypesSizes, Fset, and IllTyped.
// This mode uses type information provided by the build system when // This mode uses type information provided by the build system when
// possible, and may fill in the ExportFile field. // possible, and may fill in the ExportFile field.
LoadTypes LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
// LoadSyntax adds typed syntax trees for the packages matching the patterns. // LoadSyntax adds typed syntax trees for the packages matching the patterns.
// Package fields added: Syntax, and TypesInfo, for direct pattern matches only. // Package fields added: Syntax, and TypesInfo, for direct pattern matches only.
LoadSyntax LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
// LoadAllSyntax adds typed syntax trees for the packages matching the patterns // LoadAllSyntax adds typed syntax trees for the packages matching the patterns
// and all dependencies. // and all dependencies.
// Package fields added: Types, Fset, Illtyped, Syntax, and TypesInfo, // Package fields added: Types, Fset, IllTyped, Syntax, and TypesInfo,
// for all packages in the import graph. // for all packages in the import graph.
LoadAllSyntax LoadAllSyntax = LoadSyntax
) )
// An 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.
type Config struct { type Config struct {
@ -92,7 +137,7 @@ type Config struct {
BuildFlags []string BuildFlags []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, the loader will create a new FileSet. // If Fset is nil, Load will use a new fileset, but preserve Fset's value.
Fset *token.FileSet Fset *token.FileSet
// ParseFile is called to read and parse each file // ParseFile is called to read and parse each file
@ -127,9 +172,8 @@ type Config struct {
// If the file with the given path already exists, the parser will use the // If the file with the given path already exists, the parser will use the
// alternative file contents provided by the map. // alternative file contents provided by the map.
// //
// The Package.Imports map may not include packages that are imported only // Overlays provide incomplete support for when a given file doesn't
// by the alternative file contents provided by Overlay. This may cause // already exist on disk. See the package doc above for more details.
// type-checking to fail.
Overlay map[string][]byte Overlay map[string][]byte
} }
@ -139,6 +183,9 @@ type driver func(cfg *Config, patterns ...string) (*driverResponse, error)
// driverResponse contains the results for a driver query. // driverResponse contains the results for a driver query.
type driverResponse struct { type driverResponse struct {
// Sizes, if not nil, is the types.Sizes to use when type checking.
Sizes *types.StdSizes
// Roots is the set of package IDs that make up the root packages. // Roots is the set of package IDs that make up the root packages.
// We have to encode this separately because when we encode a single package // We have to encode this separately because when we encode a single package
// we cannot know if it is one of the roots as that requires knowledge of the // we cannot know if it is one of the roots as that requires knowledge of the
@ -173,6 +220,7 @@ func Load(cfg *Config, patterns ...string) ([]*Package, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
l.sizes = response.Sizes
return l.refine(response.Roots, response.Packages...) return l.refine(response.Roots, response.Packages...)
} }
@ -249,6 +297,9 @@ type Package struct {
// TypesInfo provides type information about the package's syntax trees. // TypesInfo provides type information about the package's syntax trees.
// It is set only when Syntax is set. // It is set only when Syntax is set.
TypesInfo *types.Info TypesInfo *types.Info
// TypesSizes provides the effective size function for types in TypesInfo.
TypesSizes types.Sizes
} }
// 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.
@ -367,7 +418,14 @@ type loaderPackage struct {
type loader struct { type loader struct {
pkgs map[string]*loaderPackage pkgs map[string]*loaderPackage
Config Config
sizes types.Sizes
exportMu sync.Mutex // enforces mutual exclusion of exportdata operations exportMu sync.Mutex // enforces mutual exclusion of exportdata operations
// TODO(matloob): Add an implied mode here and use that instead of mode.
// Implied mode would contain all the fields we need the data for so we can
// get the actually requested fields. We'll zero them out before returning
// packages to the user. This will make it easier for us to get the conditions
// where we need certain modes right.
} }
func newLoader(cfg *Config) *loader { func newLoader(cfg *Config) *loader {
@ -375,6 +433,9 @@ func newLoader(cfg *Config) *loader {
if cfg != nil { if cfg != nil {
ld.Config = *cfg ld.Config = *cfg
} }
if ld.Config.Mode == 0 {
ld.Config.Mode = LoadFiles // Preserve zero behavior of Mode for backwards compatibility.
}
if ld.Config.Env == nil { if ld.Config.Env == nil {
ld.Config.Env = os.Environ() ld.Config.Env = os.Environ()
} }
@ -387,7 +448,7 @@ func newLoader(cfg *Config) *loader {
} }
} }
if ld.Mode >= LoadTypes { if ld.Mode&NeedTypes != 0 {
if ld.Fset == nil { if ld.Fset == nil {
ld.Fset = token.NewFileSet() ld.Fset = token.NewFileSet()
} }
@ -411,28 +472,36 @@ func newLoader(cfg *Config) *loader {
// refine connects the supplied packages into a graph and then adds type and // refine connects the supplied packages into a graph and then adds type and
// and syntax information as requested by the LoadMode. // and syntax information as requested by the LoadMode.
func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
isRoot := make(map[string]bool, len(roots)) rootMap := make(map[string]int, len(roots))
for _, root := range roots { for i, root := range roots {
isRoot[root] = true rootMap[root] = i
} }
ld.pkgs = make(map[string]*loaderPackage) ld.pkgs = make(map[string]*loaderPackage)
// first pass, fixup and build the map and roots // first pass, fixup and build the map and roots
var initial []*loaderPackage var initial = make([]*loaderPackage, len(roots))
for _, pkg := range list { for _, pkg := range list {
rootIndex := -1
if i, found := rootMap[pkg.ID]; found {
rootIndex = i
}
lpkg := &loaderPackage{ lpkg := &loaderPackage{
Package: pkg, Package: pkg,
needtypes: ld.Mode >= LoadAllSyntax || needtypes: (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0,
ld.Mode >= LoadTypes && isRoot[pkg.ID], needsrc: (ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0 ||
needsrc: ld.Mode >= LoadAllSyntax || len(ld.Overlay) > 0 || // Overlays can invalidate export data. TODO(matloob): make this check fine-grained based on dependencies on overlaid files
ld.Mode >= LoadSyntax && isRoot[pkg.ID] ||
pkg.ExportFile == "" && pkg.PkgPath != "unsafe", pkg.ExportFile == "" && pkg.PkgPath != "unsafe",
} }
ld.pkgs[lpkg.ID] = lpkg ld.pkgs[lpkg.ID] = lpkg
if isRoot[lpkg.ID] { if rootIndex >= 0 {
initial = append(initial, lpkg) initial[rootIndex] = lpkg
lpkg.initial = true lpkg.initial = true
} }
} }
for i, root := range roots {
if initial[i] == nil {
return nil, fmt.Errorf("root package %v is missing", root)
}
}
// Materialize the import graph. // Materialize the import graph.
@ -491,14 +560,17 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
if lpkg.needsrc { if lpkg.needsrc {
srcPkgs = append(srcPkgs, lpkg) srcPkgs = append(srcPkgs, lpkg)
} }
if ld.Mode&NeedTypesSizes != 0 {
lpkg.TypesSizes = ld.sizes
}
stack = stack[:len(stack)-1] // pop stack = stack[:len(stack)-1] // pop
lpkg.color = black lpkg.color = black
return lpkg.needsrc return lpkg.needsrc
} }
if ld.Mode < LoadImports { if ld.Mode&(NeedImports|NeedDeps) == 0 {
//we do this to drop the stub import packages that we are not even going to try to resolve // We do this to drop the stub import packages that we are not even going to try to resolve.
for _, lpkg := range initial { for _, lpkg := range initial {
lpkg.Imports = nil lpkg.Imports = nil
} }
@ -508,6 +580,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
visit(lpkg) visit(lpkg)
} }
} }
if ld.Mode&NeedDeps != 0 { // TODO(matloob): This is only the case if NeedTypes is also set, right?
for _, lpkg := range srcPkgs { for _, lpkg := range srcPkgs {
// Complete type information is required for the // Complete type information is required for the
// immediate dependencies of each source package. // immediate dependencies of each source package.
@ -516,9 +589,10 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
imp.needtypes = true imp.needtypes = true
} }
} }
}
// Load type data if needed, starting at // Load type data if needed, starting at
// the initial packages (roots of the import DAG). // the initial packages (roots of the import DAG).
if ld.Mode >= LoadTypes { if ld.Mode&NeedTypes != 0 {
var wg sync.WaitGroup var wg sync.WaitGroup
for _, lpkg := range initial { for _, lpkg := range initial {
wg.Add(1) wg.Add(1)
@ -531,16 +605,61 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
} }
result := make([]*Package, len(initial)) result := make([]*Package, len(initial))
importPlaceholders := make(map[string]*Package)
for i, lpkg := range initial { for i, lpkg := range initial {
result[i] = lpkg.Package result[i] = lpkg.Package
} }
for i := range ld.pkgs {
// Clear all unrequested fields, for extra de-Hyrum-ization.
if ld.Mode&NeedName == 0 {
ld.pkgs[i].Name = ""
ld.pkgs[i].PkgPath = ""
}
if ld.Mode&NeedFiles == 0 {
ld.pkgs[i].GoFiles = nil
ld.pkgs[i].OtherFiles = nil
}
if ld.Mode&NeedCompiledGoFiles == 0 {
ld.pkgs[i].CompiledGoFiles = nil
}
if ld.Mode&NeedImports == 0 {
ld.pkgs[i].Imports = nil
}
if ld.Mode&NeedExportsFile == 0 {
ld.pkgs[i].ExportFile = ""
}
if ld.Mode&NeedTypes == 0 {
ld.pkgs[i].Types = nil
ld.pkgs[i].Fset = nil
ld.pkgs[i].IllTyped = false
}
if ld.Mode&NeedSyntax == 0 {
ld.pkgs[i].Syntax = nil
}
if ld.Mode&NeedTypesInfo == 0 {
ld.pkgs[i].TypesInfo = nil
}
if ld.Mode&NeedTypesSizes == 0 {
ld.pkgs[i].TypesSizes = nil
}
if ld.Mode&NeedDeps == 0 {
for j, pkg := range ld.pkgs[i].Imports {
ph, ok := importPlaceholders[pkg.ID]
if !ok {
ph = &Package{ID: pkg.ID}
importPlaceholders[pkg.ID] = ph
}
ld.pkgs[i].Imports[j] = ph
}
}
}
return result, nil return result, nil
} }
// loadRecursive loads the specified package and its dependencies, // loadRecursive loads the specified package and its dependencies,
// recursively, in parallel, in topological order. // recursively, in parallel, in topological order.
// It is atomic and idempotent. // It is atomic and idempotent.
// Precondition: ld.Mode >= LoadTypes. // Precondition: ld.Mode&NeedTypes.
func (ld *loader) loadRecursive(lpkg *loaderPackage) { func (ld *loader) loadRecursive(lpkg *loaderPackage) {
lpkg.loadOnce.Do(func() { lpkg.loadOnce.Do(func() {
// Load the direct dependencies, in parallel. // Load the direct dependencies, in parallel.
@ -570,6 +689,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
lpkg.Fset = ld.Fset lpkg.Fset = ld.Fset
lpkg.Syntax = []*ast.File{} lpkg.Syntax = []*ast.File{}
lpkg.TypesInfo = new(types.Info) lpkg.TypesInfo = new(types.Info)
lpkg.TypesSizes = ld.sizes
return return
} }
@ -657,6 +777,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
Scopes: make(map[ast.Node]*types.Scope), Scopes: make(map[ast.Node]*types.Scope),
Selections: make(map[*ast.SelectorExpr]*types.Selection), Selections: make(map[*ast.SelectorExpr]*types.Selection),
} }
lpkg.TypesSizes = ld.sizes
importer := importerFunc(func(path string) (*types.Package, error) { importer := importerFunc(func(path string) (*types.Package, error) {
if path == "unsafe" { if path == "unsafe" {
@ -683,17 +804,6 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
panic("unreachable") panic("unreachable")
}) })
// This is only an approximation.
// TODO(adonovan): derive Sizes from the underlying build system.
goarch := runtime.GOARCH
const goarchPrefix = "GOARCH="
for _, e := range ld.Config.Env {
if strings.HasPrefix(e, goarchPrefix) {
goarch = e[len(goarchPrefix):]
}
}
sizes := types.SizesFor("gc", goarch)
// type-check // type-check
tc := &types.Config{ tc := &types.Config{
Importer: importer, Importer: importer,
@ -701,10 +811,10 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
// Type-check bodies of functions only in non-initial packages. // Type-check bodies of functions only in non-initial packages.
// Example: for import graph A->B->C and initial packages {A,C}, // Example: for import graph A->B->C and initial packages {A,C},
// we can ignore function bodies in B. // we can ignore function bodies in B.
IgnoreFuncBodies: ld.Mode < LoadAllSyntax && !lpkg.initial, IgnoreFuncBodies: (ld.Mode&(NeedDeps|NeedTypesInfo) == 0) && !lpkg.initial,
Error: appendError, Error: appendError,
Sizes: sizes, Sizes: ld.sizes,
} }
types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax) types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax)
@ -767,6 +877,11 @@ func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
parsed := make([]*ast.File, n) parsed := make([]*ast.File, n)
errors := make([]error, n) errors := make([]error, n)
for i, file := range filenames { for i, file := range filenames {
if ld.Config.Context.Err() != nil {
parsed[i] = nil
errors[i] = ld.Config.Context.Err()
continue
}
wg.Add(1) wg.Add(1)
go func(i int, filename string) { go func(i int, filename string) {
ioLimit <- true // wait ioLimit <- true // wait
@ -818,7 +933,16 @@ func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
// the same file. // the same file.
// //
func sameFile(x, y string) bool { func sameFile(x, y string) bool {
if filepath.Base(x) == filepath.Base(y) { // (optimisation) if x == y {
// It could be the case that y doesn't exist.
// For instance, it may be an overlay file that
// hasn't been written to disk. To handle that case
// let x == y through. (We added the exact absolute path
// string to the CompiledGoFiles list, so the unwritten
// overlay case implies x==y.)
return true
}
if strings.EqualFold(filepath.Base(x), filepath.Base(y)) { // (optimisation)
if xi, err := os.Stat(x); err == nil { if xi, err := os.Stat(x); err == nil {
if yi, err := os.Stat(y); err == nil { if yi, err := os.Stat(y); err == nil {
return os.SameFile(xi, yi) return os.SameFile(xi, yi)
@ -931,5 +1055,5 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error
} }
func usesExportData(cfg *Config) bool { func usesExportData(cfg *Config) bool {
return LoadTypes <= cfg.Mode && cfg.Mode < LoadAllSyntax return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedTypesInfo == 0
} }

View file

@ -24,7 +24,7 @@ func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) {
for path := range pkg.Imports { for path := range pkg.Imports {
paths = append(paths, path) paths = append(paths, path)
} }
sort.Strings(paths) // for determinism sort.Strings(paths) // Imports is a map, this makes visit stable
for _, path := range paths { for _, path := range paths {
visit(pkg.Imports[path]) visit(pkg.Imports[path])
} }

View file

@ -16,7 +16,12 @@ import (
func direntNamlen(dirent *syscall.Dirent) uint64 { func direntNamlen(dirent *syscall.Dirent) uint64 {
const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name))
nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0]))
nameLen := bytes.IndexByte(nameBuf[:dirent.Reclen-fixedHdr], 0) const nameBufLen = uint16(len(nameBuf))
limit := dirent.Reclen - fixedHdr
if limit > nameBufLen {
limit = nameBufLen
}
nameLen := bytes.IndexByte(nameBuf[:limit], 0)
if nameLen < 0 { if nameLen < 0 {
panic("failed to find terminating 0 byte in dirent") panic("failed to find terminating 0 byte in dirent")
} }

View file

@ -11,12 +11,13 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"go/build" "go/build"
"golang.org/x/tools/internal/fastwalk"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"golang.org/x/tools/internal/fastwalk"
) )
// Options controls the behavior of a Walk call. // Options controls the behavior of a Walk call.
@ -34,6 +35,7 @@ const (
RootGOPATH RootGOPATH
RootCurrentModule RootCurrentModule
RootModuleCache RootModuleCache
RootOther
) )
// A Root is a starting point for a Walk. // A Root is a starting point for a Walk.
@ -43,10 +45,10 @@ type Root struct {
} }
// SrcDirsRoots returns the roots from build.Default.SrcDirs(). Not modules-compatible. // SrcDirsRoots returns the roots from build.Default.SrcDirs(). Not modules-compatible.
func SrcDirsRoots() []Root { func SrcDirsRoots(ctx *build.Context) []Root {
var roots []Root var roots []Root
roots = append(roots, Root{filepath.Join(build.Default.GOROOT, "src"), RootGOROOT}) roots = append(roots, Root{filepath.Join(ctx.GOROOT, "src"), RootGOROOT})
for _, p := range filepath.SplitList(build.Default.GOPATH) { for _, p := range filepath.SplitList(ctx.GOPATH) {
roots = append(roots, Root{filepath.Join(p, "src"), RootGOPATH}) roots = append(roots, Root{filepath.Join(p, "src"), RootGOPATH})
} }
return roots return roots
@ -161,7 +163,7 @@ func (w *walker) shouldSkipDir(fi os.FileInfo) bool {
func (w *walker) walk(path string, typ os.FileMode) error { func (w *walker) walk(path string, typ os.FileMode) error {
dir := filepath.Dir(path) dir := filepath.Dir(path)
if typ.IsRegular() { if typ.IsRegular() {
if dir == w.root.Path { if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) {
// Doesn't make sense to have regular files // Doesn't make sense to have regular files
// directly in your $GOPATH/src or $GOROOT/src. // directly in your $GOPATH/src or $GOROOT/src.
return fastwalk.SkipFiles return fastwalk.SkipFiles
@ -176,7 +178,9 @@ func (w *walker) walk(path string, typ os.FileMode) error {
if typ == os.ModeDir { if typ == os.ModeDir {
base := filepath.Base(path) base := filepath.Base(path)
if base == "" || base[0] == '.' || base[0] == '_' || if base == "" || base[0] == '.' || base[0] == '_' ||
base == "testdata" || (!w.opts.ModulesEnabled && base == "node_modules") { base == "testdata" ||
(w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") ||
(!w.opts.ModulesEnabled && base == "node_modules") {
return filepath.SkipDir return filepath.SkipDir
} }
fi, err := os.Lstat(path) fi, err := os.Lstat(path)

11
vendor/modules.txt vendored
View file

@ -156,7 +156,7 @@ github.com/urfave/cli
github.com/valyala/bytebufferpool github.com/valyala/bytebufferpool
# github.com/valyala/fasttemplate v1.0.1 # github.com/valyala/fasttemplate v1.0.1
github.com/valyala/fasttemplate github.com/valyala/fasttemplate
# golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c # golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd
golang.org/x/crypto/bcrypt golang.org/x/crypto/bcrypt
golang.org/x/crypto/acme/autocert golang.org/x/crypto/acme/autocert
golang.org/x/crypto/blowfish golang.org/x/crypto/blowfish
@ -164,17 +164,17 @@ golang.org/x/crypto/acme
# golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 # golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
golang.org/x/lint/golint golang.org/x/lint/golint
golang.org/x/lint golang.org/x/lint
# golang.org/x/net v0.0.0-20181217023233-e147a9138326 # golang.org/x/net v0.0.0-20190420063019-afa5a82059c6
golang.org/x/net/idna golang.org/x/net/idna
# golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 # golang.org/x/sys v0.0.0-20190422165155-953cdadca894
golang.org/x/sys/unix golang.org/x/sys/unix
# golang.org/x/text v0.3.0 # golang.org/x/text v0.3.0
golang.org/x/text/transform golang.org/x/text/transform
golang.org/x/text/unicode/norm golang.org/x/text/unicode/norm
golang.org/x/text/width
golang.org/x/text/secure/bidirule golang.org/x/text/secure/bidirule
golang.org/x/text/unicode/bidi golang.org/x/text/unicode/bidi
# golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081 golang.org/x/text/width
# golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b
golang.org/x/tools/go/loader golang.org/x/tools/go/loader
golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/gcexportdata
@ -184,6 +184,7 @@ golang.org/x/tools/go/types/typeutil
golang.org/x/tools/go/buildutil golang.org/x/tools/go/buildutil
golang.org/x/tools/go/internal/cgo golang.org/x/tools/go/internal/cgo
golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/gcimporter
golang.org/x/tools/go/internal/packagesdriver
golang.org/x/tools/internal/gopathwalk golang.org/x/tools/internal/gopathwalk
golang.org/x/tools/internal/semver golang.org/x/tools/internal/semver
golang.org/x/tools/internal/fastwalk golang.org/x/tools/internal/fastwalk