Add dependencies for code generator
This commit is contained in:
parent
89c157c63b
commit
3dd1699637
542 changed files with 113723 additions and 190 deletions
1
Makefile
1
Makefile
|
@ -254,4 +254,3 @@ kind-e2e-test:
|
||||||
.PHONE: run-in-docker
|
.PHONE: run-in-docker
|
||||||
run-in-docker:
|
run-in-docker:
|
||||||
# dummy target
|
# dummy target
|
||||||
|
|
||||||
|
|
9
go.mod
9
go.mod
|
@ -19,7 +19,6 @@ require (
|
||||||
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
|
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
|
||||||
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
|
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
|
||||||
github.com/go-openapi/spec v0.19.0 // indirect
|
github.com/go-openapi/spec v0.19.0 // indirect
|
||||||
github.com/gofortune/gofortune v0.0.1-snapshot // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
|
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
|
||||||
github.com/google/gofuzz v1.0.0 // indirect
|
github.com/google/gofuzz v1.0.0 // indirect
|
||||||
github.com/google/uuid v1.0.0
|
github.com/google/uuid v1.0.0
|
||||||
|
@ -56,9 +55,7 @@ require (
|
||||||
github.com/spf13/cobra v0.0.3
|
github.com/spf13/cobra v0.0.3
|
||||||
github.com/spf13/pflag v1.0.3
|
github.com/spf13/pflag v1.0.3
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
|
||||||
github.com/vromero/gofortune v0.0.1-snapshot
|
|
||||||
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272
|
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272
|
||||||
google.golang.org/grpc v1.19.1
|
|
||||||
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
|
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
|
||||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||||
gopkg.in/go-playground/pool.v3 v3.1.1
|
gopkg.in/go-playground/pool.v3 v3.1.1
|
||||||
|
@ -70,6 +67,7 @@ require (
|
||||||
k8s.io/cli-runtime v0.0.0-20190314001948-2899ed30580f
|
k8s.io/cli-runtime v0.0.0-20190314001948-2899ed30580f
|
||||||
k8s.io/client-go v11.0.0+incompatible
|
k8s.io/client-go v11.0.0+incompatible
|
||||||
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90 // indirect
|
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90 // indirect
|
||||||
|
k8s.io/code-generator v0.0.0-00010101000000-000000000000
|
||||||
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc
|
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc
|
||||||
k8s.io/klog v0.3.0
|
k8s.io/klog v0.3.0
|
||||||
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 // indirect
|
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 // indirect
|
||||||
|
@ -79,4 +77,7 @@ require (
|
||||||
sigs.k8s.io/yaml v1.1.0 // indirect
|
sigs.k8s.io/yaml v1.1.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.4.1
|
replace (
|
||||||
|
github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.4.1
|
||||||
|
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190511023357-639c964206c2
|
||||||
|
)
|
||||||
|
|
32
go.sum
32
go.sum
|
@ -10,6 +10,7 @@ git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqbl
|
||||||
github.com/Azure/go-autorest v11.7.1+incompatible h1:M2YZIajBBVekV86x0rr1443Lc1F/Ylxb9w+5EtSyX3Q=
|
github.com/Azure/go-autorest v11.7.1+incompatible h1:M2YZIajBBVekV86x0rr1443Lc1F/Ylxb9w+5EtSyX3Q=
|
||||||
github.com/Azure/go-autorest v11.7.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
github.com/Azure/go-autorest v11.7.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
|
github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
|
||||||
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||||
|
@ -72,8 +73,7 @@ github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsd
|
||||||
github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
|
github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
|
||||||
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/gofortune/gofortune v0.0.1-snapshot h1:0unUpPzS0PAdMrOvLAhmeaGtFlUPYv5aXUD/9XN5X9U=
|
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gofortune/gofortune v0.0.1-snapshot/go.mod h1:gzHWMyrWq6g1heq6667VSJTUxWXv+9mTry2HjUnEVB4=
|
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI=
|
github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI=
|
||||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
@ -213,6 +213,7 @@ github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R
|
||||||
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb h1:LvNCMEj0FFZQYsxZb7o3xQPrtqOOB6lrTUOWshC+ZTs=
|
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb h1:LvNCMEj0FFZQYsxZb7o3xQPrtqOOB6lrTUOWshC+ZTs=
|
||||||
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
|
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
|
||||||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||||
|
@ -227,6 +228,7 @@ github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
|
||||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
|
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||||
|
@ -236,8 +238,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
||||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8=
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8=
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||||
github.com/vromero/gofortune v0.0.1-snapshot h1:+IDjezRGmRO1Mdm1Oh+DguaSkxjRpoevWlpdTSlwPkw=
|
|
||||||
github.com/vromero/gofortune v0.0.1-snapshot/go.mod h1:t8EOM3RyBWLevtrXkmQtfAMmH5CU3/YcnpG5RZ/GQXQ=
|
|
||||||
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272 h1:scDk3LAM8x+NPuywVGC0q0/G+5Ed8M0+YXecz4XnWRM=
|
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272 h1:scDk3LAM8x+NPuywVGC0q0/G+5Ed8M0+YXecz4XnWRM=
|
||||||
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272/go.mod h1:KNkcm66cr4ilOiEcjydK+tc2ShPUhqmuoXCljXUBPu8=
|
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272/go.mod h1:KNkcm66cr4ilOiEcjydK+tc2ShPUhqmuoXCljXUBPu8=
|
||||||
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||||
|
@ -255,11 +255,16 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495 h1:I6A9Ag9FpEKOjcKrRNjQkPHawoXIhKyTGfvvjFAiiAk=
|
||||||
|
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
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/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
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=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
@ -295,6 +300,8 @@ golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313 h1:pczuHS43Cp2ktBEEmLwScxgjWsBSzdaQiKzUyf3DTTc=
|
||||||
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
@ -304,9 +311,17 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
|
||||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 h1:OB/uP/Puiu5vS5QMRPrXCDWUPb+kt8f1KW8oQzFejQw=
|
||||||
|
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
|
||||||
|
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||||
|
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts=
|
||||||
|
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
|
||||||
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||||
|
@ -373,8 +388,12 @@ k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwn
|
||||||
k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
|
k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
|
||||||
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90 h1:FI7cwUSbHsDhcpEI8f9YYZinBEEJio7TSfI7BBIQ89g=
|
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90 h1:FI7cwUSbHsDhcpEI8f9YYZinBEEJio7TSfI7BBIQ89g=
|
||||||
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90/go.mod h1:LlIffnLBu+GG7d4ppPzC8UnA1Ex8S+ntmSRVsnr7Xy4=
|
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90/go.mod h1:LlIffnLBu+GG7d4ppPzC8UnA1Ex8S+ntmSRVsnr7Xy4=
|
||||||
|
k8s.io/code-generator v0.0.0-20190511023357-639c964206c2 h1:wfF2JZb8Bl68FNMg/BAkIkkE29Z/bXWBYTtoQh/Cbo0=
|
||||||
|
k8s.io/code-generator v0.0.0-20190511023357-639c964206c2/go.mod h1:YMQ7Lt97nW/I6nHACDccgS/sPAyrHQNans96RwPaSb8=
|
||||||
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc h1:wECJj/THUnRfyHajZrU4SmU2EIrSAHb3S9d2jTItVmo=
|
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc h1:wECJj/THUnRfyHajZrU4SmU2EIrSAHb3S9d2jTItVmo=
|
||||||
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc/go.mod h1:DMaomcf3j3MM2j1FsvlLVVlc7wA2jPytEur3cP9zRxQ=
|
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc/go.mod h1:DMaomcf3j3MM2j1FsvlLVVlc7wA2jPytEur3cP9zRxQ=
|
||||||
|
k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af h1:SwjZbO0u5ZuaV6TRMWOGB40iaycX8sbdMQHtjNZ19dk=
|
||||||
|
k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||||
k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE=
|
k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE=
|
||||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||||
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 h1:fq0ZXW/BAIFZH+dazlups6JTVdwzRo5d9riFA103yuQ=
|
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 h1:fq0ZXW/BAIFZH+dazlups6JTVdwzRo5d9riFA103yuQ=
|
||||||
|
@ -383,6 +402,11 @@ k8s.io/kubernetes v1.14.1 h1:I9F52h5sqVxBmoSsBlNQ0YygNcukDilkpGxUbJRoBoY=
|
||||||
k8s.io/kubernetes v1.14.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
k8s.io/kubernetes v1.14.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||||
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=
|
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=
|
||||||
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
|
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
|
||||||
|
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
||||||
|
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||||
|
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||||
|
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||||
|
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
|
||||||
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
|
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
|
||||||
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
||||||
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
|
||||||
|
|
|
@ -139,6 +139,7 @@ skipped_dirs = [
|
||||||
'.git',
|
'.git',
|
||||||
"vendor",
|
"vendor",
|
||||||
"test/e2e/framework/framework.go",
|
"test/e2e/framework/framework.go",
|
||||||
|
"images"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
25
hack/tools.go
Normal file
25
hack/tools.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// +build tools
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package contains code generation utilities
|
||||||
|
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
|
||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "k8s.io/code-generator"
|
||||||
|
)
|
|
@ -29,6 +29,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
|
||||||
# k8s.io/ingress-nginx/pkg/client k8s.io/ingress-nginx/pkg/apis \
|
# k8s.io/ingress-nginx/pkg/client k8s.io/ingress-nginx/pkg/apis \
|
||||||
# nginxingress:v1alpha1 \
|
# nginxingress:v1alpha1 \
|
||||||
# --output-base "$(dirname ${BASH_SOURCE})/../../.."
|
# --output-base "$(dirname ${BASH_SOURCE})/../../.."
|
||||||
|
mkdir -p ${CODEGEN_PKG}/hack
|
||||||
|
cp ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt ${CODEGEN_PKG}/hack/boilerplate.go.txt
|
||||||
|
|
||||||
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
|
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
|
||||||
k8s.io/ingress-nginx/internal k8s.io/ingress-nginx/internal \
|
k8s.io/ingress-nginx/internal k8s.io/ingress-nginx/internal \
|
||||||
|
|
|
@ -23,7 +23,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
GOLINT=${GOLINT:-"golint"}
|
GOLINT=${GOLINT:-"golint"}
|
||||||
PACKAGES=($(go list ./... | grep -v /vendor/))
|
PACKAGES=($(go list ./internal/... | grep -v /vendor/))
|
||||||
bad_files=()
|
bad_files=()
|
||||||
for package in "${PACKAGES[@]}"; do
|
for package in "${PACKAGES[@]}"; do
|
||||||
out=$("${GOLINT}" -min_confidence=0.9 "${package}" | grep -v -E '(should not use dot imports|internal/file/bindata.go)' || :)
|
out=$("${GOLINT}" -min_confidence=0.9 "${package}" | grep -v -E '(should not use dot imports|internal/file/bindata.go)' || :)
|
||||||
|
|
|
@ -3,4 +3,4 @@ apiVersion: kind.sigs.k8s.io/v1alpha2
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
- role: worker
|
- role: worker
|
||||||
replicas: 3
|
replicas: 2
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
4
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
|
@ -207,8 +207,6 @@ esac
|
||||||
esac
|
esac
|
||||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||||
if [ -n "$mktypes" ]; then
|
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
|
||||||
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
|
|
||||||
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
||||||
fi
|
|
||||||
) | $run
|
) | $run
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
|
@ -192,6 +192,7 @@ struct ltchars {
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <linux/if_addr.h>
|
#include <linux/if_addr.h>
|
||||||
#include <linux/falloc.h>
|
#include <linux/falloc.h>
|
||||||
|
#include <linux/fanotify.h>
|
||||||
#include <linux/filter.h>
|
#include <linux/filter.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
|
@ -501,6 +502,7 @@ ccflags="$@"
|
||||||
$2 !~ "WMESGLEN" &&
|
$2 !~ "WMESGLEN" &&
|
||||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||||
$2 ~/^PPPIOC/ ||
|
$2 ~/^PPPIOC/ ||
|
||||||
|
$2 ~ /^FAN_|FANOTIFY_/ ||
|
||||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
$2 ~ /^__WCOREFLAG$/ {next}
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
2
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
|
@ -228,7 +228,7 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
}
|
}
|
||||||
} else if p.Type == "int64" && endianness != "" {
|
} else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" {
|
||||||
if len(args)%2 == 1 && *arm {
|
if len(args)%2 == 1 && *arm {
|
||||||
// arm abi specifies 64-bit argument uses
|
// arm abi specifies 64-bit argument uses
|
||||||
// (even, odd) pair
|
// (even, odd) pair
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
4
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
|
@ -25,8 +25,8 @@ func cmsgAlignOf(salen int) int {
|
||||||
if SizeofPtr == 8 {
|
if SizeofPtr == 8 {
|
||||||
salign = 4
|
salign = 4
|
||||||
}
|
}
|
||||||
case "openbsd":
|
case "netbsd", "openbsd":
|
||||||
// OpenBSD armv7 requires 64-bit alignment.
|
// NetBSD and OpenBSD armv7 require 64-bit alignment.
|
||||||
if runtime.GOARCH == "arm" {
|
if runtime.GOARCH == "arm" {
|
||||||
salign = 8
|
salign = 8
|
||||||
}
|
}
|
||||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
|
@ -545,3 +545,5 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
|
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
|
||||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||||
|
|
||||||
|
//sys Getsystemcfg(label int) (n uint64)
|
||||||
|
|
54
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
54
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
@ -39,6 +39,20 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
|
||||||
|
//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
|
||||||
|
|
||||||
|
func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (err error) {
|
||||||
|
if pathname == "" {
|
||||||
|
return fanotifyMark(fd, flags, mask, dirFd, nil)
|
||||||
|
}
|
||||||
|
p, err := BytePtrFromString(pathname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fanotifyMark(fd, flags, mask, dirFd, p)
|
||||||
|
}
|
||||||
|
|
||||||
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
||||||
|
|
||||||
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
|
@ -990,10 +1004,50 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
return string(buf[:vallen-1]), nil
|
return string(buf[:vallen-1]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
|
||||||
|
var value TpacketStats
|
||||||
|
vallen := _Socklen(SizeofTpacketStats)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptTpacketStatsV3(fd, level, opt int) (*TpacketStatsV3, error) {
|
||||||
|
var value TpacketStatsV3
|
||||||
|
vallen := _Socklen(SizeofTpacketStatsV3)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a
|
||||||
|
// socket to filter incoming packets. See 'man 7 socket' for usage information.
|
||||||
|
func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error {
|
||||||
|
var p unsafe.Pointer
|
||||||
|
if len(filter) > 0 {
|
||||||
|
p = unsafe.Pointer(&filter[0])
|
||||||
|
}
|
||||||
|
return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptTpacketReq(fd, level, opt int, tp *TpacketReq) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||||
|
}
|
||||||
|
|
||||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||||
|
|
||||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||||
|
|
6
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
6
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
|
@ -19,12 +19,18 @@ func setTimeval(sec, usec int64) Timeval {
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sysnb pipe(p *[2]_C_int) (err error)
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
var pp [2]_C_int
|
||||||
|
// Try pipe2 first for Android O, then try pipe for kernel 2.6.23.
|
||||||
err = pipe2(&pp, 0)
|
err = pipe2(&pp, 0)
|
||||||
|
if err == ENOSYS {
|
||||||
|
err = pipe(&pp)
|
||||||
|
}
|
||||||
p[0] = int(pp[0])
|
p[0] = int(pp[0])
|
||||||
p[1] = int(pp[1])
|
p[1] = int(pp[1])
|
||||||
return
|
return
|
||||||
|
|
13
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
13
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
|
@ -208,3 +208,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return ppoll(&fds[0], len(fds), ts, nil)
|
return ppoll(&fds[0], len(fds), ts, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
13
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
13
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
|
@ -211,3 +211,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
||||||
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
37
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
37
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
|
@ -28,6 +28,11 @@ var (
|
||||||
errENOENT error = syscall.ENOENT
|
errENOENT error = syscall.ENOENT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
signalNameMapOnce sync.Once
|
||||||
|
signalNameMap map[string]syscall.Signal
|
||||||
|
)
|
||||||
|
|
||||||
// errnoErr returns common boxed Errno values, to prevent
|
// errnoErr returns common boxed Errno values, to prevent
|
||||||
// allocations at runtime.
|
// allocations at runtime.
|
||||||
func errnoErr(e syscall.Errno) error {
|
func errnoErr(e syscall.Errno) error {
|
||||||
|
@ -66,6 +71,19 @@ func SignalName(s syscall.Signal) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignalNum returns the syscall.Signal for signal named s,
|
||||||
|
// or 0 if a signal with such name is not found.
|
||||||
|
// The signal name should start with "SIG".
|
||||||
|
func SignalNum(s string) syscall.Signal {
|
||||||
|
signalNameMapOnce.Do(func() {
|
||||||
|
signalNameMap = make(map[string]syscall.Signal)
|
||||||
|
for _, signal := range signalList {
|
||||||
|
signalNameMap[signal.name] = signal.num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return signalNameMap[s]
|
||||||
|
}
|
||||||
|
|
||||||
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
||||||
func clen(n []byte) int {
|
func clen(n []byte) int {
|
||||||
i := bytes.IndexByte(n, 0)
|
i := bytes.IndexByte(n, 0)
|
||||||
|
@ -377,3 +395,22 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
|
||||||
func Exec(argv0 string, argv []string, envv []string) error {
|
func Exec(argv0 string, argv []string, envv []string) error {
|
||||||
return syscall.Exec(argv0, argv, envv)
|
return syscall.Exec(argv0, argv, envv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lutimes sets the access and modification times tv on path. If path refers to
|
||||||
|
// a symlink, it is not dereferenced and the timestamps are set on the symlink.
|
||||||
|
// If tv is nil, the access and modification times are set to the current time.
|
||||||
|
// Otherwise tv must contain exactly 2 elements, with access time as the first
|
||||||
|
// element and modification time as the second element.
|
||||||
|
func Lutimes(path string, tv []Timeval) error {
|
||||||
|
if tv == nil {
|
||||||
|
return UtimesNanoAt(AT_FDCWD, path, nil, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
if len(tv) != 2 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
ts := []Timespec{
|
||||||
|
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||||
|
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||||
|
}
|
||||||
|
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80041270
|
BLKBSZGET = 0x80041270
|
||||||
BLKBSZSET = 0x40041271
|
BLKBSZSET = 0x40041271
|
||||||
|
@ -486,6 +487,50 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
|
@ -493,6 +538,7 @@ const (
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
FP_XSTATE_MAGIC2 = 0x46505845
|
FP_XSTATE_MAGIC2 = 0x46505845
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -514,7 +560,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1134,7 +1180,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1398,6 +1444,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2232,6 +2284,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80081270
|
BLKBSZGET = 0x80081270
|
||||||
BLKBSZSET = 0x40081271
|
BLKBSZSET = 0x40081271
|
||||||
|
@ -486,6 +487,50 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
|
@ -493,6 +538,7 @@ const (
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
FP_XSTATE_MAGIC2 = 0x46505845
|
FP_XSTATE_MAGIC2 = 0x46505845
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -514,7 +560,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1134,7 +1180,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1398,6 +1444,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2233,6 +2285,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80041270
|
BLKBSZGET = 0x80041270
|
||||||
BLKBSZSET = 0x40041271
|
BLKBSZSET = 0x40041271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2239,6 +2291,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80081270
|
BLKBSZGET = 0x80081270
|
||||||
BLKBSZSET = 0x40081271
|
BLKBSZSET = 0x40081271
|
||||||
|
@ -488,6 +489,50 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
|
@ -495,6 +540,7 @@ const (
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
FPSIMD_MAGIC = 0x46508001
|
FPSIMD_MAGIC = 0x46508001
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -516,7 +562,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1135,7 +1181,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1399,6 +1445,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2224,6 +2276,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40041270
|
BLKBSZGET = 0x40041270
|
||||||
BLKBSZSET = 0x80041271
|
BLKBSZSET = 0x80041271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x2000
|
FLUSHO = 0x2000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2234,6 +2286,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40081270
|
BLKBSZGET = 0x40081270
|
||||||
BLKBSZSET = 0x80081271
|
BLKBSZSET = 0x80081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x2000
|
FLUSHO = 0x2000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2234,6 +2286,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40081270
|
BLKBSZGET = 0x40081270
|
||||||
BLKBSZSET = 0x80081271
|
BLKBSZSET = 0x80081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x2000
|
FLUSHO = 0x2000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2234,6 +2286,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40041270
|
BLKBSZGET = 0x40041270
|
||||||
BLKBSZSET = 0x80041271
|
BLKBSZSET = 0x80041271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x2000
|
FLUSHO = 0x2000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2234,6 +2286,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40081270
|
BLKBSZGET = 0x40081270
|
||||||
BLKBSZSET = 0x80081271
|
BLKBSZSET = 0x80081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x4000
|
FF1 = 0x4000
|
||||||
FFDLY = 0x4000
|
FFDLY = 0x4000
|
||||||
FLUSHO = 0x800000
|
FLUSHO = 0x800000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1131,7 +1177,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1398,6 +1444,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2294,6 +2346,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40081270
|
BLKBSZGET = 0x40081270
|
||||||
BLKBSZSET = 0x80081271
|
BLKBSZSET = 0x80081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x4000
|
FF1 = 0x4000
|
||||||
FFDLY = 0x4000
|
FFDLY = 0x4000
|
||||||
FLUSHO = 0x800000
|
FLUSHO = 0x800000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1131,7 +1177,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1398,6 +1444,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2294,6 +2346,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80081270
|
BLKBSZGET = 0x80081270
|
||||||
BLKBSZSET = 0x40081271
|
BLKBSZSET = 0x40081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2220,6 +2272,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
|
@ -174,6 +174,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x80081270
|
BLKBSZGET = 0x80081270
|
||||||
BLKBSZSET = 0x40081271
|
BLKBSZSET = 0x40081271
|
||||||
|
@ -486,12 +487,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -513,7 +559,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1132,7 +1178,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1396,6 +1442,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2293,6 +2345,7 @@ const (
|
||||||
TUNGETVNETBE = 0x800454df
|
TUNGETVNETBE = 0x800454df
|
||||||
TUNGETVNETHDRSZ = 0x800454d7
|
TUNGETVNETHDRSZ = 0x800454d7
|
||||||
TUNGETVNETLE = 0x800454dd
|
TUNGETVNETLE = 0x800454dd
|
||||||
|
TUNSETCARRIER = 0x400454e2
|
||||||
TUNSETDEBUG = 0x400454c9
|
TUNSETDEBUG = 0x400454c9
|
||||||
TUNSETFILTEREBPF = 0x800454e1
|
TUNSETFILTEREBPF = 0x800454e1
|
||||||
TUNSETGROUP = 0x400454ce
|
TUNSETGROUP = 0x400454ce
|
||||||
|
|
57
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
57
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
|
@ -177,6 +177,7 @@ const (
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BALLOON_KVM_MAGIC = 0x13661366
|
BALLOON_KVM_MAGIC = 0x13661366
|
||||||
BDEVFS_MAGIC = 0x62646576
|
BDEVFS_MAGIC = 0x62646576
|
||||||
|
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
|
||||||
BINFMTFS_MAGIC = 0x42494e4d
|
BINFMTFS_MAGIC = 0x42494e4d
|
||||||
BLKBSZGET = 0x40081270
|
BLKBSZGET = 0x40081270
|
||||||
BLKBSZSET = 0x80081271
|
BLKBSZSET = 0x80081271
|
||||||
|
@ -490,12 +491,57 @@ const (
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
FALLOC_FL_PUNCH_HOLE = 0x2
|
||||||
FALLOC_FL_UNSHARE_RANGE = 0x40
|
FALLOC_FL_UNSHARE_RANGE = 0x40
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
FALLOC_FL_ZERO_RANGE = 0x10
|
||||||
|
FANOTIFY_METADATA_VERSION = 0x3
|
||||||
|
FAN_ACCESS = 0x1
|
||||||
|
FAN_ACCESS_PERM = 0x20000
|
||||||
|
FAN_ALLOW = 0x1
|
||||||
|
FAN_ALL_CLASS_BITS = 0xc
|
||||||
|
FAN_ALL_EVENTS = 0x3b
|
||||||
|
FAN_ALL_INIT_FLAGS = 0x3f
|
||||||
|
FAN_ALL_MARK_FLAGS = 0xff
|
||||||
|
FAN_ALL_OUTGOING_EVENTS = 0x3403b
|
||||||
|
FAN_ALL_PERM_EVENTS = 0x30000
|
||||||
|
FAN_AUDIT = 0x10
|
||||||
|
FAN_CLASS_CONTENT = 0x4
|
||||||
|
FAN_CLASS_NOTIF = 0x0
|
||||||
|
FAN_CLASS_PRE_CONTENT = 0x8
|
||||||
|
FAN_CLOEXEC = 0x1
|
||||||
|
FAN_CLOSE = 0x18
|
||||||
|
FAN_CLOSE_NOWRITE = 0x10
|
||||||
|
FAN_CLOSE_WRITE = 0x8
|
||||||
|
FAN_DENY = 0x2
|
||||||
|
FAN_ENABLE_AUDIT = 0x40
|
||||||
|
FAN_EVENT_METADATA_LEN = 0x18
|
||||||
|
FAN_EVENT_ON_CHILD = 0x8000000
|
||||||
|
FAN_MARK_ADD = 0x1
|
||||||
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
|
FAN_MARK_FLUSH = 0x80
|
||||||
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
|
||||||
|
FAN_MARK_INODE = 0x0
|
||||||
|
FAN_MARK_MOUNT = 0x10
|
||||||
|
FAN_MARK_ONLYDIR = 0x8
|
||||||
|
FAN_MARK_REMOVE = 0x2
|
||||||
|
FAN_MODIFY = 0x2
|
||||||
|
FAN_NOFD = -0x1
|
||||||
|
FAN_NONBLOCK = 0x2
|
||||||
|
FAN_ONDIR = 0x40000000
|
||||||
|
FAN_OPEN = 0x20
|
||||||
|
FAN_OPEN_EXEC = 0x1000
|
||||||
|
FAN_OPEN_EXEC_PERM = 0x40000
|
||||||
|
FAN_OPEN_PERM = 0x10000
|
||||||
|
FAN_Q_OVERFLOW = 0x4000
|
||||||
|
FAN_REPORT_TID = 0x100
|
||||||
|
FAN_UNLIMITED_MARKS = 0x20
|
||||||
|
FAN_UNLIMITED_QUEUE = 0x10
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
FF1 = 0x8000
|
FF1 = 0x8000
|
||||||
FFDLY = 0x8000
|
FFDLY = 0x8000
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
|
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
|
||||||
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
|
||||||
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
|
||||||
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
|
||||||
|
@ -517,7 +563,7 @@ const (
|
||||||
FS_POLICY_FLAGS_PAD_4 = 0x0
|
FS_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
FS_POLICY_FLAGS_PAD_8 = 0x1
|
FS_POLICY_FLAGS_PAD_8 = 0x1
|
||||||
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
FS_POLICY_FLAGS_PAD_MASK = 0x3
|
||||||
FS_POLICY_FLAGS_VALID = 0x3
|
FS_POLICY_FLAGS_VALID = 0x7
|
||||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||||
F_ADD_SEALS = 0x409
|
F_ADD_SEALS = 0x409
|
||||||
F_DUPFD = 0x0
|
F_DUPFD = 0x0
|
||||||
|
@ -1136,7 +1182,7 @@ const (
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
NETNSA_MAX = 0x3
|
NETNSA_MAX = 0x5
|
||||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||||
NFNETLINK_V0 = 0x0
|
NFNETLINK_V0 = 0x0
|
||||||
NFNLGRP_ACCT_QUOTA = 0x8
|
NFNLGRP_ACCT_QUOTA = 0x8
|
||||||
|
@ -1400,6 +1446,12 @@ const (
|
||||||
PR_MCE_KILL_SET = 0x1
|
PR_MCE_KILL_SET = 0x1
|
||||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||||
|
PR_PAC_APDAKEY = 0x4
|
||||||
|
PR_PAC_APDBKEY = 0x8
|
||||||
|
PR_PAC_APGAKEY = 0x10
|
||||||
|
PR_PAC_APIAKEY = 0x1
|
||||||
|
PR_PAC_APIBKEY = 0x2
|
||||||
|
PR_PAC_RESET_KEYS = 0x36
|
||||||
PR_SET_CHILD_SUBREAPER = 0x24
|
PR_SET_CHILD_SUBREAPER = 0x24
|
||||||
PR_SET_DUMPABLE = 0x4
|
PR_SET_DUMPABLE = 0x4
|
||||||
PR_SET_ENDIAN = 0x14
|
PR_SET_ENDIAN = 0x14
|
||||||
|
@ -2282,6 +2334,7 @@ const (
|
||||||
TUNGETVNETBE = 0x400454df
|
TUNGETVNETBE = 0x400454df
|
||||||
TUNGETVNETHDRSZ = 0x400454d7
|
TUNGETVNETHDRSZ = 0x400454d7
|
||||||
TUNGETVNETLE = 0x400454dd
|
TUNGETVNETLE = 0x400454dd
|
||||||
|
TUNSETCARRIER = 0x800454e2
|
||||||
TUNSETDEBUG = 0x800454c9
|
TUNSETDEBUG = 0x800454c9
|
||||||
TUNSETFILTEREBPF = 0x400454e1
|
TUNSETFILTEREBPF = 0x400454e1
|
||||||
TUNSETGROUP = 0x800454ce
|
TUNSETGROUP = 0x800454ce
|
||||||
|
|
8
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go
generated
vendored
8
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go
generated
vendored
|
@ -1367,6 +1367,14 @@ 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, _ := callgetsystemcfg(label)
|
||||||
|
n = uint64(r0)
|
||||||
|
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 {
|
||||||
|
|
10
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
generated
vendored
10
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
generated
vendored
|
@ -120,6 +120,7 @@ import (
|
||||||
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.a/shr_64.o"
|
||||||
//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_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"
|
||||||
|
@ -235,6 +236,7 @@ import (
|
||||||
//go:linkname libc_gettimeofday libc_gettimeofday
|
//go:linkname libc_gettimeofday libc_gettimeofday
|
||||||
//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_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
|
||||||
|
@ -353,6 +355,7 @@ var (
|
||||||
libc_gettimeofday,
|
libc_gettimeofday,
|
||||||
libc_time,
|
libc_time,
|
||||||
libc_utime,
|
libc_utime,
|
||||||
|
libc_getsystemcfg,
|
||||||
libc_getrlimit,
|
libc_getrlimit,
|
||||||
libc_setrlimit,
|
libc_setrlimit,
|
||||||
libc_lseek,
|
libc_lseek,
|
||||||
|
@ -1135,6 +1138,13 @@ func callutime(_p0 uintptr, buf uintptr) (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 callgetsystemcfg(label int) (r1 uintptr, e1 Errno) {
|
||||||
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 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
|
||||||
|
|
9
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go
generated
vendored
9
vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go
generated
vendored
|
@ -118,6 +118,7 @@ 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 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);
|
||||||
|
@ -1011,6 +1012,14 @@ func callutime(_p0 uintptr, buf uintptr) (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 callgetsystemcfg(label int) (r1 uintptr, e1 Errno) {
|
||||||
|
r1 = uintptr(C.getsystemcfg(C.int(label)))
|
||||||
|
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()
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
31
vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
generated
vendored
31
vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1658,6 +1679,16 @@ 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 pipe(p *[2]_C_int) (err error) {
|
||||||
|
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func pipe2(p *[2]_C_int, flags int) (err error) {
|
func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||||
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
36
vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
generated
vendored
36
vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -2206,3 +2227,18 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(cmdline)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask>>32), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
36
vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
generated
vendored
36
vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -2186,3 +2207,18 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(cmdline)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
21
vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
generated
vendored
21
vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
generated
vendored
|
@ -14,6 +14,27 @@ var _ syscall.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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
|
@ -285,4 +285,5 @@ const (
|
||||||
SYS_STATX = 291
|
SYS_STATX = 291
|
||||||
SYS_IO_PGETEVENTS = 292
|
SYS_IO_PGETEVENTS = 292
|
||||||
SYS_RSEQ = 293
|
SYS_RSEQ = 293
|
||||||
|
SYS_KEXEC_FILE_LOAD = 294
|
||||||
)
|
)
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
|
@ -284,4 +284,5 @@ const (
|
||||||
SYS_STATX = 291
|
SYS_STATX = 291
|
||||||
SYS_IO_PGETEVENTS = 292
|
SYS_IO_PGETEVENTS = 292
|
||||||
SYS_RSEQ = 293
|
SYS_RSEQ = 293
|
||||||
|
SYS_KEXEC_FILE_LOAD = 294
|
||||||
)
|
)
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
generated
vendored
|
@ -253,6 +253,7 @@ const (
|
||||||
SYS_TIMER_GETOVERRUN = 264
|
SYS_TIMER_GETOVERRUN = 264
|
||||||
SYS_TIMER_DELETE = 265
|
SYS_TIMER_DELETE = 265
|
||||||
SYS_TIMER_CREATE = 266
|
SYS_TIMER_CREATE = 266
|
||||||
|
SYS_VSERVER = 267
|
||||||
SYS_IO_SETUP = 268
|
SYS_IO_SETUP = 268
|
||||||
SYS_IO_DESTROY = 269
|
SYS_IO_DESTROY = 269
|
||||||
SYS_IO_SUBMIT = 270
|
SYS_IO_SUBMIT = 270
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
|
@ -405,6 +405,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -434,6 +439,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -569,6 +575,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -634,6 +641,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x8
|
SizeofSockFprog = 0x8
|
||||||
|
@ -955,7 +973,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1058,6 +1077,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1079,21 +1099,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1106,6 +1143,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1410,6 +1448,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x18
|
SizeofTpacketHdr = 0x18
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2025,3 +2066,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
|
@ -406,6 +406,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -435,6 +440,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -570,6 +576,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -635,6 +642,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -966,7 +984,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1069,6 +1088,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1090,21 +1110,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1117,6 +1154,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1422,6 +1460,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2038,3 +2079,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
|
@ -409,6 +409,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -438,6 +443,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -573,6 +579,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -638,6 +645,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x8
|
SizeofSockFprog = 0x8
|
||||||
|
@ -944,7 +962,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1047,6 +1066,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1068,21 +1088,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1095,6 +1132,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1400,6 +1438,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x18
|
SizeofTpacketHdr = 0x18
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2016,3 +2057,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
|
@ -407,6 +407,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -436,6 +441,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -571,6 +577,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -636,6 +643,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -945,7 +963,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1048,6 +1067,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1069,21 +1089,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1096,6 +1133,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1401,6 +1439,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2017,3 +2058,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
|
@ -408,6 +408,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -437,6 +442,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -572,6 +578,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -637,6 +644,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x8
|
SizeofSockFprog = 0x8
|
||||||
|
@ -949,7 +967,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1052,6 +1071,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1073,21 +1093,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1100,6 +1137,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1406,6 +1444,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x18
|
SizeofTpacketHdr = 0x18
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2022,3 +2063,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
|
@ -407,6 +407,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -436,6 +441,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -571,6 +577,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -636,6 +643,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -947,7 +965,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1050,6 +1069,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1071,21 +1091,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1098,6 +1135,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1403,6 +1441,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2019,3 +2060,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
|
@ -407,6 +407,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -436,6 +441,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -571,6 +577,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -636,6 +643,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -947,7 +965,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1050,6 +1069,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1071,21 +1091,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1098,6 +1135,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1403,6 +1441,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2019,3 +2060,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
|
@ -408,6 +408,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -437,6 +442,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -572,6 +578,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -637,6 +644,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x8
|
SizeofSockFprog = 0x8
|
||||||
|
@ -949,7 +967,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1052,6 +1071,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1073,21 +1093,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1100,6 +1137,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1406,6 +1444,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x18
|
SizeofTpacketHdr = 0x18
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2022,3 +2063,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
|
@ -408,6 +408,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -437,6 +442,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -572,6 +578,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -637,6 +644,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -955,7 +973,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1058,6 +1077,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1079,21 +1099,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1106,6 +1143,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1411,6 +1449,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2027,3 +2068,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
|
@ -408,6 +408,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -437,6 +442,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -572,6 +578,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -637,6 +644,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -955,7 +973,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1058,6 +1077,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1079,21 +1099,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1106,6 +1143,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1411,6 +1449,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2027,3 +2068,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
|
@ -407,6 +407,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -436,6 +441,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -571,6 +577,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -636,6 +643,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -972,7 +990,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1075,6 +1094,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1096,21 +1116,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1123,6 +1160,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1428,6 +1466,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2044,3 +2085,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
|
@ -406,6 +406,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -435,6 +440,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -570,6 +576,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -635,6 +642,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -968,7 +986,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1071,6 +1090,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1092,21 +1112,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1119,6 +1156,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1425,6 +1463,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2041,3 +2082,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
76
vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
generated
vendored
76
vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
generated
vendored
|
@ -410,6 +410,11 @@ type TCPInfo struct {
|
||||||
Total_retrans uint32
|
Total_retrans uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CanFilter struct {
|
||||||
|
Id uint32
|
||||||
|
Mask uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
|
@ -439,6 +444,7 @@ const (
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofICMPv6Filter = 0x20
|
||||||
SizeofUcred = 0xc
|
SizeofUcred = 0xc
|
||||||
SizeofTCPInfo = 0x68
|
SizeofTCPInfo = 0x68
|
||||||
|
SizeofCanFilter = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -574,6 +580,7 @@ const (
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
SizeofNdUseroptmsg = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
type NlMsghdr struct {
|
type NlMsghdr struct {
|
||||||
|
@ -639,6 +646,17 @@ type RtNexthop struct {
|
||||||
Ifindex int32
|
Ifindex int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NdUseroptmsg struct {
|
||||||
|
Family uint8
|
||||||
|
Pad1 uint8
|
||||||
|
Opts_len uint16
|
||||||
|
Ifindex int32
|
||||||
|
Icmp_type uint8
|
||||||
|
Icmp_code uint8
|
||||||
|
Pad2 uint16
|
||||||
|
Pad3 uint32
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockFilter = 0x8
|
SizeofSockFilter = 0x8
|
||||||
SizeofSockFprog = 0x10
|
SizeofSockFprog = 0x10
|
||||||
|
@ -950,7 +968,8 @@ type PerfEventAttr struct {
|
||||||
Clockid int32
|
Clockid int32
|
||||||
Sample_regs_intr uint64
|
Sample_regs_intr uint64
|
||||||
Aux_watermark uint32
|
Aux_watermark uint32
|
||||||
_ uint32
|
Sample_max_stack uint16
|
||||||
|
_ uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfEventMmapPage struct {
|
type PerfEventMmapPage struct {
|
||||||
|
@ -1053,6 +1072,7 @@ const (
|
||||||
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
|
||||||
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
PERF_COUNT_SW_EMULATION_FAULTS = 0x8
|
||||||
PERF_COUNT_SW_DUMMY = 0x9
|
PERF_COUNT_SW_DUMMY = 0x9
|
||||||
|
PERF_COUNT_SW_BPF_OUTPUT = 0xa
|
||||||
|
|
||||||
PERF_SAMPLE_IP = 0x1
|
PERF_SAMPLE_IP = 0x1
|
||||||
PERF_SAMPLE_TID = 0x2
|
PERF_SAMPLE_TID = 0x2
|
||||||
|
@ -1074,21 +1094,38 @@ const (
|
||||||
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
PERF_SAMPLE_BRANCH_ANY_CALL = 0x10
|
||||||
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
|
||||||
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
PERF_SAMPLE_BRANCH_IND_CALL = 0x40
|
||||||
|
PERF_SAMPLE_BRANCH_ABORT_TX = 0x80
|
||||||
|
PERF_SAMPLE_BRANCH_IN_TX = 0x100
|
||||||
|
PERF_SAMPLE_BRANCH_NO_TX = 0x200
|
||||||
|
PERF_SAMPLE_BRANCH_COND = 0x400
|
||||||
|
PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
|
||||||
|
PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000
|
||||||
|
PERF_SAMPLE_BRANCH_CALL = 0x2000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000
|
||||||
|
PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000
|
||||||
|
PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000
|
||||||
|
|
||||||
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
|
||||||
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
|
||||||
PERF_FORMAT_ID = 0x4
|
PERF_FORMAT_ID = 0x4
|
||||||
PERF_FORMAT_GROUP = 0x8
|
PERF_FORMAT_GROUP = 0x8
|
||||||
|
|
||||||
PERF_RECORD_MMAP = 0x1
|
PERF_RECORD_MMAP = 0x1
|
||||||
PERF_RECORD_LOST = 0x2
|
PERF_RECORD_LOST = 0x2
|
||||||
PERF_RECORD_COMM = 0x3
|
PERF_RECORD_COMM = 0x3
|
||||||
PERF_RECORD_EXIT = 0x4
|
PERF_RECORD_EXIT = 0x4
|
||||||
PERF_RECORD_THROTTLE = 0x5
|
PERF_RECORD_THROTTLE = 0x5
|
||||||
PERF_RECORD_UNTHROTTLE = 0x6
|
PERF_RECORD_UNTHROTTLE = 0x6
|
||||||
PERF_RECORD_FORK = 0x7
|
PERF_RECORD_FORK = 0x7
|
||||||
PERF_RECORD_READ = 0x8
|
PERF_RECORD_READ = 0x8
|
||||||
PERF_RECORD_SAMPLE = 0x9
|
PERF_RECORD_SAMPLE = 0x9
|
||||||
|
PERF_RECORD_MMAP2 = 0xa
|
||||||
|
PERF_RECORD_AUX = 0xb
|
||||||
|
PERF_RECORD_ITRACE_START = 0xc
|
||||||
|
PERF_RECORD_LOST_SAMPLES = 0xd
|
||||||
|
PERF_RECORD_SWITCH = 0xe
|
||||||
|
PERF_RECORD_SWITCH_CPU_WIDE = 0xf
|
||||||
|
PERF_RECORD_NAMESPACES = 0x10
|
||||||
|
|
||||||
PERF_CONTEXT_HV = -0x20
|
PERF_CONTEXT_HV = -0x20
|
||||||
PERF_CONTEXT_KERNEL = -0x80
|
PERF_CONTEXT_KERNEL = -0x80
|
||||||
|
@ -1101,6 +1138,7 @@ const (
|
||||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||||
PERF_FLAG_FD_OUTPUT = 0x2
|
PERF_FLAG_FD_OUTPUT = 0x2
|
||||||
PERF_FLAG_PID_CGROUP = 0x4
|
PERF_FLAG_PID_CGROUP = 0x4
|
||||||
|
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1406,6 +1444,9 @@ const (
|
||||||
SizeofTpacketHdr = 0x20
|
SizeofTpacketHdr = 0x20
|
||||||
SizeofTpacket2Hdr = 0x20
|
SizeofTpacket2Hdr = 0x20
|
||||||
SizeofTpacket3Hdr = 0x30
|
SizeofTpacket3Hdr = 0x30
|
||||||
|
|
||||||
|
SizeofTpacketStats = 0x8
|
||||||
|
SizeofTpacketStatsV3 = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2022,3 +2063,18 @@ type SockExtendedErr struct {
|
||||||
Info uint32
|
Info uint32
|
||||||
Data uint32
|
Data uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FanotifyEventMetadata struct {
|
||||||
|
Event_len uint32
|
||||||
|
Vers uint8
|
||||||
|
Reserved uint8
|
||||||
|
Metadata_len uint16
|
||||||
|
Mask uint64
|
||||||
|
Fd int32
|
||||||
|
Pid int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type FanotifyResponse struct {
|
||||||
|
Fd int32
|
||||||
|
Response uint32
|
||||||
|
}
|
||||||
|
|
8
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
8
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
|
@ -359,11 +359,11 @@ func loadLibraryEx(name string, system bool) (*DLL, error) {
|
||||||
// trying to load "foo.dll" out of the system
|
// trying to load "foo.dll" out of the system
|
||||||
// folder, but LoadLibraryEx doesn't support
|
// folder, but LoadLibraryEx doesn't support
|
||||||
// that yet on their system, so emulate it.
|
// that yet on their system, so emulate it.
|
||||||
windir, _ := Getenv("WINDIR") // old var; apparently works on XP
|
systemdir, err := GetSystemDirectory()
|
||||||
if windir == "" {
|
if err != nil {
|
||||||
return nil, errString("%WINDIR% not defined")
|
return nil, err
|
||||||
}
|
}
|
||||||
loadDLL = windir + "\\System32\\" + name
|
loadDLL = systemdir + "\\" + name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h, err := LoadLibraryEx(loadDLL, 0, flags)
|
h, err := LoadLibraryEx(loadDLL, 0, flags)
|
||||||
|
|
20
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
20
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
|
@ -149,7 +149,7 @@ const (
|
||||||
DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b
|
DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b
|
||||||
DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c
|
DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c
|
||||||
DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d
|
DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d
|
||||||
DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e
|
DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e
|
||||||
DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f
|
DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f
|
||||||
DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230
|
DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230
|
||||||
DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231
|
DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231
|
||||||
|
@ -372,6 +372,7 @@ type Tokengroups struct {
|
||||||
//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
|
//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
|
||||||
//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
|
//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
|
||||||
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
|
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
|
||||||
|
//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
|
||||||
|
|
||||||
// An access token contains the security information for a logon session.
|
// An access token contains the security information for a logon session.
|
||||||
// The system creates an access token when a user logs on, and every
|
// The system creates an access token when a user logs on, and every
|
||||||
|
@ -468,6 +469,23 @@ func (t Token) GetUserProfileDirectory() (string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSystemDirectory retrieves path to current location of the system
|
||||||
|
// directory, which is typically, though not always, C:\Windows\System32.
|
||||||
|
func GetSystemDirectory() (string, error) {
|
||||||
|
n := uint32(MAX_PATH)
|
||||||
|
for {
|
||||||
|
b := make([]uint16, n)
|
||||||
|
l, e := getSystemDirectory(&b[0], n)
|
||||||
|
if e != nil {
|
||||||
|
return "", e
|
||||||
|
}
|
||||||
|
if l <= n {
|
||||||
|
return UTF16ToString(b[:l]), nil
|
||||||
|
}
|
||||||
|
n = l
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// IsMember reports whether the access token t is a member of the provided SID.
|
// IsMember reports whether the access token t is a member of the provided SID.
|
||||||
func (t Token) IsMember(sid *SID) (bool, error) {
|
func (t Token) IsMember(sid *SID) (bool, error) {
|
||||||
var b int32
|
var b int32
|
||||||
|
|
14
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
14
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
|
@ -252,6 +252,7 @@ var (
|
||||||
procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
|
procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
|
||||||
procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
|
procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
|
||||||
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
||||||
|
procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
|
func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
|
||||||
|
@ -2718,3 +2719,16 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
|
||||||
|
len = uint32(r0)
|
||||||
|
if len == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
3
vendor/golang.org/x/tools/AUTHORS
generated
vendored
Normal file
3
vendor/golang.org/x/tools/AUTHORS
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# This source code refers to The Go Authors for copyright purposes.
|
||||||
|
# The master list of authors is in the main Go distribution,
|
||||||
|
# visible at http://tip.golang.org/AUTHORS.
|
3
vendor/golang.org/x/tools/CONTRIBUTORS
generated
vendored
Normal file
3
vendor/golang.org/x/tools/CONTRIBUTORS
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# This source code was written by the Go contributors.
|
||||||
|
# The master list of contributors is in the main Go distribution,
|
||||||
|
# visible at http://tip.golang.org/CONTRIBUTORS.
|
27
vendor/golang.org/x/tools/LICENSE
generated
vendored
Normal file
27
vendor/golang.org/x/tools/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
22
vendor/golang.org/x/tools/PATENTS
generated
vendored
Normal file
22
vendor/golang.org/x/tools/PATENTS
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Additional IP Rights Grant (Patents)
|
||||||
|
|
||||||
|
"This implementation" means the copyrightable works distributed by
|
||||||
|
Google as part of the Go project.
|
||||||
|
|
||||||
|
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||||
|
no-charge, royalty-free, irrevocable (except as stated in this section)
|
||||||
|
patent license to make, have made, use, offer to sell, sell, import,
|
||||||
|
transfer and otherwise run, modify and propagate the contents of this
|
||||||
|
implementation of Go, where such license applies only to those patent
|
||||||
|
claims, both currently owned or controlled by Google and acquired in
|
||||||
|
the future, licensable by Google that are necessarily infringed by this
|
||||||
|
implementation of Go. This grant does not include claims that would be
|
||||||
|
infringed only as a consequence of further modification of this
|
||||||
|
implementation. If you or your agent or exclusive licensee institute or
|
||||||
|
order or agree to the institution of patent litigation against any
|
||||||
|
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||||
|
that this implementation of Go or any code incorporated within this
|
||||||
|
implementation of Go constitutes direct or contributory patent
|
||||||
|
infringement, or inducement of patent infringement, then any patent
|
||||||
|
rights granted to you under this License for this implementation of Go
|
||||||
|
shall terminate as of the date such litigation is filed.
|
627
vendor/golang.org/x/tools/go/ast/astutil/enclosing.go
generated
vendored
Normal file
627
vendor/golang.org/x/tools/go/ast/astutil/enclosing.go
generated
vendored
Normal file
|
@ -0,0 +1,627 @@
|
||||||
|
// Copyright 2013 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 astutil
|
||||||
|
|
||||||
|
// This file defines utilities for working with source positions.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PathEnclosingInterval returns the node that encloses the source
|
||||||
|
// interval [start, end), and all its ancestors up to the AST root.
|
||||||
|
//
|
||||||
|
// The definition of "enclosing" used by this function considers
|
||||||
|
// additional whitespace abutting a node to be enclosed by it.
|
||||||
|
// In this example:
|
||||||
|
//
|
||||||
|
// z := x + y // add them
|
||||||
|
// <-A->
|
||||||
|
// <----B----->
|
||||||
|
//
|
||||||
|
// the ast.BinaryExpr(+) node is considered to enclose interval B
|
||||||
|
// even though its [Pos()..End()) is actually only interval A.
|
||||||
|
// This behaviour makes user interfaces more tolerant of imperfect
|
||||||
|
// input.
|
||||||
|
//
|
||||||
|
// This function treats tokens as nodes, though they are not included
|
||||||
|
// in the result. e.g. PathEnclosingInterval("+") returns the
|
||||||
|
// enclosing ast.BinaryExpr("x + y").
|
||||||
|
//
|
||||||
|
// If start==end, the 1-char interval following start is used instead.
|
||||||
|
//
|
||||||
|
// The 'exact' result is true if the interval contains only path[0]
|
||||||
|
// and perhaps some adjacent whitespace. It is false if the interval
|
||||||
|
// overlaps multiple children of path[0], or if it contains only
|
||||||
|
// interior whitespace of path[0].
|
||||||
|
// In this example:
|
||||||
|
//
|
||||||
|
// z := x + y // add them
|
||||||
|
// <--C--> <---E-->
|
||||||
|
// ^
|
||||||
|
// D
|
||||||
|
//
|
||||||
|
// intervals C, D and E are inexact. C is contained by the
|
||||||
|
// z-assignment statement, because it spans three of its children (:=,
|
||||||
|
// x, +). So too is the 1-char interval D, because it contains only
|
||||||
|
// interior whitespace of the assignment. E is considered interior
|
||||||
|
// whitespace of the BlockStmt containing the assignment.
|
||||||
|
//
|
||||||
|
// Precondition: [start, end) both lie within the same file as root.
|
||||||
|
// TODO(adonovan): return (nil, false) in this case and remove precond.
|
||||||
|
// Requires FileSet; see loader.tokenFileContainsPos.
|
||||||
|
//
|
||||||
|
// Postcondition: path is never nil; it always contains at least 'root'.
|
||||||
|
//
|
||||||
|
func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
|
||||||
|
// fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
|
||||||
|
|
||||||
|
// Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).
|
||||||
|
var visit func(node ast.Node) bool
|
||||||
|
visit = func(node ast.Node) bool {
|
||||||
|
path = append(path, node)
|
||||||
|
|
||||||
|
nodePos := node.Pos()
|
||||||
|
nodeEnd := node.End()
|
||||||
|
|
||||||
|
// fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging
|
||||||
|
|
||||||
|
// Intersect [start, end) with interval of node.
|
||||||
|
if start < nodePos {
|
||||||
|
start = nodePos
|
||||||
|
}
|
||||||
|
if end > nodeEnd {
|
||||||
|
end = nodeEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find sole child that contains [start, end).
|
||||||
|
children := childrenOf(node)
|
||||||
|
l := len(children)
|
||||||
|
for i, child := range children {
|
||||||
|
// [childPos, childEnd) is unaugmented interval of child.
|
||||||
|
childPos := child.Pos()
|
||||||
|
childEnd := child.End()
|
||||||
|
|
||||||
|
// [augPos, augEnd) is whitespace-augmented interval of child.
|
||||||
|
augPos := childPos
|
||||||
|
augEnd := childEnd
|
||||||
|
if i > 0 {
|
||||||
|
augPos = children[i-1].End() // start of preceding whitespace
|
||||||
|
}
|
||||||
|
if i < l-1 {
|
||||||
|
nextChildPos := children[i+1].Pos()
|
||||||
|
// Does [start, end) lie between child and next child?
|
||||||
|
if start >= augEnd && end <= nextChildPos {
|
||||||
|
return false // inexact match
|
||||||
|
}
|
||||||
|
augEnd = nextChildPos // end of following whitespace
|
||||||
|
}
|
||||||
|
|
||||||
|
// fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n",
|
||||||
|
// i, augPos, augEnd, start, end) // debugging
|
||||||
|
|
||||||
|
// Does augmented child strictly contain [start, end)?
|
||||||
|
if augPos <= start && end <= augEnd {
|
||||||
|
_, isToken := child.(tokenNode)
|
||||||
|
return isToken || visit(child)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Does [start, end) overlap multiple children?
|
||||||
|
// i.e. left-augmented child contains start
|
||||||
|
// but LR-augmented child does not contain end.
|
||||||
|
if start < childEnd && end > augEnd {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No single child contained [start, end),
|
||||||
|
// so node is the result. Is it exact?
|
||||||
|
|
||||||
|
// (It's tempting to put this condition before the
|
||||||
|
// child loop, but it gives the wrong result in the
|
||||||
|
// case where a node (e.g. ExprStmt) and its sole
|
||||||
|
// child have equal intervals.)
|
||||||
|
if start == nodePos && end == nodeEnd {
|
||||||
|
return true // exact match
|
||||||
|
}
|
||||||
|
|
||||||
|
return false // inexact: overlaps multiple children
|
||||||
|
}
|
||||||
|
|
||||||
|
if start > end {
|
||||||
|
start, end = end, start
|
||||||
|
}
|
||||||
|
|
||||||
|
if start < root.End() && end > root.Pos() {
|
||||||
|
if start == end {
|
||||||
|
end = start + 1 // empty interval => interval of size 1
|
||||||
|
}
|
||||||
|
exact = visit(root)
|
||||||
|
|
||||||
|
// Reverse the path:
|
||||||
|
for i, l := 0, len(path); i < l/2; i++ {
|
||||||
|
path[i], path[l-1-i] = path[l-1-i], path[i]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Selection lies within whitespace preceding the
|
||||||
|
// first (or following the last) declaration in the file.
|
||||||
|
// The result nonetheless always includes the ast.File.
|
||||||
|
path = append(path, root)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// tokenNode is a dummy implementation of ast.Node for a single token.
|
||||||
|
// They are used transiently by PathEnclosingInterval but never escape
|
||||||
|
// this package.
|
||||||
|
//
|
||||||
|
type tokenNode struct {
|
||||||
|
pos token.Pos
|
||||||
|
end token.Pos
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n tokenNode) Pos() token.Pos {
|
||||||
|
return n.pos
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n tokenNode) End() token.Pos {
|
||||||
|
return n.end
|
||||||
|
}
|
||||||
|
|
||||||
|
func tok(pos token.Pos, len int) ast.Node {
|
||||||
|
return tokenNode{pos, pos + token.Pos(len)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// childrenOf returns the direct non-nil children of ast.Node n.
|
||||||
|
// It may include fake ast.Node implementations for bare tokens.
|
||||||
|
// it is not safe to call (e.g.) ast.Walk on such nodes.
|
||||||
|
//
|
||||||
|
func childrenOf(n ast.Node) []ast.Node {
|
||||||
|
var children []ast.Node
|
||||||
|
|
||||||
|
// First add nodes for all true subtrees.
|
||||||
|
ast.Inspect(n, func(node ast.Node) bool {
|
||||||
|
if node == n { // push n
|
||||||
|
return true // recur
|
||||||
|
}
|
||||||
|
if node != nil { // push child
|
||||||
|
children = append(children, node)
|
||||||
|
}
|
||||||
|
return false // no recursion
|
||||||
|
})
|
||||||
|
|
||||||
|
// Then add fake Nodes for bare tokens.
|
||||||
|
switch n := n.(type) {
|
||||||
|
case *ast.ArrayType:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lbrack, len("[")),
|
||||||
|
tok(n.Elt.End(), len("]")))
|
||||||
|
|
||||||
|
case *ast.AssignStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.TokPos, len(n.Tok.String())))
|
||||||
|
|
||||||
|
case *ast.BasicLit:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.ValuePos, len(n.Value)))
|
||||||
|
|
||||||
|
case *ast.BinaryExpr:
|
||||||
|
children = append(children, tok(n.OpPos, len(n.Op.String())))
|
||||||
|
|
||||||
|
case *ast.BlockStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lbrace, len("{")),
|
||||||
|
tok(n.Rbrace, len("}")))
|
||||||
|
|
||||||
|
case *ast.BranchStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.TokPos, len(n.Tok.String())))
|
||||||
|
|
||||||
|
case *ast.CallExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lparen, len("(")),
|
||||||
|
tok(n.Rparen, len(")")))
|
||||||
|
if n.Ellipsis != 0 {
|
||||||
|
children = append(children, tok(n.Ellipsis, len("...")))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.CaseClause:
|
||||||
|
if n.List == nil {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Case, len("default")))
|
||||||
|
} else {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Case, len("case")))
|
||||||
|
}
|
||||||
|
children = append(children, tok(n.Colon, len(":")))
|
||||||
|
|
||||||
|
case *ast.ChanType:
|
||||||
|
switch n.Dir {
|
||||||
|
case ast.RECV:
|
||||||
|
children = append(children, tok(n.Begin, len("<-chan")))
|
||||||
|
case ast.SEND:
|
||||||
|
children = append(children, tok(n.Begin, len("chan<-")))
|
||||||
|
case ast.RECV | ast.SEND:
|
||||||
|
children = append(children, tok(n.Begin, len("chan")))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.CommClause:
|
||||||
|
if n.Comm == nil {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Case, len("default")))
|
||||||
|
} else {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Case, len("case")))
|
||||||
|
}
|
||||||
|
children = append(children, tok(n.Colon, len(":")))
|
||||||
|
|
||||||
|
case *ast.Comment:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.CommentGroup:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.CompositeLit:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lbrace, len("{")),
|
||||||
|
tok(n.Rbrace, len("{")))
|
||||||
|
|
||||||
|
case *ast.DeclStmt:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.DeferStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Defer, len("defer")))
|
||||||
|
|
||||||
|
case *ast.Ellipsis:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Ellipsis, len("...")))
|
||||||
|
|
||||||
|
case *ast.EmptyStmt:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.ExprStmt:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.Field:
|
||||||
|
// TODO(adonovan): Field.{Doc,Comment,Tag}?
|
||||||
|
|
||||||
|
case *ast.FieldList:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Opening, len("(")),
|
||||||
|
tok(n.Closing, len(")")))
|
||||||
|
|
||||||
|
case *ast.File:
|
||||||
|
// TODO test: Doc
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Package, len("package")))
|
||||||
|
|
||||||
|
case *ast.ForStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.For, len("for")))
|
||||||
|
|
||||||
|
case *ast.FuncDecl:
|
||||||
|
// TODO(adonovan): FuncDecl.Comment?
|
||||||
|
|
||||||
|
// Uniquely, FuncDecl breaks the invariant that
|
||||||
|
// preorder traversal yields tokens in lexical order:
|
||||||
|
// in fact, FuncDecl.Recv precedes FuncDecl.Type.Func.
|
||||||
|
//
|
||||||
|
// As a workaround, we inline the case for FuncType
|
||||||
|
// here and order things correctly.
|
||||||
|
//
|
||||||
|
children = nil // discard ast.Walk(FuncDecl) info subtrees
|
||||||
|
children = append(children, tok(n.Type.Func, len("func")))
|
||||||
|
if n.Recv != nil {
|
||||||
|
children = append(children, n.Recv)
|
||||||
|
}
|
||||||
|
children = append(children, n.Name)
|
||||||
|
if n.Type.Params != nil {
|
||||||
|
children = append(children, n.Type.Params)
|
||||||
|
}
|
||||||
|
if n.Type.Results != nil {
|
||||||
|
children = append(children, n.Type.Results)
|
||||||
|
}
|
||||||
|
if n.Body != nil {
|
||||||
|
children = append(children, n.Body)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.FuncLit:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.FuncType:
|
||||||
|
if n.Func != 0 {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Func, len("func")))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.GenDecl:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.TokPos, len(n.Tok.String())))
|
||||||
|
if n.Lparen != 0 {
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lparen, len("(")),
|
||||||
|
tok(n.Rparen, len(")")))
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.GoStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Go, len("go")))
|
||||||
|
|
||||||
|
case *ast.Ident:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.NamePos, len(n.Name)))
|
||||||
|
|
||||||
|
case *ast.IfStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.If, len("if")))
|
||||||
|
|
||||||
|
case *ast.ImportSpec:
|
||||||
|
// TODO(adonovan): ImportSpec.{Doc,EndPos}?
|
||||||
|
|
||||||
|
case *ast.IncDecStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.TokPos, len(n.Tok.String())))
|
||||||
|
|
||||||
|
case *ast.IndexExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lbrack, len("{")),
|
||||||
|
tok(n.Rbrack, len("}")))
|
||||||
|
|
||||||
|
case *ast.InterfaceType:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Interface, len("interface")))
|
||||||
|
|
||||||
|
case *ast.KeyValueExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Colon, len(":")))
|
||||||
|
|
||||||
|
case *ast.LabeledStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Colon, len(":")))
|
||||||
|
|
||||||
|
case *ast.MapType:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Map, len("map")))
|
||||||
|
|
||||||
|
case *ast.ParenExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lparen, len("(")),
|
||||||
|
tok(n.Rparen, len(")")))
|
||||||
|
|
||||||
|
case *ast.RangeStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.For, len("for")),
|
||||||
|
tok(n.TokPos, len(n.Tok.String())))
|
||||||
|
|
||||||
|
case *ast.ReturnStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Return, len("return")))
|
||||||
|
|
||||||
|
case *ast.SelectStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Select, len("select")))
|
||||||
|
|
||||||
|
case *ast.SelectorExpr:
|
||||||
|
// nop
|
||||||
|
|
||||||
|
case *ast.SendStmt:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Arrow, len("<-")))
|
||||||
|
|
||||||
|
case *ast.SliceExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lbrack, len("[")),
|
||||||
|
tok(n.Rbrack, len("]")))
|
||||||
|
|
||||||
|
case *ast.StarExpr:
|
||||||
|
children = append(children, tok(n.Star, len("*")))
|
||||||
|
|
||||||
|
case *ast.StructType:
|
||||||
|
children = append(children, tok(n.Struct, len("struct")))
|
||||||
|
|
||||||
|
case *ast.SwitchStmt:
|
||||||
|
children = append(children, tok(n.Switch, len("switch")))
|
||||||
|
|
||||||
|
case *ast.TypeAssertExpr:
|
||||||
|
children = append(children,
|
||||||
|
tok(n.Lparen-1, len(".")),
|
||||||
|
tok(n.Lparen, len("(")),
|
||||||
|
tok(n.Rparen, len(")")))
|
||||||
|
|
||||||
|
case *ast.TypeSpec:
|
||||||
|
// TODO(adonovan): TypeSpec.{Doc,Comment}?
|
||||||
|
|
||||||
|
case *ast.TypeSwitchStmt:
|
||||||
|
children = append(children, tok(n.Switch, len("switch")))
|
||||||
|
|
||||||
|
case *ast.UnaryExpr:
|
||||||
|
children = append(children, tok(n.OpPos, len(n.Op.String())))
|
||||||
|
|
||||||
|
case *ast.ValueSpec:
|
||||||
|
// TODO(adonovan): ValueSpec.{Doc,Comment}?
|
||||||
|
|
||||||
|
case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt:
|
||||||
|
// nop
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(adonovan): opt: merge the logic of ast.Inspect() into
|
||||||
|
// the switch above so we can make interleaved callbacks for
|
||||||
|
// both Nodes and Tokens in the right order and avoid the need
|
||||||
|
// to sort.
|
||||||
|
sort.Sort(byPos(children))
|
||||||
|
|
||||||
|
return children
|
||||||
|
}
|
||||||
|
|
||||||
|
type byPos []ast.Node
|
||||||
|
|
||||||
|
func (sl byPos) Len() int {
|
||||||
|
return len(sl)
|
||||||
|
}
|
||||||
|
func (sl byPos) Less(i, j int) bool {
|
||||||
|
return sl[i].Pos() < sl[j].Pos()
|
||||||
|
}
|
||||||
|
func (sl byPos) Swap(i, j int) {
|
||||||
|
sl[i], sl[j] = sl[j], sl[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
// NodeDescription returns a description of the concrete type of n suitable
|
||||||
|
// for a user interface.
|
||||||
|
//
|
||||||
|
// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident,
|
||||||
|
// StarExpr) we could be much more specific given the path to the AST
|
||||||
|
// root. Perhaps we should do that.
|
||||||
|
//
|
||||||
|
func NodeDescription(n ast.Node) string {
|
||||||
|
switch n := n.(type) {
|
||||||
|
case *ast.ArrayType:
|
||||||
|
return "array type"
|
||||||
|
case *ast.AssignStmt:
|
||||||
|
return "assignment"
|
||||||
|
case *ast.BadDecl:
|
||||||
|
return "bad declaration"
|
||||||
|
case *ast.BadExpr:
|
||||||
|
return "bad expression"
|
||||||
|
case *ast.BadStmt:
|
||||||
|
return "bad statement"
|
||||||
|
case *ast.BasicLit:
|
||||||
|
return "basic literal"
|
||||||
|
case *ast.BinaryExpr:
|
||||||
|
return fmt.Sprintf("binary %s operation", n.Op)
|
||||||
|
case *ast.BlockStmt:
|
||||||
|
return "block"
|
||||||
|
case *ast.BranchStmt:
|
||||||
|
switch n.Tok {
|
||||||
|
case token.BREAK:
|
||||||
|
return "break statement"
|
||||||
|
case token.CONTINUE:
|
||||||
|
return "continue statement"
|
||||||
|
case token.GOTO:
|
||||||
|
return "goto statement"
|
||||||
|
case token.FALLTHROUGH:
|
||||||
|
return "fall-through statement"
|
||||||
|
}
|
||||||
|
case *ast.CallExpr:
|
||||||
|
if len(n.Args) == 1 && !n.Ellipsis.IsValid() {
|
||||||
|
return "function call (or conversion)"
|
||||||
|
}
|
||||||
|
return "function call"
|
||||||
|
case *ast.CaseClause:
|
||||||
|
return "case clause"
|
||||||
|
case *ast.ChanType:
|
||||||
|
return "channel type"
|
||||||
|
case *ast.CommClause:
|
||||||
|
return "communication clause"
|
||||||
|
case *ast.Comment:
|
||||||
|
return "comment"
|
||||||
|
case *ast.CommentGroup:
|
||||||
|
return "comment group"
|
||||||
|
case *ast.CompositeLit:
|
||||||
|
return "composite literal"
|
||||||
|
case *ast.DeclStmt:
|
||||||
|
return NodeDescription(n.Decl) + " statement"
|
||||||
|
case *ast.DeferStmt:
|
||||||
|
return "defer statement"
|
||||||
|
case *ast.Ellipsis:
|
||||||
|
return "ellipsis"
|
||||||
|
case *ast.EmptyStmt:
|
||||||
|
return "empty statement"
|
||||||
|
case *ast.ExprStmt:
|
||||||
|
return "expression statement"
|
||||||
|
case *ast.Field:
|
||||||
|
// Can be any of these:
|
||||||
|
// struct {x, y int} -- struct field(s)
|
||||||
|
// struct {T} -- anon struct field
|
||||||
|
// interface {I} -- interface embedding
|
||||||
|
// interface {f()} -- interface method
|
||||||
|
// func (A) func(B) C -- receiver, param(s), result(s)
|
||||||
|
return "field/method/parameter"
|
||||||
|
case *ast.FieldList:
|
||||||
|
return "field/method/parameter list"
|
||||||
|
case *ast.File:
|
||||||
|
return "source file"
|
||||||
|
case *ast.ForStmt:
|
||||||
|
return "for loop"
|
||||||
|
case *ast.FuncDecl:
|
||||||
|
return "function declaration"
|
||||||
|
case *ast.FuncLit:
|
||||||
|
return "function literal"
|
||||||
|
case *ast.FuncType:
|
||||||
|
return "function type"
|
||||||
|
case *ast.GenDecl:
|
||||||
|
switch n.Tok {
|
||||||
|
case token.IMPORT:
|
||||||
|
return "import declaration"
|
||||||
|
case token.CONST:
|
||||||
|
return "constant declaration"
|
||||||
|
case token.TYPE:
|
||||||
|
return "type declaration"
|
||||||
|
case token.VAR:
|
||||||
|
return "variable declaration"
|
||||||
|
}
|
||||||
|
case *ast.GoStmt:
|
||||||
|
return "go statement"
|
||||||
|
case *ast.Ident:
|
||||||
|
return "identifier"
|
||||||
|
case *ast.IfStmt:
|
||||||
|
return "if statement"
|
||||||
|
case *ast.ImportSpec:
|
||||||
|
return "import specification"
|
||||||
|
case *ast.IncDecStmt:
|
||||||
|
if n.Tok == token.INC {
|
||||||
|
return "increment statement"
|
||||||
|
}
|
||||||
|
return "decrement statement"
|
||||||
|
case *ast.IndexExpr:
|
||||||
|
return "index expression"
|
||||||
|
case *ast.InterfaceType:
|
||||||
|
return "interface type"
|
||||||
|
case *ast.KeyValueExpr:
|
||||||
|
return "key/value association"
|
||||||
|
case *ast.LabeledStmt:
|
||||||
|
return "statement label"
|
||||||
|
case *ast.MapType:
|
||||||
|
return "map type"
|
||||||
|
case *ast.Package:
|
||||||
|
return "package"
|
||||||
|
case *ast.ParenExpr:
|
||||||
|
return "parenthesized " + NodeDescription(n.X)
|
||||||
|
case *ast.RangeStmt:
|
||||||
|
return "range loop"
|
||||||
|
case *ast.ReturnStmt:
|
||||||
|
return "return statement"
|
||||||
|
case *ast.SelectStmt:
|
||||||
|
return "select statement"
|
||||||
|
case *ast.SelectorExpr:
|
||||||
|
return "selector"
|
||||||
|
case *ast.SendStmt:
|
||||||
|
return "channel send"
|
||||||
|
case *ast.SliceExpr:
|
||||||
|
return "slice expression"
|
||||||
|
case *ast.StarExpr:
|
||||||
|
return "*-operation" // load/store expr or pointer type
|
||||||
|
case *ast.StructType:
|
||||||
|
return "struct type"
|
||||||
|
case *ast.SwitchStmt:
|
||||||
|
return "switch statement"
|
||||||
|
case *ast.TypeAssertExpr:
|
||||||
|
return "type assertion"
|
||||||
|
case *ast.TypeSpec:
|
||||||
|
return "type specification"
|
||||||
|
case *ast.TypeSwitchStmt:
|
||||||
|
return "type switch"
|
||||||
|
case *ast.UnaryExpr:
|
||||||
|
return fmt.Sprintf("unary %s operation", n.Op)
|
||||||
|
case *ast.ValueSpec:
|
||||||
|
return "value specification"
|
||||||
|
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("unexpected node type: %T", n))
|
||||||
|
}
|
481
vendor/golang.org/x/tools/go/ast/astutil/imports.go
generated
vendored
Normal file
481
vendor/golang.org/x/tools/go/ast/astutil/imports.go
generated
vendored
Normal file
|
@ -0,0 +1,481 @@
|
||||||
|
// Copyright 2013 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 astutil contains common utilities for working with the Go AST.
|
||||||
|
package astutil // import "golang.org/x/tools/go/ast/astutil"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddImport adds the import path to the file f, if absent.
|
||||||
|
func AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) {
|
||||||
|
return AddNamedImport(fset, f, "", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// For example, calling
|
||||||
|
// AddNamedImport(fset, f, "pathpkg", "path")
|
||||||
|
// adds
|
||||||
|
// import pathpkg "path"
|
||||||
|
func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) {
|
||||||
|
if imports(f, name, path) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
newImport := &ast.ImportSpec{
|
||||||
|
Path: &ast.BasicLit{
|
||||||
|
Kind: token.STRING,
|
||||||
|
Value: strconv.Quote(path),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if name != "" {
|
||||||
|
newImport.Name = &ast.Ident{Name: name}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find an import decl to add to.
|
||||||
|
// The goal is to find an existing import
|
||||||
|
// whose import path has the longest shared
|
||||||
|
// prefix with path.
|
||||||
|
var (
|
||||||
|
bestMatch = -1 // length of longest shared prefix
|
||||||
|
lastImport = -1 // index in f.Decls of the file's final import decl
|
||||||
|
impDecl *ast.GenDecl // import decl containing the best match
|
||||||
|
impIndex = -1 // spec index in impDecl containing the best match
|
||||||
|
|
||||||
|
isThirdPartyPath = isThirdParty(path)
|
||||||
|
)
|
||||||
|
for i, decl := range f.Decls {
|
||||||
|
gen, ok := decl.(*ast.GenDecl)
|
||||||
|
if ok && gen.Tok == token.IMPORT {
|
||||||
|
lastImport = i
|
||||||
|
// Do not add to import "C", to avoid disrupting the
|
||||||
|
// association with its doc comment, breaking cgo.
|
||||||
|
if declImports(gen, "C") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match an empty import decl if that's all that is available.
|
||||||
|
if len(gen.Specs) == 0 && bestMatch == -1 {
|
||||||
|
impDecl = gen
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute longest shared prefix with imports in this group and find best
|
||||||
|
// matched import spec.
|
||||||
|
// 1. Always prefer import spec with longest shared prefix.
|
||||||
|
// 2. While match length is 0,
|
||||||
|
// - for stdlib package: prefer first import spec.
|
||||||
|
// - for third party package: prefer first third party import spec.
|
||||||
|
// We cannot use last import spec as best match for third party package
|
||||||
|
// because grouped imports are usually placed last by goimports -local
|
||||||
|
// flag.
|
||||||
|
// See issue #19190.
|
||||||
|
seenAnyThirdParty := false
|
||||||
|
for j, spec := range gen.Specs {
|
||||||
|
impspec := spec.(*ast.ImportSpec)
|
||||||
|
p := importPath(impspec)
|
||||||
|
n := matchLen(p, path)
|
||||||
|
if n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) {
|
||||||
|
bestMatch = n
|
||||||
|
impDecl = gen
|
||||||
|
impIndex = j
|
||||||
|
}
|
||||||
|
seenAnyThirdParty = seenAnyThirdParty || isThirdParty(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no import decl found, add one after the last import.
|
||||||
|
if impDecl == nil {
|
||||||
|
impDecl = &ast.GenDecl{
|
||||||
|
Tok: token.IMPORT,
|
||||||
|
}
|
||||||
|
if lastImport >= 0 {
|
||||||
|
impDecl.TokPos = f.Decls[lastImport].End()
|
||||||
|
} else {
|
||||||
|
// There are no existing imports.
|
||||||
|
// Our new import, preceded by a blank line, goes after the package declaration
|
||||||
|
// and after the comment, if any, that starts on the same line as the
|
||||||
|
// package declaration.
|
||||||
|
impDecl.TokPos = f.Package
|
||||||
|
|
||||||
|
file := fset.File(f.Package)
|
||||||
|
pkgLine := file.Line(f.Package)
|
||||||
|
for _, c := range f.Comments {
|
||||||
|
if file.Line(c.Pos()) > pkgLine {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// +2 for a blank line
|
||||||
|
impDecl.TokPos = c.End() + 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f.Decls = append(f.Decls, nil)
|
||||||
|
copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:])
|
||||||
|
f.Decls[lastImport+1] = impDecl
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert new import at insertAt.
|
||||||
|
insertAt := 0
|
||||||
|
if impIndex >= 0 {
|
||||||
|
// insert after the found import
|
||||||
|
insertAt = impIndex + 1
|
||||||
|
}
|
||||||
|
impDecl.Specs = append(impDecl.Specs, nil)
|
||||||
|
copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:])
|
||||||
|
impDecl.Specs[insertAt] = newImport
|
||||||
|
pos := impDecl.Pos()
|
||||||
|
if insertAt > 0 {
|
||||||
|
// If there is a comment after an existing import, preserve the comment
|
||||||
|
// position by adding the new import after the comment.
|
||||||
|
if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil {
|
||||||
|
pos = spec.Comment.End()
|
||||||
|
} else {
|
||||||
|
// Assign same position as the previous import,
|
||||||
|
// so that the sorter sees it as being in the same block.
|
||||||
|
pos = impDecl.Specs[insertAt-1].Pos()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if newImport.Name != nil {
|
||||||
|
newImport.Name.NamePos = pos
|
||||||
|
}
|
||||||
|
newImport.Path.ValuePos = pos
|
||||||
|
newImport.EndPos = pos
|
||||||
|
|
||||||
|
// Clean up parens. impDecl contains at least one spec.
|
||||||
|
if len(impDecl.Specs) == 1 {
|
||||||
|
// Remove unneeded parens.
|
||||||
|
impDecl.Lparen = token.NoPos
|
||||||
|
} else if !impDecl.Lparen.IsValid() {
|
||||||
|
// impDecl needs parens added.
|
||||||
|
impDecl.Lparen = impDecl.Specs[0].Pos()
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Imports = append(f.Imports, newImport)
|
||||||
|
|
||||||
|
if len(f.Decls) <= 1 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge all the import declarations into the first one.
|
||||||
|
var first *ast.GenDecl
|
||||||
|
for i := 0; i < len(f.Decls); i++ {
|
||||||
|
decl := f.Decls[i]
|
||||||
|
gen, ok := decl.(*ast.GenDecl)
|
||||||
|
if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if first == nil {
|
||||||
|
first = gen
|
||||||
|
continue // Don't touch the first one.
|
||||||
|
}
|
||||||
|
// We now know there is more than one package in this import
|
||||||
|
// declaration. Ensure that it ends up parenthesized.
|
||||||
|
first.Lparen = first.Pos()
|
||||||
|
// Move the imports of the other import declaration to the first one.
|
||||||
|
for _, spec := range gen.Specs {
|
||||||
|
spec.(*ast.ImportSpec).Path.ValuePos = first.Pos()
|
||||||
|
first.Specs = append(first.Specs, spec)
|
||||||
|
}
|
||||||
|
f.Decls = append(f.Decls[:i], f.Decls[i+1:]...)
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func isThirdParty(importPath string) bool {
|
||||||
|
// Third party package import path usually contains "." (".com", ".org", ...)
|
||||||
|
// This logic is taken from golang.org/x/tools/imports package.
|
||||||
|
return strings.Contains(importPath, ".")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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) {
|
||||||
|
return DeleteNamedImport(fset, f, "", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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) {
|
||||||
|
var delspecs []*ast.ImportSpec
|
||||||
|
var delcomments []*ast.CommentGroup
|
||||||
|
|
||||||
|
// Find the import nodes that import path, if any.
|
||||||
|
for i := 0; i < len(f.Decls); i++ {
|
||||||
|
decl := f.Decls[i]
|
||||||
|
gen, ok := decl.(*ast.GenDecl)
|
||||||
|
if !ok || gen.Tok != token.IMPORT {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for j := 0; j < len(gen.Specs); j++ {
|
||||||
|
spec := gen.Specs[j]
|
||||||
|
impspec := spec.(*ast.ImportSpec)
|
||||||
|
if importName(impspec) != name || importPath(impspec) != path {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// We found an import spec that imports path.
|
||||||
|
// Delete it.
|
||||||
|
delspecs = append(delspecs, impspec)
|
||||||
|
deleted = true
|
||||||
|
copy(gen.Specs[j:], gen.Specs[j+1:])
|
||||||
|
gen.Specs = gen.Specs[:len(gen.Specs)-1]
|
||||||
|
|
||||||
|
// If this was the last import spec in this decl,
|
||||||
|
// delete the decl, too.
|
||||||
|
if len(gen.Specs) == 0 {
|
||||||
|
copy(f.Decls[i:], f.Decls[i+1:])
|
||||||
|
f.Decls = f.Decls[:len(f.Decls)-1]
|
||||||
|
i--
|
||||||
|
break
|
||||||
|
} else if len(gen.Specs) == 1 {
|
||||||
|
if impspec.Doc != nil {
|
||||||
|
delcomments = append(delcomments, impspec.Doc)
|
||||||
|
}
|
||||||
|
if impspec.Comment != nil {
|
||||||
|
delcomments = append(delcomments, impspec.Comment)
|
||||||
|
}
|
||||||
|
for _, cg := range f.Comments {
|
||||||
|
// Found comment on the same line as the import spec.
|
||||||
|
if cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line {
|
||||||
|
delcomments = append(delcomments, cg)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spec := gen.Specs[0].(*ast.ImportSpec)
|
||||||
|
|
||||||
|
// Move the documentation right after the import decl.
|
||||||
|
if spec.Doc != nil {
|
||||||
|
for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Doc.Pos()).Line {
|
||||||
|
fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, cg := range f.Comments {
|
||||||
|
if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line {
|
||||||
|
for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Pos()).Line {
|
||||||
|
fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if j > 0 {
|
||||||
|
lastImpspec := gen.Specs[j-1].(*ast.ImportSpec)
|
||||||
|
lastLine := fset.Position(lastImpspec.Path.ValuePos).Line
|
||||||
|
line := fset.Position(impspec.Path.ValuePos).Line
|
||||||
|
|
||||||
|
// We deleted an entry but now there may be
|
||||||
|
// a blank line-sized hole where the import was.
|
||||||
|
if line-lastLine > 1 {
|
||||||
|
// There was a blank line immediately preceding the deleted import,
|
||||||
|
// so there's no need to close the hole.
|
||||||
|
// Do nothing.
|
||||||
|
} else if line != fset.File(gen.Rparen).LineCount() {
|
||||||
|
// There was no blank line. Close the hole.
|
||||||
|
fset.File(gen.Rparen).MergeLine(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
j--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete imports from f.Imports.
|
||||||
|
for i := 0; i < len(f.Imports); i++ {
|
||||||
|
imp := f.Imports[i]
|
||||||
|
for j, del := range delspecs {
|
||||||
|
if imp == del {
|
||||||
|
copy(f.Imports[i:], f.Imports[i+1:])
|
||||||
|
f.Imports = f.Imports[:len(f.Imports)-1]
|
||||||
|
copy(delspecs[j:], delspecs[j+1:])
|
||||||
|
delspecs = delspecs[:len(delspecs)-1]
|
||||||
|
i--
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete comments from f.Comments.
|
||||||
|
for i := 0; i < len(f.Comments); i++ {
|
||||||
|
cg := f.Comments[i]
|
||||||
|
for j, del := range delcomments {
|
||||||
|
if cg == del {
|
||||||
|
copy(f.Comments[i:], f.Comments[i+1:])
|
||||||
|
f.Comments = f.Comments[:len(f.Comments)-1]
|
||||||
|
copy(delcomments[j:], delcomments[j+1:])
|
||||||
|
delcomments = delcomments[:len(delcomments)-1]
|
||||||
|
i--
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(delspecs) > 0 {
|
||||||
|
panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs))
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RewriteImport rewrites any import of path oldPath to path newPath.
|
||||||
|
func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) {
|
||||||
|
for _, imp := range f.Imports {
|
||||||
|
if importPath(imp) == oldPath {
|
||||||
|
rewrote = true
|
||||||
|
// record old End, because the default is to compute
|
||||||
|
// it using the length of imp.Path.Value.
|
||||||
|
imp.EndPos = imp.End()
|
||||||
|
imp.Path.Value = strconv.Quote(newPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UsesImport reports whether a given import is used.
|
||||||
|
func UsesImport(f *ast.File, path string) (used bool) {
|
||||||
|
spec := importSpec(f, path)
|
||||||
|
if spec == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
name := spec.Name.String()
|
||||||
|
switch name {
|
||||||
|
case "<nil>":
|
||||||
|
// If the package name is not explicitly specified,
|
||||||
|
// make an educated guess. This is not guaranteed to be correct.
|
||||||
|
lastSlash := strings.LastIndex(path, "/")
|
||||||
|
if lastSlash == -1 {
|
||||||
|
name = path
|
||||||
|
} else {
|
||||||
|
name = path[lastSlash+1:]
|
||||||
|
}
|
||||||
|
case "_", ".":
|
||||||
|
// Not sure if this import is used - err on the side of caution.
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
ast.Walk(visitFn(func(n ast.Node) {
|
||||||
|
sel, ok := n.(*ast.SelectorExpr)
|
||||||
|
if ok && isTopName(sel.X, name) {
|
||||||
|
used = true
|
||||||
|
}
|
||||||
|
}), f)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type visitFn func(node ast.Node)
|
||||||
|
|
||||||
|
func (fn visitFn) Visit(node ast.Node) ast.Visitor {
|
||||||
|
fn(node)
|
||||||
|
return fn
|
||||||
|
}
|
||||||
|
|
||||||
|
// imports reports whether f has an import with the specified name and path.
|
||||||
|
func imports(f *ast.File, name, path string) bool {
|
||||||
|
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,
|
||||||
|
// or nil otherwise.
|
||||||
|
func importSpec(f *ast.File, path string) *ast.ImportSpec {
|
||||||
|
for _, s := range f.Imports {
|
||||||
|
if importPath(s) == path {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
// or "" if the path is not properly quoted.
|
||||||
|
func importPath(s *ast.ImportSpec) string {
|
||||||
|
t, err := strconv.Unquote(s.Path.Value)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
// declImports reports whether gen contains an import of path.
|
||||||
|
func declImports(gen *ast.GenDecl, path string) bool {
|
||||||
|
if gen.Tok != token.IMPORT {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, spec := range gen.Specs {
|
||||||
|
impspec := spec.(*ast.ImportSpec)
|
||||||
|
if importPath(impspec) == path {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// matchLen returns the length of the longest path segment prefix shared by x and y.
|
||||||
|
func matchLen(x, y string) int {
|
||||||
|
n := 0
|
||||||
|
for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ {
|
||||||
|
if x[i] == '/' {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
// isTopName returns true if n is a top-level unresolved identifier with the given name.
|
||||||
|
func isTopName(n ast.Expr, name string) bool {
|
||||||
|
id, ok := n.(*ast.Ident)
|
||||||
|
return ok && id.Name == name && id.Obj == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imports returns the file imports grouped by paragraph.
|
||||||
|
func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec {
|
||||||
|
var groups [][]*ast.ImportSpec
|
||||||
|
|
||||||
|
for _, decl := range f.Decls {
|
||||||
|
genDecl, ok := decl.(*ast.GenDecl)
|
||||||
|
if !ok || genDecl.Tok != token.IMPORT {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
group := []*ast.ImportSpec{}
|
||||||
|
|
||||||
|
var lastLine int
|
||||||
|
for _, spec := range genDecl.Specs {
|
||||||
|
importSpec := spec.(*ast.ImportSpec)
|
||||||
|
pos := importSpec.Path.ValuePos
|
||||||
|
line := fset.Position(pos).Line
|
||||||
|
if lastLine > 0 && pos > 0 && line-lastLine > 1 {
|
||||||
|
groups = append(groups, group)
|
||||||
|
group = []*ast.ImportSpec{}
|
||||||
|
}
|
||||||
|
group = append(group, importSpec)
|
||||||
|
lastLine = line
|
||||||
|
}
|
||||||
|
groups = append(groups, group)
|
||||||
|
}
|
||||||
|
|
||||||
|
return groups
|
||||||
|
}
|
477
vendor/golang.org/x/tools/go/ast/astutil/rewrite.go
generated
vendored
Normal file
477
vendor/golang.org/x/tools/go/ast/astutil/rewrite.go
generated
vendored
Normal file
|
@ -0,0 +1,477 @@
|
||||||
|
// Copyright 2017 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 astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
// An ApplyFunc is invoked by Apply for each node n, even if n is nil,
|
||||||
|
// before and/or after the node's children, using a Cursor describing
|
||||||
|
// the current node and providing operations on it.
|
||||||
|
//
|
||||||
|
// The return value of ApplyFunc controls the syntax tree traversal.
|
||||||
|
// See Apply for details.
|
||||||
|
type ApplyFunc func(*Cursor) bool
|
||||||
|
|
||||||
|
// Apply traverses a syntax tree recursively, starting with root,
|
||||||
|
// and calling pre and post for each node as described below.
|
||||||
|
// Apply returns the syntax tree, possibly modified.
|
||||||
|
//
|
||||||
|
// If pre is not nil, it is called for each node before the node's
|
||||||
|
// children are traversed (pre-order). If pre returns false, no
|
||||||
|
// children are traversed, and post is not called for that node.
|
||||||
|
//
|
||||||
|
// If post is not nil, and a prior call of pre didn't return false,
|
||||||
|
// post is called for each node after its children are traversed
|
||||||
|
// (post-order). If post returns false, traversal is terminated and
|
||||||
|
// Apply returns immediately.
|
||||||
|
//
|
||||||
|
// Only fields that refer to AST nodes are considered children;
|
||||||
|
// i.e., token.Pos, Scopes, Objects, and fields of basic types
|
||||||
|
// (strings, etc.) are ignored.
|
||||||
|
//
|
||||||
|
// Children are traversed in the order in which they appear in the
|
||||||
|
// respective node's struct definition. A package's files are
|
||||||
|
// traversed in the filenames' alphabetical order.
|
||||||
|
//
|
||||||
|
func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) {
|
||||||
|
parent := &struct{ ast.Node }{root}
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil && r != abort {
|
||||||
|
panic(r)
|
||||||
|
}
|
||||||
|
result = parent.Node
|
||||||
|
}()
|
||||||
|
a := &application{pre: pre, post: post}
|
||||||
|
a.apply(parent, "Node", nil, root)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var abort = new(int) // singleton, to signal termination of Apply
|
||||||
|
|
||||||
|
// A Cursor describes a node encountered during Apply.
|
||||||
|
// Information about the node and its parent is available
|
||||||
|
// from the Node, Parent, Name, and Index methods.
|
||||||
|
//
|
||||||
|
// If p is a variable of type and value of the current parent node
|
||||||
|
// c.Parent(), and f is the field identifier with name c.Name(),
|
||||||
|
// the following invariants hold:
|
||||||
|
//
|
||||||
|
// p.f == c.Node() if c.Index() < 0
|
||||||
|
// p.f[c.Index()] == c.Node() if c.Index() >= 0
|
||||||
|
//
|
||||||
|
// The methods Replace, Delete, InsertBefore, and InsertAfter
|
||||||
|
// can be used to change the AST without disrupting Apply.
|
||||||
|
type Cursor struct {
|
||||||
|
parent ast.Node
|
||||||
|
name string
|
||||||
|
iter *iterator // valid if non-nil
|
||||||
|
node ast.Node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node returns the current Node.
|
||||||
|
func (c *Cursor) Node() ast.Node { return c.node }
|
||||||
|
|
||||||
|
// Parent returns the parent of the current Node.
|
||||||
|
func (c *Cursor) Parent() ast.Node { return c.parent }
|
||||||
|
|
||||||
|
// Name returns the name of the parent Node field that contains the current Node.
|
||||||
|
// If the parent is a *ast.Package and the current Node is a *ast.File, Name returns
|
||||||
|
// the filename for the current Node.
|
||||||
|
func (c *Cursor) Name() string { return c.name }
|
||||||
|
|
||||||
|
// Index reports the index >= 0 of the current Node in the slice of Nodes that
|
||||||
|
// contains it, or a value < 0 if the current Node is not part of a slice.
|
||||||
|
// The index of the current node changes if InsertBefore is called while
|
||||||
|
// processing the current node.
|
||||||
|
func (c *Cursor) Index() int {
|
||||||
|
if c.iter != nil {
|
||||||
|
return c.iter.index
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
// field returns the current node's parent field value.
|
||||||
|
func (c *Cursor) field() reflect.Value {
|
||||||
|
return reflect.Indirect(reflect.ValueOf(c.parent)).FieldByName(c.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace replaces the current Node with n.
|
||||||
|
// The replacement node is not walked by Apply.
|
||||||
|
func (c *Cursor) Replace(n ast.Node) {
|
||||||
|
if _, ok := c.node.(*ast.File); ok {
|
||||||
|
file, ok := n.(*ast.File)
|
||||||
|
if !ok {
|
||||||
|
panic("attempt to replace *ast.File with non-*ast.File")
|
||||||
|
}
|
||||||
|
c.parent.(*ast.Package).Files[c.name] = file
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
v := c.field()
|
||||||
|
if i := c.Index(); i >= 0 {
|
||||||
|
v = v.Index(i)
|
||||||
|
}
|
||||||
|
v.Set(reflect.ValueOf(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the current Node from its containing slice.
|
||||||
|
// If the current Node is not part of a slice, Delete panics.
|
||||||
|
// As a special case, if the current node is a package file,
|
||||||
|
// Delete removes it from the package's Files map.
|
||||||
|
func (c *Cursor) Delete() {
|
||||||
|
if _, ok := c.node.(*ast.File); ok {
|
||||||
|
delete(c.parent.(*ast.Package).Files, c.name)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
i := c.Index()
|
||||||
|
if i < 0 {
|
||||||
|
panic("Delete node not contained in slice")
|
||||||
|
}
|
||||||
|
v := c.field()
|
||||||
|
l := v.Len()
|
||||||
|
reflect.Copy(v.Slice(i, l), v.Slice(i+1, l))
|
||||||
|
v.Index(l - 1).Set(reflect.Zero(v.Type().Elem()))
|
||||||
|
v.SetLen(l - 1)
|
||||||
|
c.iter.step--
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertAfter inserts n after the current Node in its containing slice.
|
||||||
|
// If the current Node is not part of a slice, InsertAfter panics.
|
||||||
|
// Apply does not walk n.
|
||||||
|
func (c *Cursor) InsertAfter(n ast.Node) {
|
||||||
|
i := c.Index()
|
||||||
|
if i < 0 {
|
||||||
|
panic("InsertAfter node not contained in slice")
|
||||||
|
}
|
||||||
|
v := c.field()
|
||||||
|
v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem())))
|
||||||
|
l := v.Len()
|
||||||
|
reflect.Copy(v.Slice(i+2, l), v.Slice(i+1, l))
|
||||||
|
v.Index(i + 1).Set(reflect.ValueOf(n))
|
||||||
|
c.iter.step++
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertBefore inserts n before the current Node in its containing slice.
|
||||||
|
// If the current Node is not part of a slice, InsertBefore panics.
|
||||||
|
// Apply will not walk n.
|
||||||
|
func (c *Cursor) InsertBefore(n ast.Node) {
|
||||||
|
i := c.Index()
|
||||||
|
if i < 0 {
|
||||||
|
panic("InsertBefore node not contained in slice")
|
||||||
|
}
|
||||||
|
v := c.field()
|
||||||
|
v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem())))
|
||||||
|
l := v.Len()
|
||||||
|
reflect.Copy(v.Slice(i+1, l), v.Slice(i, l))
|
||||||
|
v.Index(i).Set(reflect.ValueOf(n))
|
||||||
|
c.iter.index++
|
||||||
|
}
|
||||||
|
|
||||||
|
// application carries all the shared data so we can pass it around cheaply.
|
||||||
|
type application struct {
|
||||||
|
pre, post ApplyFunc
|
||||||
|
cursor Cursor
|
||||||
|
iter iterator
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) {
|
||||||
|
// convert typed nil into untyped nil
|
||||||
|
if v := reflect.ValueOf(n); v.Kind() == reflect.Ptr && v.IsNil() {
|
||||||
|
n = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// avoid heap-allocating a new cursor for each apply call; reuse a.cursor instead
|
||||||
|
saved := a.cursor
|
||||||
|
a.cursor.parent = parent
|
||||||
|
a.cursor.name = name
|
||||||
|
a.cursor.iter = iter
|
||||||
|
a.cursor.node = n
|
||||||
|
|
||||||
|
if a.pre != nil && !a.pre(&a.cursor) {
|
||||||
|
a.cursor = saved
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// walk children
|
||||||
|
// (the order of the cases matches the order of the corresponding node types in go/ast)
|
||||||
|
switch n := n.(type) {
|
||||||
|
case nil:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
// Comments and fields
|
||||||
|
case *ast.Comment:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
case *ast.CommentGroup:
|
||||||
|
if n != nil {
|
||||||
|
a.applyList(n, "List")
|
||||||
|
}
|
||||||
|
|
||||||
|
case *ast.Field:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.applyList(n, "Names")
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.apply(n, "Tag", nil, n.Tag)
|
||||||
|
a.apply(n, "Comment", nil, n.Comment)
|
||||||
|
|
||||||
|
case *ast.FieldList:
|
||||||
|
a.applyList(n, "List")
|
||||||
|
|
||||||
|
// Expressions
|
||||||
|
case *ast.BadExpr, *ast.Ident, *ast.BasicLit:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
case *ast.Ellipsis:
|
||||||
|
a.apply(n, "Elt", nil, n.Elt)
|
||||||
|
|
||||||
|
case *ast.FuncLit:
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
case *ast.CompositeLit:
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.applyList(n, "Elts")
|
||||||
|
|
||||||
|
case *ast.ParenExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
|
||||||
|
case *ast.SelectorExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Sel", nil, n.Sel)
|
||||||
|
|
||||||
|
case *ast.IndexExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Index", nil, n.Index)
|
||||||
|
|
||||||
|
case *ast.SliceExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Low", nil, n.Low)
|
||||||
|
a.apply(n, "High", nil, n.High)
|
||||||
|
a.apply(n, "Max", nil, n.Max)
|
||||||
|
|
||||||
|
case *ast.TypeAssertExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
|
||||||
|
case *ast.CallExpr:
|
||||||
|
a.apply(n, "Fun", nil, n.Fun)
|
||||||
|
a.applyList(n, "Args")
|
||||||
|
|
||||||
|
case *ast.StarExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
|
||||||
|
case *ast.UnaryExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
|
||||||
|
case *ast.BinaryExpr:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Y", nil, n.Y)
|
||||||
|
|
||||||
|
case *ast.KeyValueExpr:
|
||||||
|
a.apply(n, "Key", nil, n.Key)
|
||||||
|
a.apply(n, "Value", nil, n.Value)
|
||||||
|
|
||||||
|
// Types
|
||||||
|
case *ast.ArrayType:
|
||||||
|
a.apply(n, "Len", nil, n.Len)
|
||||||
|
a.apply(n, "Elt", nil, n.Elt)
|
||||||
|
|
||||||
|
case *ast.StructType:
|
||||||
|
a.apply(n, "Fields", nil, n.Fields)
|
||||||
|
|
||||||
|
case *ast.FuncType:
|
||||||
|
a.apply(n, "Params", nil, n.Params)
|
||||||
|
a.apply(n, "Results", nil, n.Results)
|
||||||
|
|
||||||
|
case *ast.InterfaceType:
|
||||||
|
a.apply(n, "Methods", nil, n.Methods)
|
||||||
|
|
||||||
|
case *ast.MapType:
|
||||||
|
a.apply(n, "Key", nil, n.Key)
|
||||||
|
a.apply(n, "Value", nil, n.Value)
|
||||||
|
|
||||||
|
case *ast.ChanType:
|
||||||
|
a.apply(n, "Value", nil, n.Value)
|
||||||
|
|
||||||
|
// Statements
|
||||||
|
case *ast.BadStmt:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
case *ast.DeclStmt:
|
||||||
|
a.apply(n, "Decl", nil, n.Decl)
|
||||||
|
|
||||||
|
case *ast.EmptyStmt:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
case *ast.LabeledStmt:
|
||||||
|
a.apply(n, "Label", nil, n.Label)
|
||||||
|
a.apply(n, "Stmt", nil, n.Stmt)
|
||||||
|
|
||||||
|
case *ast.ExprStmt:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
|
||||||
|
case *ast.SendStmt:
|
||||||
|
a.apply(n, "Chan", nil, n.Chan)
|
||||||
|
a.apply(n, "Value", nil, n.Value)
|
||||||
|
|
||||||
|
case *ast.IncDecStmt:
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
|
||||||
|
case *ast.AssignStmt:
|
||||||
|
a.applyList(n, "Lhs")
|
||||||
|
a.applyList(n, "Rhs")
|
||||||
|
|
||||||
|
case *ast.GoStmt:
|
||||||
|
a.apply(n, "Call", nil, n.Call)
|
||||||
|
|
||||||
|
case *ast.DeferStmt:
|
||||||
|
a.apply(n, "Call", nil, n.Call)
|
||||||
|
|
||||||
|
case *ast.ReturnStmt:
|
||||||
|
a.applyList(n, "Results")
|
||||||
|
|
||||||
|
case *ast.BranchStmt:
|
||||||
|
a.apply(n, "Label", nil, n.Label)
|
||||||
|
|
||||||
|
case *ast.BlockStmt:
|
||||||
|
a.applyList(n, "List")
|
||||||
|
|
||||||
|
case *ast.IfStmt:
|
||||||
|
a.apply(n, "Init", nil, n.Init)
|
||||||
|
a.apply(n, "Cond", nil, n.Cond)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
a.apply(n, "Else", nil, n.Else)
|
||||||
|
|
||||||
|
case *ast.CaseClause:
|
||||||
|
a.applyList(n, "List")
|
||||||
|
a.applyList(n, "Body")
|
||||||
|
|
||||||
|
case *ast.SwitchStmt:
|
||||||
|
a.apply(n, "Init", nil, n.Init)
|
||||||
|
a.apply(n, "Tag", nil, n.Tag)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
case *ast.TypeSwitchStmt:
|
||||||
|
a.apply(n, "Init", nil, n.Init)
|
||||||
|
a.apply(n, "Assign", nil, n.Assign)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
case *ast.CommClause:
|
||||||
|
a.apply(n, "Comm", nil, n.Comm)
|
||||||
|
a.applyList(n, "Body")
|
||||||
|
|
||||||
|
case *ast.SelectStmt:
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
case *ast.ForStmt:
|
||||||
|
a.apply(n, "Init", nil, n.Init)
|
||||||
|
a.apply(n, "Cond", nil, n.Cond)
|
||||||
|
a.apply(n, "Post", nil, n.Post)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
case *ast.RangeStmt:
|
||||||
|
a.apply(n, "Key", nil, n.Key)
|
||||||
|
a.apply(n, "Value", nil, n.Value)
|
||||||
|
a.apply(n, "X", nil, n.X)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
// Declarations
|
||||||
|
case *ast.ImportSpec:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.apply(n, "Name", nil, n.Name)
|
||||||
|
a.apply(n, "Path", nil, n.Path)
|
||||||
|
a.apply(n, "Comment", nil, n.Comment)
|
||||||
|
|
||||||
|
case *ast.ValueSpec:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.applyList(n, "Names")
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.applyList(n, "Values")
|
||||||
|
a.apply(n, "Comment", nil, n.Comment)
|
||||||
|
|
||||||
|
case *ast.TypeSpec:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.apply(n, "Name", nil, n.Name)
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.apply(n, "Comment", nil, n.Comment)
|
||||||
|
|
||||||
|
case *ast.BadDecl:
|
||||||
|
// nothing to do
|
||||||
|
|
||||||
|
case *ast.GenDecl:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.applyList(n, "Specs")
|
||||||
|
|
||||||
|
case *ast.FuncDecl:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.apply(n, "Recv", nil, n.Recv)
|
||||||
|
a.apply(n, "Name", nil, n.Name)
|
||||||
|
a.apply(n, "Type", nil, n.Type)
|
||||||
|
a.apply(n, "Body", nil, n.Body)
|
||||||
|
|
||||||
|
// Files and packages
|
||||||
|
case *ast.File:
|
||||||
|
a.apply(n, "Doc", nil, n.Doc)
|
||||||
|
a.apply(n, "Name", nil, n.Name)
|
||||||
|
a.applyList(n, "Decls")
|
||||||
|
// Don't walk n.Comments; they have either been walked already if
|
||||||
|
// they are Doc comments, or they can be easily walked explicitly.
|
||||||
|
|
||||||
|
case *ast.Package:
|
||||||
|
// collect and sort names for reproducible behavior
|
||||||
|
var names []string
|
||||||
|
for name := range n.Files {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
sort.Strings(names)
|
||||||
|
for _, name := range names {
|
||||||
|
a.apply(n, name, nil, n.Files[name])
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.post != nil && !a.post(&a.cursor) {
|
||||||
|
panic(abort)
|
||||||
|
}
|
||||||
|
|
||||||
|
a.cursor = saved
|
||||||
|
}
|
||||||
|
|
||||||
|
// An iterator controls iteration over a slice of nodes.
|
||||||
|
type iterator struct {
|
||||||
|
index, step int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *application) applyList(parent ast.Node, name string) {
|
||||||
|
// avoid heap-allocating a new iterator for each applyList call; reuse a.iter instead
|
||||||
|
saved := a.iter
|
||||||
|
a.iter.index = 0
|
||||||
|
for {
|
||||||
|
// must reload parent.name each time, since cursor modifications might change it
|
||||||
|
v := reflect.Indirect(reflect.ValueOf(parent)).FieldByName(name)
|
||||||
|
if a.iter.index >= v.Len() {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// element x may be nil in a bad AST - be cautious
|
||||||
|
var x ast.Node
|
||||||
|
if e := v.Index(a.iter.index); e.IsValid() {
|
||||||
|
x = e.Interface().(ast.Node)
|
||||||
|
}
|
||||||
|
|
||||||
|
a.iter.step = 1
|
||||||
|
a.apply(parent, name, &a.iter, x)
|
||||||
|
a.iter.index += a.iter.step
|
||||||
|
}
|
||||||
|
a.iter = saved
|
||||||
|
}
|
14
vendor/golang.org/x/tools/go/ast/astutil/util.go
generated
vendored
Normal file
14
vendor/golang.org/x/tools/go/ast/astutil/util.go
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package astutil
|
||||||
|
|
||||||
|
import "go/ast"
|
||||||
|
|
||||||
|
// Unparen returns e with any enclosing parentheses stripped.
|
||||||
|
func Unparen(e ast.Expr) ast.Expr {
|
||||||
|
for {
|
||||||
|
p, ok := e.(*ast.ParenExpr)
|
||||||
|
if !ok {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
e = p.X
|
||||||
|
}
|
||||||
|
}
|
109
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
Normal file
109
vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
// Copyright 2016 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 gcexportdata provides functions for locating, reading, and
|
||||||
|
// writing export data files containing type information produced by the
|
||||||
|
// gc compiler. This package supports go1.7 export data format and all
|
||||||
|
// later versions.
|
||||||
|
//
|
||||||
|
// Although it might seem convenient for this package to live alongside
|
||||||
|
// go/types in the standard library, this would cause version skew
|
||||||
|
// problems for developer tools that use it, since they must be able to
|
||||||
|
// consume the outputs of the gc compiler both before and after a Go
|
||||||
|
// update such as from Go 1.7 to Go 1.8. Because this package lives in
|
||||||
|
// golang.org/x/tools, sites can update their version of this repo some
|
||||||
|
// time before the Go 1.8 release and rebuild and redeploy their
|
||||||
|
// 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 update. (See discussion at https://golang.org/issue/15651.)
|
||||||
|
//
|
||||||
|
package gcexportdata // import "golang.org/x/tools/go/gcexportdata"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
|
||||||
|
"golang.org/x/tools/go/internal/gcimporter"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Find returns the name of an object (.o) or archive (.a) file
|
||||||
|
// containing type information for the specified import path,
|
||||||
|
// using the workspace layout conventions of go/build.
|
||||||
|
// If no file was found, an empty filename is returned.
|
||||||
|
//
|
||||||
|
// A relative srcDir is interpreted relative to the current working directory.
|
||||||
|
//
|
||||||
|
// Find also returns the package's resolved (canonical) import path,
|
||||||
|
// reflecting the effects of srcDir and vendoring on importPath.
|
||||||
|
func Find(importPath, srcDir string) (filename, path string) {
|
||||||
|
return gcimporter.FindPkg(importPath, srcDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewReader returns a reader for the export data section of an object
|
||||||
|
// (.o) or archive (.a) file read from r. The new reader may provide
|
||||||
|
// additional trailing data beyond the end of the export data.
|
||||||
|
func NewReader(r io.Reader) (io.Reader, error) {
|
||||||
|
buf := bufio.NewReader(r)
|
||||||
|
_, err := gcimporter.FindExportData(buf)
|
||||||
|
// If we ever switch to a zip-like archive format with the ToC
|
||||||
|
// at the end, we can return the correct portion of export data,
|
||||||
|
// but for now we must return the entire rest of the file.
|
||||||
|
return buf, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read reads export data from in, decodes it, and returns type
|
||||||
|
// information for the package.
|
||||||
|
// The package name is specified by path.
|
||||||
|
// File position information is added to fset.
|
||||||
|
//
|
||||||
|
// Read may inspect and add to the imports map to ensure that references
|
||||||
|
// within the export data to other packages are consistent. The caller
|
||||||
|
// must ensure that imports[path] does not exist, or exists but is
|
||||||
|
// incomplete (see types.Package.Complete), and Read inserts the
|
||||||
|
// resulting package into this map entry.
|
||||||
|
//
|
||||||
|
// On return, the state of the reader is undefined.
|
||||||
|
func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error) {
|
||||||
|
data, err := ioutil.ReadAll(in)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("reading export data for %q: %v", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if bytes.HasPrefix(data, []byte("!<arch>")) {
|
||||||
|
return nil, fmt.Errorf("can't read export data for %q directly from an archive file (call gcexportdata.NewReader first to extract export data)", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The App Engine Go runtime v1.6 uses the old export data format.
|
||||||
|
// TODO(adonovan): delete once v1.7 has been around for a while.
|
||||||
|
if bytes.HasPrefix(data, []byte("package ")) {
|
||||||
|
return gcimporter.ImportData(imports, path, path, bytes.NewReader(data))
|
||||||
|
}
|
||||||
|
|
||||||
|
// The indexed export format starts with an 'i'; the older
|
||||||
|
// binary export format starts with a 'c', 'd', or 'v'
|
||||||
|
// (from "version"). Select appropriate importer.
|
||||||
|
if len(data) > 0 && data[0] == 'i' {
|
||||||
|
_, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path)
|
||||||
|
return pkg, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, pkg, err := gcimporter.BImportData(fset, imports, data, path)
|
||||||
|
return pkg, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write writes encoded type information for the specified package to out.
|
||||||
|
// The FileSet provides file position information for named objects.
|
||||||
|
func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
|
||||||
|
b, err := gcimporter.BExportData(fset, pkg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = out.Write(b)
|
||||||
|
return err
|
||||||
|
}
|
73
vendor/golang.org/x/tools/go/gcexportdata/importer.go
generated
vendored
Normal file
73
vendor/golang.org/x/tools/go/gcexportdata/importer.go
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
// Copyright 2016 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 gcexportdata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewImporter returns a new instance of the types.Importer interface
|
||||||
|
// that reads type information from export data files written by gc.
|
||||||
|
// The Importer also satisfies types.ImporterFrom.
|
||||||
|
//
|
||||||
|
// Export data files are located using "go build" workspace conventions
|
||||||
|
// and the build.Default context.
|
||||||
|
//
|
||||||
|
// Use this importer instead of go/importer.For("gc", ...) to avoid the
|
||||||
|
// version-skew problems described in the documentation of this package,
|
||||||
|
// or to control the FileSet or access the imports map populated during
|
||||||
|
// package loading.
|
||||||
|
//
|
||||||
|
func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom {
|
||||||
|
return importer{fset, imports}
|
||||||
|
}
|
||||||
|
|
||||||
|
type importer struct {
|
||||||
|
fset *token.FileSet
|
||||||
|
imports map[string]*types.Package
|
||||||
|
}
|
||||||
|
|
||||||
|
func (imp importer) Import(importPath string) (*types.Package, error) {
|
||||||
|
return imp.ImportFrom(importPath, "", 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) {
|
||||||
|
filename, path := Find(importPath, srcDir)
|
||||||
|
if filename == "" {
|
||||||
|
if importPath == "unsafe" {
|
||||||
|
// Even for unsafe, call Find first in case
|
||||||
|
// the package was vendored.
|
||||||
|
return types.Unsafe, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("can't find import: %s", importPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if pkg, ok := imp.imports[path]; ok && pkg.Complete() {
|
||||||
|
return pkg, nil // cache hit
|
||||||
|
}
|
||||||
|
|
||||||
|
// open file
|
||||||
|
f, err := os.Open(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
f.Close()
|
||||||
|
if err != nil {
|
||||||
|
// add file name to error
|
||||||
|
err = fmt.Errorf("reading export data: %s: %v", filename, err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
r, err := NewReader(f)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return Read(r, imp.fset, imp.imports, path)
|
||||||
|
}
|
99
vendor/golang.org/x/tools/go/gcexportdata/main.go
generated
vendored
Normal file
99
vendor/golang.org/x/tools/go/gcexportdata/main.go
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
// Copyright 2017 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
// The gcexportdata command is a diagnostic tool that displays the
|
||||||
|
// contents of gc export data files.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"golang.org/x/tools/go/gcexportdata"
|
||||||
|
"golang.org/x/tools/go/types/typeutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
var packageFlag = flag.String("package", "", "alternative package to print")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
log.SetPrefix("gcexportdata: ")
|
||||||
|
log.SetFlags(0)
|
||||||
|
flag.Usage = func() {
|
||||||
|
fmt.Fprintln(os.Stderr, "usage: gcexportdata [-package path] file.a")
|
||||||
|
}
|
||||||
|
flag.Parse()
|
||||||
|
if flag.NArg() != 1 {
|
||||||
|
flag.Usage()
|
||||||
|
os.Exit(2)
|
||||||
|
}
|
||||||
|
filename := flag.Args()[0]
|
||||||
|
|
||||||
|
f, err := os.Open(filename)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
r, err := gcexportdata.NewReader(f)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("%s: %s", filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode the package.
|
||||||
|
const primary = "<primary>"
|
||||||
|
imports := make(map[string]*types.Package)
|
||||||
|
fset := token.NewFileSet()
|
||||||
|
pkg, err := gcexportdata.Read(r, fset, imports, primary)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("%s: %s", filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optionally select an indirectly mentioned package.
|
||||||
|
if *packageFlag != "" {
|
||||||
|
pkg = imports[*packageFlag]
|
||||||
|
if pkg == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "export data file %s does not mention %s; has:\n",
|
||||||
|
filename, *packageFlag)
|
||||||
|
for p := range imports {
|
||||||
|
if p != primary {
|
||||||
|
fmt.Fprintf(os.Stderr, "\t%s\n", p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print all package-level declarations, including non-exported ones.
|
||||||
|
fmt.Printf("package %s\n", pkg.Name())
|
||||||
|
for _, imp := range pkg.Imports() {
|
||||||
|
fmt.Printf("import %q\n", imp.Path())
|
||||||
|
}
|
||||||
|
qual := func(p *types.Package) string {
|
||||||
|
if pkg == p {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return p.Name()
|
||||||
|
}
|
||||||
|
scope := pkg.Scope()
|
||||||
|
for _, name := range scope.Names() {
|
||||||
|
obj := scope.Lookup(name)
|
||||||
|
fmt.Printf("%s: %s\n",
|
||||||
|
fset.Position(obj.Pos()),
|
||||||
|
types.ObjectString(obj, qual))
|
||||||
|
|
||||||
|
// For types, print each method.
|
||||||
|
if _, ok := obj.(*types.TypeName); ok {
|
||||||
|
for _, method := range typeutil.IntuitiveMethodSet(obj.Type(), nil) {
|
||||||
|
fmt.Printf("%s: %s\n",
|
||||||
|
fset.Position(method.Obj().Pos()),
|
||||||
|
types.SelectionString(method, qual))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
852
vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go
generated
vendored
Normal file
852
vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go
generated
vendored
Normal file
|
@ -0,0 +1,852 @@
|
||||||
|
// Copyright 2016 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.
|
||||||
|
|
||||||
|
// Binary package export.
|
||||||
|
// This file was derived from $GOROOT/src/cmd/compile/internal/gc/bexport.go;
|
||||||
|
// see that file for specification of the format.
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/constant"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"math"
|
||||||
|
"math/big"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// If debugFormat is set, each integer and string value is preceded by a marker
|
||||||
|
// and position information in the encoding. This mechanism permits an importer
|
||||||
|
// to recognize immediately when it is out of sync. The importer recognizes this
|
||||||
|
// mode automatically (i.e., it can import export data produced with debugging
|
||||||
|
// support even if debugFormat is not set at the time of import). This mode will
|
||||||
|
// lead to massively larger export data (by a factor of 2 to 3) and should only
|
||||||
|
// be enabled during development and debugging.
|
||||||
|
//
|
||||||
|
// NOTE: This flag is the first flag to enable if importing dies because of
|
||||||
|
// (suspected) format errors, and whenever a change is made to the format.
|
||||||
|
const debugFormat = false // default: false
|
||||||
|
|
||||||
|
// If trace is set, debugging output is printed to std out.
|
||||||
|
const trace = false // default: false
|
||||||
|
|
||||||
|
// Current export format version. Increase with each format change.
|
||||||
|
// Note: The latest binary (non-indexed) export format is at version 6.
|
||||||
|
// This exporter is still at level 4, but it doesn't matter since
|
||||||
|
// the binary importer can handle older versions just fine.
|
||||||
|
// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE
|
||||||
|
// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMEMTED HERE
|
||||||
|
// 4: type name objects support type aliases, uses aliasTag
|
||||||
|
// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used)
|
||||||
|
// 2: removed unused bool in ODCL export (compiler only)
|
||||||
|
// 1: header format change (more regular), export package for _ struct fields
|
||||||
|
// 0: Go1.7 encoding
|
||||||
|
const exportVersion = 4
|
||||||
|
|
||||||
|
// trackAllTypes enables cycle tracking for all types, not just named
|
||||||
|
// types. The existing compiler invariants assume that unnamed types
|
||||||
|
// that are not completely set up are not used, or else there are spurious
|
||||||
|
// errors.
|
||||||
|
// If disabled, only named types are tracked, possibly leading to slightly
|
||||||
|
// less efficient encoding in rare cases. It also prevents the export of
|
||||||
|
// some corner-case type declarations (but those are not handled correctly
|
||||||
|
// with with the textual export format either).
|
||||||
|
// TODO(gri) enable and remove once issues caused by it are fixed
|
||||||
|
const trackAllTypes = false
|
||||||
|
|
||||||
|
type exporter struct {
|
||||||
|
fset *token.FileSet
|
||||||
|
out bytes.Buffer
|
||||||
|
|
||||||
|
// object -> index maps, indexed in order of serialization
|
||||||
|
strIndex map[string]int
|
||||||
|
pkgIndex map[*types.Package]int
|
||||||
|
typIndex map[types.Type]int
|
||||||
|
|
||||||
|
// position encoding
|
||||||
|
posInfoFormat bool
|
||||||
|
prevFile string
|
||||||
|
prevLine int
|
||||||
|
|
||||||
|
// debugging support
|
||||||
|
written int // bytes written
|
||||||
|
indent int // for trace
|
||||||
|
}
|
||||||
|
|
||||||
|
// internalError represents an error generated inside this package.
|
||||||
|
type internalError string
|
||||||
|
|
||||||
|
func (e internalError) Error() string { return "gcimporter: " + string(e) }
|
||||||
|
|
||||||
|
func internalErrorf(format string, args ...interface{}) error {
|
||||||
|
return internalError(fmt.Sprintf(format, args...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// BExportData returns binary export data for pkg.
|
||||||
|
// If no file set is provided, position info will be missing.
|
||||||
|
func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
if ierr, ok := e.(internalError); ok {
|
||||||
|
err = ierr
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Not an internal error; panic again.
|
||||||
|
panic(e)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
p := exporter{
|
||||||
|
fset: fset,
|
||||||
|
strIndex: map[string]int{"": 0}, // empty string is mapped to 0
|
||||||
|
pkgIndex: make(map[*types.Package]int),
|
||||||
|
typIndex: make(map[types.Type]int),
|
||||||
|
posInfoFormat: true, // TODO(gri) might become a flag, eventually
|
||||||
|
}
|
||||||
|
|
||||||
|
// write version info
|
||||||
|
// The version string must start with "version %d" where %d is the version
|
||||||
|
// number. Additional debugging information may follow after a blank; that
|
||||||
|
// text is ignored by the importer.
|
||||||
|
p.rawStringln(fmt.Sprintf("version %d", exportVersion))
|
||||||
|
var debug string
|
||||||
|
if debugFormat {
|
||||||
|
debug = "debug"
|
||||||
|
}
|
||||||
|
p.rawStringln(debug) // cannot use p.bool since it's affected by debugFormat; also want to see this clearly
|
||||||
|
p.bool(trackAllTypes)
|
||||||
|
p.bool(p.posInfoFormat)
|
||||||
|
|
||||||
|
// --- generic export data ---
|
||||||
|
|
||||||
|
// populate type map with predeclared "known" types
|
||||||
|
for index, typ := range predeclared() {
|
||||||
|
p.typIndex[typ] = index
|
||||||
|
}
|
||||||
|
if len(p.typIndex) != len(predeclared()) {
|
||||||
|
return nil, internalError("duplicate entries in type map?")
|
||||||
|
}
|
||||||
|
|
||||||
|
// write package data
|
||||||
|
p.pkg(pkg, true)
|
||||||
|
if trace {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
// write objects
|
||||||
|
objcount := 0
|
||||||
|
scope := pkg.Scope()
|
||||||
|
for _, name := range scope.Names() {
|
||||||
|
if !ast.IsExported(name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if trace {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
p.obj(scope.Lookup(name))
|
||||||
|
objcount++
|
||||||
|
}
|
||||||
|
|
||||||
|
// indicate end of list
|
||||||
|
if trace {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
p.tag(endTag)
|
||||||
|
|
||||||
|
// for self-verification only (redundant)
|
||||||
|
p.int(objcount)
|
||||||
|
|
||||||
|
if trace {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- end of export data ---
|
||||||
|
|
||||||
|
return p.out.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) pkg(pkg *types.Package, emptypath bool) {
|
||||||
|
if pkg == nil {
|
||||||
|
panic(internalError("unexpected nil pkg"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we saw the package before, write its index (>= 0)
|
||||||
|
if i, ok := p.pkgIndex[pkg]; ok {
|
||||||
|
p.index('P', i)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, remember the package, write the package tag (< 0) and package data
|
||||||
|
if trace {
|
||||||
|
p.tracef("P%d = { ", len(p.pkgIndex))
|
||||||
|
defer p.tracef("} ")
|
||||||
|
}
|
||||||
|
p.pkgIndex[pkg] = len(p.pkgIndex)
|
||||||
|
|
||||||
|
p.tag(packageTag)
|
||||||
|
p.string(pkg.Name())
|
||||||
|
if emptypath {
|
||||||
|
p.string("")
|
||||||
|
} else {
|
||||||
|
p.string(pkg.Path())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) obj(obj types.Object) {
|
||||||
|
switch obj := obj.(type) {
|
||||||
|
case *types.Const:
|
||||||
|
p.tag(constTag)
|
||||||
|
p.pos(obj)
|
||||||
|
p.qualifiedName(obj)
|
||||||
|
p.typ(obj.Type())
|
||||||
|
p.value(obj.Val())
|
||||||
|
|
||||||
|
case *types.TypeName:
|
||||||
|
if obj.IsAlias() {
|
||||||
|
p.tag(aliasTag)
|
||||||
|
p.pos(obj)
|
||||||
|
p.qualifiedName(obj)
|
||||||
|
} else {
|
||||||
|
p.tag(typeTag)
|
||||||
|
}
|
||||||
|
p.typ(obj.Type())
|
||||||
|
|
||||||
|
case *types.Var:
|
||||||
|
p.tag(varTag)
|
||||||
|
p.pos(obj)
|
||||||
|
p.qualifiedName(obj)
|
||||||
|
p.typ(obj.Type())
|
||||||
|
|
||||||
|
case *types.Func:
|
||||||
|
p.tag(funcTag)
|
||||||
|
p.pos(obj)
|
||||||
|
p.qualifiedName(obj)
|
||||||
|
sig := obj.Type().(*types.Signature)
|
||||||
|
p.paramList(sig.Params(), sig.Variadic())
|
||||||
|
p.paramList(sig.Results(), false)
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected object %v (%T)", obj, obj))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) pos(obj types.Object) {
|
||||||
|
if !p.posInfoFormat {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
file, line := p.fileLine(obj)
|
||||||
|
if file == p.prevFile {
|
||||||
|
// common case: write line delta
|
||||||
|
// delta == 0 means different file or no line change
|
||||||
|
delta := line - p.prevLine
|
||||||
|
p.int(delta)
|
||||||
|
if delta == 0 {
|
||||||
|
p.int(-1) // -1 means no file change
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// different file
|
||||||
|
p.int(0)
|
||||||
|
// Encode filename as length of common prefix with previous
|
||||||
|
// filename, followed by (possibly empty) suffix. Filenames
|
||||||
|
// frequently share path prefixes, so this can save a lot
|
||||||
|
// of space and make export data size less dependent on file
|
||||||
|
// path length. The suffix is unlikely to be empty because
|
||||||
|
// file names tend to end in ".go".
|
||||||
|
n := commonPrefixLen(p.prevFile, file)
|
||||||
|
p.int(n) // n >= 0
|
||||||
|
p.string(file[n:]) // write suffix only
|
||||||
|
p.prevFile = file
|
||||||
|
p.int(line)
|
||||||
|
}
|
||||||
|
p.prevLine = line
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) fileLine(obj types.Object) (file string, line int) {
|
||||||
|
if p.fset != nil {
|
||||||
|
pos := p.fset.Position(obj.Pos())
|
||||||
|
file = pos.Filename
|
||||||
|
line = pos.Line
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func commonPrefixLen(a, b string) int {
|
||||||
|
if len(a) > len(b) {
|
||||||
|
a, b = b, a
|
||||||
|
}
|
||||||
|
// len(a) <= len(b)
|
||||||
|
i := 0
|
||||||
|
for i < len(a) && a[i] == b[i] {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) qualifiedName(obj types.Object) {
|
||||||
|
p.string(obj.Name())
|
||||||
|
p.pkg(obj.Pkg(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) typ(t types.Type) {
|
||||||
|
if t == nil {
|
||||||
|
panic(internalError("nil type"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possible optimization: Anonymous pointer types *T where
|
||||||
|
// T is a named type are common. We could canonicalize all
|
||||||
|
// such types *T to a single type PT = *T. This would lead
|
||||||
|
// to at most one *T entry in typIndex, and all future *T's
|
||||||
|
// would be encoded as the respective index directly. Would
|
||||||
|
// save 1 byte (pointerTag) per *T and reduce the typIndex
|
||||||
|
// size (at the cost of a canonicalization map). We can do
|
||||||
|
// this later, without encoding format change.
|
||||||
|
|
||||||
|
// if we saw the type before, write its index (>= 0)
|
||||||
|
if i, ok := p.typIndex[t]; ok {
|
||||||
|
p.index('T', i)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, remember the type, write the type tag (< 0) and type data
|
||||||
|
if trackAllTypes {
|
||||||
|
if trace {
|
||||||
|
p.tracef("T%d = {>\n", len(p.typIndex))
|
||||||
|
defer p.tracef("<\n} ")
|
||||||
|
}
|
||||||
|
p.typIndex[t] = len(p.typIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Named:
|
||||||
|
if !trackAllTypes {
|
||||||
|
// if we don't track all types, track named types now
|
||||||
|
p.typIndex[t] = len(p.typIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.tag(namedTag)
|
||||||
|
p.pos(t.Obj())
|
||||||
|
p.qualifiedName(t.Obj())
|
||||||
|
p.typ(t.Underlying())
|
||||||
|
if !types.IsInterface(t) {
|
||||||
|
p.assocMethods(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
p.tag(arrayTag)
|
||||||
|
p.int64(t.Len())
|
||||||
|
p.typ(t.Elem())
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
p.tag(sliceTag)
|
||||||
|
p.typ(t.Elem())
|
||||||
|
|
||||||
|
case *dddSlice:
|
||||||
|
p.tag(dddTag)
|
||||||
|
p.typ(t.elem)
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
p.tag(structTag)
|
||||||
|
p.fieldList(t)
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
p.tag(pointerTag)
|
||||||
|
p.typ(t.Elem())
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
p.tag(signatureTag)
|
||||||
|
p.paramList(t.Params(), t.Variadic())
|
||||||
|
p.paramList(t.Results(), false)
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
p.tag(interfaceTag)
|
||||||
|
p.iface(t)
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
p.tag(mapTag)
|
||||||
|
p.typ(t.Key())
|
||||||
|
p.typ(t.Elem())
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
p.tag(chanTag)
|
||||||
|
p.int(int(3 - t.Dir())) // hack
|
||||||
|
p.typ(t.Elem())
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected type %T: %s", t, t))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) assocMethods(named *types.Named) {
|
||||||
|
// Sort methods (for determinism).
|
||||||
|
var methods []*types.Func
|
||||||
|
for i := 0; i < named.NumMethods(); i++ {
|
||||||
|
methods = append(methods, named.Method(i))
|
||||||
|
}
|
||||||
|
sort.Sort(methodsByName(methods))
|
||||||
|
|
||||||
|
p.int(len(methods))
|
||||||
|
|
||||||
|
if trace && methods != nil {
|
||||||
|
p.tracef("associated methods {>\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, m := range methods {
|
||||||
|
if trace && i > 0 {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
p.pos(m)
|
||||||
|
name := m.Name()
|
||||||
|
p.string(name)
|
||||||
|
if !exported(name) {
|
||||||
|
p.pkg(m.Pkg(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
sig := m.Type().(*types.Signature)
|
||||||
|
p.paramList(types.NewTuple(sig.Recv()), false)
|
||||||
|
p.paramList(sig.Params(), sig.Variadic())
|
||||||
|
p.paramList(sig.Results(), false)
|
||||||
|
p.int(0) // dummy value for go:nointerface pragma - ignored by importer
|
||||||
|
}
|
||||||
|
|
||||||
|
if trace && methods != nil {
|
||||||
|
p.tracef("<\n} ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type methodsByName []*types.Func
|
||||||
|
|
||||||
|
func (x methodsByName) Len() int { return len(x) }
|
||||||
|
func (x methodsByName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||||
|
func (x methodsByName) Less(i, j int) bool { return x[i].Name() < x[j].Name() }
|
||||||
|
|
||||||
|
func (p *exporter) fieldList(t *types.Struct) {
|
||||||
|
if trace && t.NumFields() > 0 {
|
||||||
|
p.tracef("fields {>\n")
|
||||||
|
defer p.tracef("<\n} ")
|
||||||
|
}
|
||||||
|
|
||||||
|
p.int(t.NumFields())
|
||||||
|
for i := 0; i < t.NumFields(); i++ {
|
||||||
|
if trace && i > 0 {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
p.field(t.Field(i))
|
||||||
|
p.string(t.Tag(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) field(f *types.Var) {
|
||||||
|
if !f.IsField() {
|
||||||
|
panic(internalError("field expected"))
|
||||||
|
}
|
||||||
|
|
||||||
|
p.pos(f)
|
||||||
|
p.fieldName(f)
|
||||||
|
p.typ(f.Type())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) iface(t *types.Interface) {
|
||||||
|
// TODO(gri): enable importer to load embedded interfaces,
|
||||||
|
// then emit Embeddeds and ExplicitMethods separately here.
|
||||||
|
p.int(0)
|
||||||
|
|
||||||
|
n := t.NumMethods()
|
||||||
|
if trace && n > 0 {
|
||||||
|
p.tracef("methods {>\n")
|
||||||
|
defer p.tracef("<\n} ")
|
||||||
|
}
|
||||||
|
p.int(n)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
if trace && i > 0 {
|
||||||
|
p.tracef("\n")
|
||||||
|
}
|
||||||
|
p.method(t.Method(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) method(m *types.Func) {
|
||||||
|
sig := m.Type().(*types.Signature)
|
||||||
|
if sig.Recv() == nil {
|
||||||
|
panic(internalError("method expected"))
|
||||||
|
}
|
||||||
|
|
||||||
|
p.pos(m)
|
||||||
|
p.string(m.Name())
|
||||||
|
if m.Name() != "_" && !ast.IsExported(m.Name()) {
|
||||||
|
p.pkg(m.Pkg(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// interface method; no need to encode receiver.
|
||||||
|
p.paramList(sig.Params(), sig.Variadic())
|
||||||
|
p.paramList(sig.Results(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) fieldName(f *types.Var) {
|
||||||
|
name := f.Name()
|
||||||
|
|
||||||
|
if f.Anonymous() {
|
||||||
|
// anonymous field - we distinguish between 3 cases:
|
||||||
|
// 1) field name matches base type name and is exported
|
||||||
|
// 2) field name matches base type name and is not exported
|
||||||
|
// 3) field name doesn't match base type name (alias name)
|
||||||
|
bname := basetypeName(f.Type())
|
||||||
|
if name == bname {
|
||||||
|
if ast.IsExported(name) {
|
||||||
|
name = "" // 1) we don't need to know the field name or package
|
||||||
|
} else {
|
||||||
|
name = "?" // 2) use unexported name "?" to force package export
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 3) indicate alias and export name as is
|
||||||
|
// (this requires an extra "@" but this is a rare case)
|
||||||
|
p.string("@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p.string(name)
|
||||||
|
if name != "" && !ast.IsExported(name) {
|
||||||
|
p.pkg(f.Pkg(), false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func basetypeName(typ types.Type) string {
|
||||||
|
switch typ := deref(typ).(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
return typ.Name()
|
||||||
|
case *types.Named:
|
||||||
|
return typ.Obj().Name()
|
||||||
|
default:
|
||||||
|
return "" // unnamed type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) paramList(params *types.Tuple, variadic bool) {
|
||||||
|
// use negative length to indicate unnamed parameters
|
||||||
|
// (look at the first parameter only since either all
|
||||||
|
// names are present or all are absent)
|
||||||
|
n := params.Len()
|
||||||
|
if n > 0 && params.At(0).Name() == "" {
|
||||||
|
n = -n
|
||||||
|
}
|
||||||
|
p.int(n)
|
||||||
|
for i := 0; i < params.Len(); i++ {
|
||||||
|
q := params.At(i)
|
||||||
|
t := q.Type()
|
||||||
|
if variadic && i == params.Len()-1 {
|
||||||
|
t = &dddSlice{t.(*types.Slice).Elem()}
|
||||||
|
}
|
||||||
|
p.typ(t)
|
||||||
|
if n > 0 {
|
||||||
|
name := q.Name()
|
||||||
|
p.string(name)
|
||||||
|
if name != "_" {
|
||||||
|
p.pkg(q.Pkg(), false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.string("") // no compiler-specific info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) value(x constant.Value) {
|
||||||
|
if trace {
|
||||||
|
p.tracef("= ")
|
||||||
|
}
|
||||||
|
|
||||||
|
switch x.Kind() {
|
||||||
|
case constant.Bool:
|
||||||
|
tag := falseTag
|
||||||
|
if constant.BoolVal(x) {
|
||||||
|
tag = trueTag
|
||||||
|
}
|
||||||
|
p.tag(tag)
|
||||||
|
|
||||||
|
case constant.Int:
|
||||||
|
if v, exact := constant.Int64Val(x); exact {
|
||||||
|
// common case: x fits into an int64 - use compact encoding
|
||||||
|
p.tag(int64Tag)
|
||||||
|
p.int64(v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// uncommon case: large x - use float encoding
|
||||||
|
// (powers of 2 will be encoded efficiently with exponent)
|
||||||
|
p.tag(floatTag)
|
||||||
|
p.float(constant.ToFloat(x))
|
||||||
|
|
||||||
|
case constant.Float:
|
||||||
|
p.tag(floatTag)
|
||||||
|
p.float(x)
|
||||||
|
|
||||||
|
case constant.Complex:
|
||||||
|
p.tag(complexTag)
|
||||||
|
p.float(constant.Real(x))
|
||||||
|
p.float(constant.Imag(x))
|
||||||
|
|
||||||
|
case constant.String:
|
||||||
|
p.tag(stringTag)
|
||||||
|
p.string(constant.StringVal(x))
|
||||||
|
|
||||||
|
case constant.Unknown:
|
||||||
|
// package contains type errors
|
||||||
|
p.tag(unknownTag)
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected value %v (%T)", x, x))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) float(x constant.Value) {
|
||||||
|
if x.Kind() != constant.Float {
|
||||||
|
panic(internalErrorf("unexpected constant %v, want float", x))
|
||||||
|
}
|
||||||
|
// extract sign (there is no -0)
|
||||||
|
sign := constant.Sign(x)
|
||||||
|
if sign == 0 {
|
||||||
|
// x == 0
|
||||||
|
p.int(0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// x != 0
|
||||||
|
|
||||||
|
var f big.Float
|
||||||
|
if v, exact := constant.Float64Val(x); exact {
|
||||||
|
// float64
|
||||||
|
f.SetFloat64(v)
|
||||||
|
} else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int {
|
||||||
|
// TODO(gri): add big.Rat accessor to constant.Value.
|
||||||
|
r := valueToRat(num)
|
||||||
|
f.SetRat(r.Quo(r, valueToRat(denom)))
|
||||||
|
} else {
|
||||||
|
// Value too large to represent as a fraction => inaccessible.
|
||||||
|
// TODO(gri): add big.Float accessor to constant.Value.
|
||||||
|
f.SetFloat64(math.MaxFloat64) // FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract exponent such that 0.5 <= m < 1.0
|
||||||
|
var m big.Float
|
||||||
|
exp := f.MantExp(&m)
|
||||||
|
|
||||||
|
// extract mantissa as *big.Int
|
||||||
|
// - set exponent large enough so mant satisfies mant.IsInt()
|
||||||
|
// - get *big.Int from mant
|
||||||
|
m.SetMantExp(&m, int(m.MinPrec()))
|
||||||
|
mant, acc := m.Int(nil)
|
||||||
|
if acc != big.Exact {
|
||||||
|
panic(internalError("internal error"))
|
||||||
|
}
|
||||||
|
|
||||||
|
p.int(sign)
|
||||||
|
p.int(exp)
|
||||||
|
p.string(string(mant.Bytes()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func valueToRat(x constant.Value) *big.Rat {
|
||||||
|
// Convert little-endian to big-endian.
|
||||||
|
// I can't believe this is necessary.
|
||||||
|
bytes := constant.Bytes(x)
|
||||||
|
for i := 0; i < len(bytes)/2; i++ {
|
||||||
|
bytes[i], bytes[len(bytes)-1-i] = bytes[len(bytes)-1-i], bytes[i]
|
||||||
|
}
|
||||||
|
return new(big.Rat).SetInt(new(big.Int).SetBytes(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) bool(b bool) bool {
|
||||||
|
if trace {
|
||||||
|
p.tracef("[")
|
||||||
|
defer p.tracef("= %v] ", b)
|
||||||
|
}
|
||||||
|
|
||||||
|
x := 0
|
||||||
|
if b {
|
||||||
|
x = 1
|
||||||
|
}
|
||||||
|
p.int(x)
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Low-level encoders
|
||||||
|
|
||||||
|
func (p *exporter) index(marker byte, index int) {
|
||||||
|
if index < 0 {
|
||||||
|
panic(internalError("invalid index < 0"))
|
||||||
|
}
|
||||||
|
if debugFormat {
|
||||||
|
p.marker('t')
|
||||||
|
}
|
||||||
|
if trace {
|
||||||
|
p.tracef("%c%d ", marker, index)
|
||||||
|
}
|
||||||
|
p.rawInt64(int64(index))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) tag(tag int) {
|
||||||
|
if tag >= 0 {
|
||||||
|
panic(internalError("invalid tag >= 0"))
|
||||||
|
}
|
||||||
|
if debugFormat {
|
||||||
|
p.marker('t')
|
||||||
|
}
|
||||||
|
if trace {
|
||||||
|
p.tracef("%s ", tagString[-tag])
|
||||||
|
}
|
||||||
|
p.rawInt64(int64(tag))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) int(x int) {
|
||||||
|
p.int64(int64(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) int64(x int64) {
|
||||||
|
if debugFormat {
|
||||||
|
p.marker('i')
|
||||||
|
}
|
||||||
|
if trace {
|
||||||
|
p.tracef("%d ", x)
|
||||||
|
}
|
||||||
|
p.rawInt64(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *exporter) string(s string) {
|
||||||
|
if debugFormat {
|
||||||
|
p.marker('s')
|
||||||
|
}
|
||||||
|
if trace {
|
||||||
|
p.tracef("%q ", s)
|
||||||
|
}
|
||||||
|
// if we saw the string before, write its index (>= 0)
|
||||||
|
// (the empty string is mapped to 0)
|
||||||
|
if i, ok := p.strIndex[s]; ok {
|
||||||
|
p.rawInt64(int64(i))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// otherwise, remember string and write its negative length and bytes
|
||||||
|
p.strIndex[s] = len(p.strIndex)
|
||||||
|
p.rawInt64(-int64(len(s)))
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
p.rawByte(s[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// marker emits a marker byte and position information which makes
|
||||||
|
// it easy for a reader to detect if it is "out of sync". Used for
|
||||||
|
// debugFormat format only.
|
||||||
|
func (p *exporter) marker(m byte) {
|
||||||
|
p.rawByte(m)
|
||||||
|
// Enable this for help tracking down the location
|
||||||
|
// of an incorrect marker when running in debugFormat.
|
||||||
|
if false && trace {
|
||||||
|
p.tracef("#%d ", p.written)
|
||||||
|
}
|
||||||
|
p.rawInt64(int64(p.written))
|
||||||
|
}
|
||||||
|
|
||||||
|
// rawInt64 should only be used by low-level encoders.
|
||||||
|
func (p *exporter) rawInt64(x int64) {
|
||||||
|
var tmp [binary.MaxVarintLen64]byte
|
||||||
|
n := binary.PutVarint(tmp[:], x)
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
p.rawByte(tmp[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rawStringln should only be used to emit the initial version string.
|
||||||
|
func (p *exporter) rawStringln(s string) {
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
p.rawByte(s[i])
|
||||||
|
}
|
||||||
|
p.rawByte('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
// rawByte is the bottleneck interface to write to p.out.
|
||||||
|
// rawByte escapes b as follows (any encoding does that
|
||||||
|
// hides '$'):
|
||||||
|
//
|
||||||
|
// '$' => '|' 'S'
|
||||||
|
// '|' => '|' '|'
|
||||||
|
//
|
||||||
|
// Necessary so other tools can find the end of the
|
||||||
|
// export data by searching for "$$".
|
||||||
|
// rawByte should only be used by low-level encoders.
|
||||||
|
func (p *exporter) rawByte(b byte) {
|
||||||
|
switch b {
|
||||||
|
case '$':
|
||||||
|
// write '$' as '|' 'S'
|
||||||
|
b = 'S'
|
||||||
|
fallthrough
|
||||||
|
case '|':
|
||||||
|
// write '|' as '|' '|'
|
||||||
|
p.out.WriteByte('|')
|
||||||
|
p.written++
|
||||||
|
}
|
||||||
|
p.out.WriteByte(b)
|
||||||
|
p.written++
|
||||||
|
}
|
||||||
|
|
||||||
|
// tracef is like fmt.Printf but it rewrites the format string
|
||||||
|
// to take care of indentation.
|
||||||
|
func (p *exporter) tracef(format string, args ...interface{}) {
|
||||||
|
if strings.ContainsAny(format, "<>\n") {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
for i := 0; i < len(format); i++ {
|
||||||
|
// no need to deal with runes
|
||||||
|
ch := format[i]
|
||||||
|
switch ch {
|
||||||
|
case '>':
|
||||||
|
p.indent++
|
||||||
|
continue
|
||||||
|
case '<':
|
||||||
|
p.indent--
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
buf.WriteByte(ch)
|
||||||
|
if ch == '\n' {
|
||||||
|
for j := p.indent; j > 0; j-- {
|
||||||
|
buf.WriteString(". ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
format = buf.String()
|
||||||
|
}
|
||||||
|
fmt.Printf(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debugging support.
|
||||||
|
// (tagString is only used when tracing is enabled)
|
||||||
|
var tagString = [...]string{
|
||||||
|
// Packages
|
||||||
|
-packageTag: "package",
|
||||||
|
|
||||||
|
// Types
|
||||||
|
-namedTag: "named type",
|
||||||
|
-arrayTag: "array",
|
||||||
|
-sliceTag: "slice",
|
||||||
|
-dddTag: "ddd",
|
||||||
|
-structTag: "struct",
|
||||||
|
-pointerTag: "pointer",
|
||||||
|
-signatureTag: "signature",
|
||||||
|
-interfaceTag: "interface",
|
||||||
|
-mapTag: "map",
|
||||||
|
-chanTag: "chan",
|
||||||
|
|
||||||
|
// Values
|
||||||
|
-falseTag: "false",
|
||||||
|
-trueTag: "true",
|
||||||
|
-int64Tag: "int64",
|
||||||
|
-floatTag: "float",
|
||||||
|
-fractionTag: "fraction",
|
||||||
|
-complexTag: "complex",
|
||||||
|
-stringTag: "string",
|
||||||
|
-unknownTag: "unknown",
|
||||||
|
|
||||||
|
// Type aliases
|
||||||
|
-aliasTag: "alias",
|
||||||
|
}
|
1036
vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go
generated
vendored
Normal file
1036
vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
93
vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go
generated
vendored
Normal file
93
vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go
generated
vendored
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
// Copyright 2011 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 a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go.
|
||||||
|
|
||||||
|
// This file implements FindExportData.
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func readGopackHeader(r *bufio.Reader) (name string, size int, err error) {
|
||||||
|
// See $GOROOT/include/ar.h.
|
||||||
|
hdr := make([]byte, 16+12+6+6+8+10+2)
|
||||||
|
_, err = io.ReadFull(r, hdr)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// leave for debugging
|
||||||
|
if false {
|
||||||
|
fmt.Printf("header: %s", hdr)
|
||||||
|
}
|
||||||
|
s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10]))
|
||||||
|
size, err = strconv.Atoi(s)
|
||||||
|
if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' {
|
||||||
|
err = fmt.Errorf("invalid archive header")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name = strings.TrimSpace(string(hdr[:16]))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindExportData positions the reader r at the beginning of the
|
||||||
|
// export data section of an underlying GC-created object/archive
|
||||||
|
// file by reading from it. The reader must be positioned at the
|
||||||
|
// start of the file before calling this function. The hdr result
|
||||||
|
// is the string before the export data, either "$$" or "$$B".
|
||||||
|
//
|
||||||
|
func FindExportData(r *bufio.Reader) (hdr string, err error) {
|
||||||
|
// Read first line to make sure this is an object file.
|
||||||
|
line, err := r.ReadSlice('\n')
|
||||||
|
if err != nil {
|
||||||
|
err = fmt.Errorf("can't find export data (%v)", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if string(line) == "!<arch>\n" {
|
||||||
|
// Archive file. Scan to __.PKGDEF.
|
||||||
|
var name string
|
||||||
|
if name, _, err = readGopackHeader(r); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// First entry should be __.PKGDEF.
|
||||||
|
if name != "__.PKGDEF" {
|
||||||
|
err = fmt.Errorf("go archive is missing __.PKGDEF")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read first line of __.PKGDEF data, so that line
|
||||||
|
// is once again the first line of the input.
|
||||||
|
if line, err = r.ReadSlice('\n'); err != nil {
|
||||||
|
err = fmt.Errorf("can't find export data (%v)", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now at __.PKGDEF in archive or still at beginning of file.
|
||||||
|
// Either way, line should begin with "go object ".
|
||||||
|
if !strings.HasPrefix(string(line), "go object ") {
|
||||||
|
err = fmt.Errorf("not a Go object file")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip over object header to export data.
|
||||||
|
// Begins after first line starting with $$.
|
||||||
|
for line[0] != '$' {
|
||||||
|
if line, err = r.ReadSlice('\n'); err != nil {
|
||||||
|
err = fmt.Errorf("can't find export data (%v)", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hdr = string(line)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
1078
vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go
generated
vendored
Normal file
1078
vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
723
vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go
generated
vendored
Normal file
723
vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go
generated
vendored
Normal file
|
@ -0,0 +1,723 @@
|
||||||
|
// Copyright 2019 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.
|
||||||
|
|
||||||
|
// Indexed binary package export.
|
||||||
|
// This file was derived from $GOROOT/src/cmd/compile/internal/gc/iexport.go;
|
||||||
|
// see that file for specification of the format.
|
||||||
|
|
||||||
|
// +build go1.11
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"go/ast"
|
||||||
|
"go/constant"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"io"
|
||||||
|
"math/big"
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Current indexed export format version. Increase with each format change.
|
||||||
|
// 0: Go1.11 encoding
|
||||||
|
const iexportVersion = 0
|
||||||
|
|
||||||
|
// IExportData returns the binary export data for pkg.
|
||||||
|
// If no file set is provided, position info will be missing.
|
||||||
|
func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
if ierr, ok := e.(internalError); ok {
|
||||||
|
err = ierr
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Not an internal error; panic again.
|
||||||
|
panic(e)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
p := iexporter{
|
||||||
|
out: bytes.NewBuffer(nil),
|
||||||
|
fset: fset,
|
||||||
|
allPkgs: map[*types.Package]bool{},
|
||||||
|
stringIndex: map[string]uint64{},
|
||||||
|
declIndex: map[types.Object]uint64{},
|
||||||
|
typIndex: map[types.Type]uint64{},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, pt := range predeclared() {
|
||||||
|
p.typIndex[pt] = uint64(i)
|
||||||
|
}
|
||||||
|
if len(p.typIndex) > predeclReserved {
|
||||||
|
panic(internalErrorf("too many predeclared types: %d > %d", len(p.typIndex), predeclReserved))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize work queue with exported declarations.
|
||||||
|
scope := pkg.Scope()
|
||||||
|
for _, name := range scope.Names() {
|
||||||
|
if ast.IsExported(name) {
|
||||||
|
p.pushDecl(scope.Lookup(name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop until no more work.
|
||||||
|
for !p.declTodo.empty() {
|
||||||
|
p.doDecl(p.declTodo.popHead())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append indices to data0 section.
|
||||||
|
dataLen := uint64(p.data0.Len())
|
||||||
|
w := p.newWriter()
|
||||||
|
w.writeIndex(p.declIndex, pkg)
|
||||||
|
w.flush()
|
||||||
|
|
||||||
|
// Assemble header.
|
||||||
|
var hdr intWriter
|
||||||
|
hdr.WriteByte('i')
|
||||||
|
hdr.uint64(iexportVersion)
|
||||||
|
hdr.uint64(uint64(p.strings.Len()))
|
||||||
|
hdr.uint64(dataLen)
|
||||||
|
|
||||||
|
// Flush output.
|
||||||
|
io.Copy(p.out, &hdr)
|
||||||
|
io.Copy(p.out, &p.strings)
|
||||||
|
io.Copy(p.out, &p.data0)
|
||||||
|
|
||||||
|
return p.out.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// writeIndex writes out an object index. mainIndex indicates whether
|
||||||
|
// we're writing out the main index, which is also read by
|
||||||
|
// non-compiler tools and includes a complete package description
|
||||||
|
// (i.e., name and height).
|
||||||
|
func (w *exportWriter) writeIndex(index map[types.Object]uint64, localpkg *types.Package) {
|
||||||
|
// Build a map from packages to objects from that package.
|
||||||
|
pkgObjs := map[*types.Package][]types.Object{}
|
||||||
|
|
||||||
|
// For the main index, make sure to include every package that
|
||||||
|
// we reference, even if we're not exporting (or reexporting)
|
||||||
|
// any symbols from it.
|
||||||
|
pkgObjs[localpkg] = nil
|
||||||
|
for pkg := range w.p.allPkgs {
|
||||||
|
pkgObjs[pkg] = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for obj := range index {
|
||||||
|
pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
var pkgs []*types.Package
|
||||||
|
for pkg, objs := range pkgObjs {
|
||||||
|
pkgs = append(pkgs, pkg)
|
||||||
|
|
||||||
|
sort.Slice(objs, func(i, j int) bool {
|
||||||
|
return objs[i].Name() < objs[j].Name()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(pkgs, func(i, j int) bool {
|
||||||
|
return pkgs[i].Path() < pkgs[j].Path()
|
||||||
|
})
|
||||||
|
|
||||||
|
w.uint64(uint64(len(pkgs)))
|
||||||
|
for _, pkg := range pkgs {
|
||||||
|
w.string(pkg.Path())
|
||||||
|
w.string(pkg.Name())
|
||||||
|
w.uint64(uint64(0)) // package height is not needed for go/types
|
||||||
|
|
||||||
|
objs := pkgObjs[pkg]
|
||||||
|
w.uint64(uint64(len(objs)))
|
||||||
|
for _, obj := range objs {
|
||||||
|
w.string(obj.Name())
|
||||||
|
w.uint64(index[obj])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type iexporter struct {
|
||||||
|
fset *token.FileSet
|
||||||
|
out *bytes.Buffer
|
||||||
|
|
||||||
|
// allPkgs tracks all packages that have been referenced by
|
||||||
|
// the export data, so we can ensure to include them in the
|
||||||
|
// main index.
|
||||||
|
allPkgs map[*types.Package]bool
|
||||||
|
|
||||||
|
declTodo objQueue
|
||||||
|
|
||||||
|
strings intWriter
|
||||||
|
stringIndex map[string]uint64
|
||||||
|
|
||||||
|
data0 intWriter
|
||||||
|
declIndex map[types.Object]uint64
|
||||||
|
typIndex map[types.Type]uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// stringOff returns the offset of s within the string section.
|
||||||
|
// If not already present, it's added to the end.
|
||||||
|
func (p *iexporter) stringOff(s string) uint64 {
|
||||||
|
off, ok := p.stringIndex[s]
|
||||||
|
if !ok {
|
||||||
|
off = uint64(p.strings.Len())
|
||||||
|
p.stringIndex[s] = off
|
||||||
|
|
||||||
|
p.strings.uint64(uint64(len(s)))
|
||||||
|
p.strings.WriteString(s)
|
||||||
|
}
|
||||||
|
return off
|
||||||
|
}
|
||||||
|
|
||||||
|
// pushDecl adds n to the declaration work queue, if not already present.
|
||||||
|
func (p *iexporter) pushDecl(obj types.Object) {
|
||||||
|
// Package unsafe is known to the compiler and predeclared.
|
||||||
|
assert(obj.Pkg() != types.Unsafe)
|
||||||
|
|
||||||
|
if _, ok := p.declIndex[obj]; ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p.declIndex[obj] = ^uint64(0) // mark n present in work queue
|
||||||
|
p.declTodo.pushTail(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
// exportWriter handles writing out individual data section chunks.
|
||||||
|
type exportWriter struct {
|
||||||
|
p *iexporter
|
||||||
|
|
||||||
|
data intWriter
|
||||||
|
currPkg *types.Package
|
||||||
|
prevFile string
|
||||||
|
prevLine int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iexporter) doDecl(obj types.Object) {
|
||||||
|
w := p.newWriter()
|
||||||
|
w.setPkg(obj.Pkg(), false)
|
||||||
|
|
||||||
|
switch obj := obj.(type) {
|
||||||
|
case *types.Var:
|
||||||
|
w.tag('V')
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
w.typ(obj.Type(), obj.Pkg())
|
||||||
|
|
||||||
|
case *types.Func:
|
||||||
|
sig, _ := obj.Type().(*types.Signature)
|
||||||
|
if sig.Recv() != nil {
|
||||||
|
panic(internalErrorf("unexpected method: %v", sig))
|
||||||
|
}
|
||||||
|
w.tag('F')
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
w.signature(sig)
|
||||||
|
|
||||||
|
case *types.Const:
|
||||||
|
w.tag('C')
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
w.value(obj.Type(), obj.Val())
|
||||||
|
|
||||||
|
case *types.TypeName:
|
||||||
|
if obj.IsAlias() {
|
||||||
|
w.tag('A')
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
w.typ(obj.Type(), obj.Pkg())
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defined type.
|
||||||
|
w.tag('T')
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
|
||||||
|
underlying := obj.Type().Underlying()
|
||||||
|
w.typ(underlying, obj.Pkg())
|
||||||
|
|
||||||
|
t := obj.Type()
|
||||||
|
if types.IsInterface(t) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
named, ok := t.(*types.Named)
|
||||||
|
if !ok {
|
||||||
|
panic(internalErrorf("%s is not a defined type", t))
|
||||||
|
}
|
||||||
|
|
||||||
|
n := named.NumMethods()
|
||||||
|
w.uint64(uint64(n))
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
m := named.Method(i)
|
||||||
|
w.pos(m.Pos())
|
||||||
|
w.string(m.Name())
|
||||||
|
sig, _ := m.Type().(*types.Signature)
|
||||||
|
w.param(sig.Recv())
|
||||||
|
w.signature(sig)
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected object: %v", obj))
|
||||||
|
}
|
||||||
|
|
||||||
|
p.declIndex[obj] = w.flush()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) tag(tag byte) {
|
||||||
|
w.data.WriteByte(tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) pos(pos token.Pos) {
|
||||||
|
p := w.p.fset.Position(pos)
|
||||||
|
file := p.Filename
|
||||||
|
line := int64(p.Line)
|
||||||
|
|
||||||
|
// When file is the same as the last position (common case),
|
||||||
|
// we can save a few bytes by delta encoding just the line
|
||||||
|
// number.
|
||||||
|
//
|
||||||
|
// Note: Because data objects may be read out of order (or not
|
||||||
|
// at all), we can only apply delta encoding within a single
|
||||||
|
// object. This is handled implicitly by tracking prevFile and
|
||||||
|
// prevLine as fields of exportWriter.
|
||||||
|
|
||||||
|
if file == w.prevFile {
|
||||||
|
delta := line - w.prevLine
|
||||||
|
w.int64(delta)
|
||||||
|
if delta == deltaNewFile {
|
||||||
|
w.int64(-1)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w.int64(deltaNewFile)
|
||||||
|
w.int64(line) // line >= 0
|
||||||
|
w.string(file)
|
||||||
|
w.prevFile = file
|
||||||
|
}
|
||||||
|
w.prevLine = line
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) pkg(pkg *types.Package) {
|
||||||
|
// Ensure any referenced packages are declared in the main index.
|
||||||
|
w.p.allPkgs[pkg] = true
|
||||||
|
|
||||||
|
w.string(pkg.Path())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) qualifiedIdent(obj types.Object) {
|
||||||
|
// Ensure any referenced declarations are written out too.
|
||||||
|
w.p.pushDecl(obj)
|
||||||
|
|
||||||
|
w.string(obj.Name())
|
||||||
|
w.pkg(obj.Pkg())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
|
||||||
|
w.data.uint64(w.p.typOff(t, pkg))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iexporter) newWriter() *exportWriter {
|
||||||
|
return &exportWriter{p: p}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) flush() uint64 {
|
||||||
|
off := uint64(w.p.data0.Len())
|
||||||
|
io.Copy(&w.p.data0, &w.data)
|
||||||
|
return off
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
|
||||||
|
off, ok := p.typIndex[t]
|
||||||
|
if !ok {
|
||||||
|
w := p.newWriter()
|
||||||
|
w.doTyp(t, pkg)
|
||||||
|
off = predeclReserved + w.flush()
|
||||||
|
p.typIndex[t] = off
|
||||||
|
}
|
||||||
|
return off
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) startType(k itag) {
|
||||||
|
w.data.uint64(uint64(k))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
|
||||||
|
switch t := t.(type) {
|
||||||
|
case *types.Named:
|
||||||
|
w.startType(definedType)
|
||||||
|
w.qualifiedIdent(t.Obj())
|
||||||
|
|
||||||
|
case *types.Pointer:
|
||||||
|
w.startType(pointerType)
|
||||||
|
w.typ(t.Elem(), pkg)
|
||||||
|
|
||||||
|
case *types.Slice:
|
||||||
|
w.startType(sliceType)
|
||||||
|
w.typ(t.Elem(), pkg)
|
||||||
|
|
||||||
|
case *types.Array:
|
||||||
|
w.startType(arrayType)
|
||||||
|
w.uint64(uint64(t.Len()))
|
||||||
|
w.typ(t.Elem(), pkg)
|
||||||
|
|
||||||
|
case *types.Chan:
|
||||||
|
w.startType(chanType)
|
||||||
|
// 1 RecvOnly; 2 SendOnly; 3 SendRecv
|
||||||
|
var dir uint64
|
||||||
|
switch t.Dir() {
|
||||||
|
case types.RecvOnly:
|
||||||
|
dir = 1
|
||||||
|
case types.SendOnly:
|
||||||
|
dir = 2
|
||||||
|
case types.SendRecv:
|
||||||
|
dir = 3
|
||||||
|
}
|
||||||
|
w.uint64(dir)
|
||||||
|
w.typ(t.Elem(), pkg)
|
||||||
|
|
||||||
|
case *types.Map:
|
||||||
|
w.startType(mapType)
|
||||||
|
w.typ(t.Key(), pkg)
|
||||||
|
w.typ(t.Elem(), pkg)
|
||||||
|
|
||||||
|
case *types.Signature:
|
||||||
|
w.startType(signatureType)
|
||||||
|
w.setPkg(pkg, true)
|
||||||
|
w.signature(t)
|
||||||
|
|
||||||
|
case *types.Struct:
|
||||||
|
w.startType(structType)
|
||||||
|
w.setPkg(pkg, true)
|
||||||
|
|
||||||
|
n := t.NumFields()
|
||||||
|
w.uint64(uint64(n))
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
f := t.Field(i)
|
||||||
|
w.pos(f.Pos())
|
||||||
|
w.string(f.Name())
|
||||||
|
w.typ(f.Type(), pkg)
|
||||||
|
w.bool(f.Embedded())
|
||||||
|
w.string(t.Tag(i)) // note (or tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
case *types.Interface:
|
||||||
|
w.startType(interfaceType)
|
||||||
|
w.setPkg(pkg, true)
|
||||||
|
|
||||||
|
n := t.NumEmbeddeds()
|
||||||
|
w.uint64(uint64(n))
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
f := t.Embedded(i)
|
||||||
|
w.pos(f.Obj().Pos())
|
||||||
|
w.typ(f.Obj().Type(), f.Obj().Pkg())
|
||||||
|
}
|
||||||
|
|
||||||
|
n = t.NumExplicitMethods()
|
||||||
|
w.uint64(uint64(n))
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
m := t.ExplicitMethod(i)
|
||||||
|
w.pos(m.Pos())
|
||||||
|
w.string(m.Name())
|
||||||
|
sig, _ := m.Type().(*types.Signature)
|
||||||
|
w.signature(sig)
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) setPkg(pkg *types.Package, write bool) {
|
||||||
|
if write {
|
||||||
|
w.pkg(pkg)
|
||||||
|
}
|
||||||
|
|
||||||
|
w.currPkg = pkg
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) signature(sig *types.Signature) {
|
||||||
|
w.paramList(sig.Params())
|
||||||
|
w.paramList(sig.Results())
|
||||||
|
if sig.Params().Len() > 0 {
|
||||||
|
w.bool(sig.Variadic())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) paramList(tup *types.Tuple) {
|
||||||
|
n := tup.Len()
|
||||||
|
w.uint64(uint64(n))
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
w.param(tup.At(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) param(obj types.Object) {
|
||||||
|
w.pos(obj.Pos())
|
||||||
|
w.localIdent(obj)
|
||||||
|
w.typ(obj.Type(), obj.Pkg())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) value(typ types.Type, v constant.Value) {
|
||||||
|
w.typ(typ, nil)
|
||||||
|
|
||||||
|
switch v.Kind() {
|
||||||
|
case constant.Bool:
|
||||||
|
w.bool(constant.BoolVal(v))
|
||||||
|
case constant.Int:
|
||||||
|
var i big.Int
|
||||||
|
if i64, exact := constant.Int64Val(v); exact {
|
||||||
|
i.SetInt64(i64)
|
||||||
|
} else if ui64, exact := constant.Uint64Val(v); exact {
|
||||||
|
i.SetUint64(ui64)
|
||||||
|
} else {
|
||||||
|
i.SetString(v.ExactString(), 10)
|
||||||
|
}
|
||||||
|
w.mpint(&i, typ)
|
||||||
|
case constant.Float:
|
||||||
|
f := constantToFloat(v)
|
||||||
|
w.mpfloat(f, typ)
|
||||||
|
case constant.Complex:
|
||||||
|
w.mpfloat(constantToFloat(constant.Real(v)), typ)
|
||||||
|
w.mpfloat(constantToFloat(constant.Imag(v)), typ)
|
||||||
|
case constant.String:
|
||||||
|
w.string(constant.StringVal(v))
|
||||||
|
case constant.Unknown:
|
||||||
|
// package contains type errors
|
||||||
|
default:
|
||||||
|
panic(internalErrorf("unexpected value %v (%T)", v, v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// constantToFloat converts a constant.Value with kind constant.Float to a
|
||||||
|
// big.Float.
|
||||||
|
func constantToFloat(x constant.Value) *big.Float {
|
||||||
|
assert(x.Kind() == constant.Float)
|
||||||
|
// Use the same floating-point precision (512) as cmd/compile
|
||||||
|
// (see Mpprec in cmd/compile/internal/gc/mpfloat.go).
|
||||||
|
const mpprec = 512
|
||||||
|
var f big.Float
|
||||||
|
f.SetPrec(mpprec)
|
||||||
|
if v, exact := constant.Float64Val(x); exact {
|
||||||
|
// float64
|
||||||
|
f.SetFloat64(v)
|
||||||
|
} else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int {
|
||||||
|
// TODO(gri): add big.Rat accessor to constant.Value.
|
||||||
|
n := valueToRat(num)
|
||||||
|
d := valueToRat(denom)
|
||||||
|
f.SetRat(n.Quo(n, d))
|
||||||
|
} else {
|
||||||
|
// Value too large to represent as a fraction => inaccessible.
|
||||||
|
// TODO(gri): add big.Float accessor to constant.Value.
|
||||||
|
_, ok := f.SetString(x.ExactString())
|
||||||
|
assert(ok)
|
||||||
|
}
|
||||||
|
return &f
|
||||||
|
}
|
||||||
|
|
||||||
|
// mpint exports a multi-precision integer.
|
||||||
|
//
|
||||||
|
// For unsigned types, small values are written out as a single
|
||||||
|
// byte. Larger values are written out as a length-prefixed big-endian
|
||||||
|
// byte string, where the length prefix is encoded as its complement.
|
||||||
|
// For example, bytes 0, 1, and 2 directly represent the integer
|
||||||
|
// values 0, 1, and 2; while bytes 255, 254, and 253 indicate a 1-,
|
||||||
|
// 2-, and 3-byte big-endian string follow.
|
||||||
|
//
|
||||||
|
// Encoding for signed types use the same general approach as for
|
||||||
|
// unsigned types, except small values use zig-zag encoding and the
|
||||||
|
// bottom bit of length prefix byte for large values is reserved as a
|
||||||
|
// sign bit.
|
||||||
|
//
|
||||||
|
// The exact boundary between small and large encodings varies
|
||||||
|
// according to the maximum number of bytes needed to encode a value
|
||||||
|
// of type typ. As a special case, 8-bit types are always encoded as a
|
||||||
|
// single byte.
|
||||||
|
//
|
||||||
|
// TODO(mdempsky): Is this level of complexity really worthwhile?
|
||||||
|
func (w *exportWriter) mpint(x *big.Int, typ types.Type) {
|
||||||
|
basic, ok := typ.Underlying().(*types.Basic)
|
||||||
|
if !ok {
|
||||||
|
panic(internalErrorf("unexpected type %v (%T)", typ.Underlying(), typ.Underlying()))
|
||||||
|
}
|
||||||
|
|
||||||
|
signed, maxBytes := intSize(basic)
|
||||||
|
|
||||||
|
negative := x.Sign() < 0
|
||||||
|
if !signed && negative {
|
||||||
|
panic(internalErrorf("negative unsigned integer; type %v, value %v", typ, x))
|
||||||
|
}
|
||||||
|
|
||||||
|
b := x.Bytes()
|
||||||
|
if len(b) > 0 && b[0] == 0 {
|
||||||
|
panic(internalErrorf("leading zeros"))
|
||||||
|
}
|
||||||
|
if uint(len(b)) > maxBytes {
|
||||||
|
panic(internalErrorf("bad mpint length: %d > %d (type %v, value %v)", len(b), maxBytes, typ, x))
|
||||||
|
}
|
||||||
|
|
||||||
|
maxSmall := 256 - maxBytes
|
||||||
|
if signed {
|
||||||
|
maxSmall = 256 - 2*maxBytes
|
||||||
|
}
|
||||||
|
if maxBytes == 1 {
|
||||||
|
maxSmall = 256
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if x can use small value encoding.
|
||||||
|
if len(b) <= 1 {
|
||||||
|
var ux uint
|
||||||
|
if len(b) == 1 {
|
||||||
|
ux = uint(b[0])
|
||||||
|
}
|
||||||
|
if signed {
|
||||||
|
ux <<= 1
|
||||||
|
if negative {
|
||||||
|
ux--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ux < maxSmall {
|
||||||
|
w.data.WriteByte(byte(ux))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n := 256 - uint(len(b))
|
||||||
|
if signed {
|
||||||
|
n = 256 - 2*uint(len(b))
|
||||||
|
if negative {
|
||||||
|
n |= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if n < maxSmall || n >= 256 {
|
||||||
|
panic(internalErrorf("encoding mistake: %d, %v, %v => %d", len(b), signed, negative, n))
|
||||||
|
}
|
||||||
|
|
||||||
|
w.data.WriteByte(byte(n))
|
||||||
|
w.data.Write(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// mpfloat exports a multi-precision floating point number.
|
||||||
|
//
|
||||||
|
// The number's value is decomposed into mantissa × 2**exponent, where
|
||||||
|
// mantissa is an integer. The value is written out as mantissa (as a
|
||||||
|
// multi-precision integer) and then the exponent, except exponent is
|
||||||
|
// omitted if mantissa is zero.
|
||||||
|
func (w *exportWriter) mpfloat(f *big.Float, typ types.Type) {
|
||||||
|
if f.IsInf() {
|
||||||
|
panic("infinite constant")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Break into f = mant × 2**exp, with 0.5 <= mant < 1.
|
||||||
|
var mant big.Float
|
||||||
|
exp := int64(f.MantExp(&mant))
|
||||||
|
|
||||||
|
// Scale so that mant is an integer.
|
||||||
|
prec := mant.MinPrec()
|
||||||
|
mant.SetMantExp(&mant, int(prec))
|
||||||
|
exp -= int64(prec)
|
||||||
|
|
||||||
|
manti, acc := mant.Int(nil)
|
||||||
|
if acc != big.Exact {
|
||||||
|
panic(internalErrorf("mantissa scaling failed for %f (%s)", f, acc))
|
||||||
|
}
|
||||||
|
w.mpint(manti, typ)
|
||||||
|
if manti.Sign() != 0 {
|
||||||
|
w.int64(exp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) bool(b bool) bool {
|
||||||
|
var x uint64
|
||||||
|
if b {
|
||||||
|
x = 1
|
||||||
|
}
|
||||||
|
w.uint64(x)
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *exportWriter) int64(x int64) { w.data.int64(x) }
|
||||||
|
func (w *exportWriter) uint64(x uint64) { w.data.uint64(x) }
|
||||||
|
func (w *exportWriter) string(s string) { w.uint64(w.p.stringOff(s)) }
|
||||||
|
|
||||||
|
func (w *exportWriter) localIdent(obj types.Object) {
|
||||||
|
// Anonymous parameters.
|
||||||
|
if obj == nil {
|
||||||
|
w.string("")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
name := obj.Name()
|
||||||
|
if name == "_" {
|
||||||
|
w.string("_")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.string(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
type intWriter struct {
|
||||||
|
bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *intWriter) int64(x int64) {
|
||||||
|
var buf [binary.MaxVarintLen64]byte
|
||||||
|
n := binary.PutVarint(buf[:], x)
|
||||||
|
w.Write(buf[:n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *intWriter) uint64(x uint64) {
|
||||||
|
var buf [binary.MaxVarintLen64]byte
|
||||||
|
n := binary.PutUvarint(buf[:], x)
|
||||||
|
w.Write(buf[:n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func assert(cond bool) {
|
||||||
|
if !cond {
|
||||||
|
panic("internal error: assertion failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The below is copied from go/src/cmd/compile/internal/gc/syntax.go.
|
||||||
|
|
||||||
|
// objQueue is a FIFO queue of types.Object. The zero value of objQueue is
|
||||||
|
// a ready-to-use empty queue.
|
||||||
|
type objQueue struct {
|
||||||
|
ring []types.Object
|
||||||
|
head, tail int
|
||||||
|
}
|
||||||
|
|
||||||
|
// empty returns true if q contains no Nodes.
|
||||||
|
func (q *objQueue) empty() bool {
|
||||||
|
return q.head == q.tail
|
||||||
|
}
|
||||||
|
|
||||||
|
// pushTail appends n to the tail of the queue.
|
||||||
|
func (q *objQueue) pushTail(obj types.Object) {
|
||||||
|
if len(q.ring) == 0 {
|
||||||
|
q.ring = make([]types.Object, 16)
|
||||||
|
} else if q.head+len(q.ring) == q.tail {
|
||||||
|
// Grow the ring.
|
||||||
|
nring := make([]types.Object, len(q.ring)*2)
|
||||||
|
// Copy the old elements.
|
||||||
|
part := q.ring[q.head%len(q.ring):]
|
||||||
|
if q.tail-q.head <= len(part) {
|
||||||
|
part = part[:q.tail-q.head]
|
||||||
|
copy(nring, part)
|
||||||
|
} else {
|
||||||
|
pos := copy(nring, part)
|
||||||
|
copy(nring[pos:], q.ring[:q.tail%len(q.ring)])
|
||||||
|
}
|
||||||
|
q.ring, q.head, q.tail = nring, 0, q.tail-q.head
|
||||||
|
}
|
||||||
|
|
||||||
|
q.ring[q.tail%len(q.ring)] = obj
|
||||||
|
q.tail++
|
||||||
|
}
|
||||||
|
|
||||||
|
// popHead pops a node from the head of the queue. It panics if q is empty.
|
||||||
|
func (q *objQueue) popHead() types.Object {
|
||||||
|
if q.empty() {
|
||||||
|
panic("dequeue empty")
|
||||||
|
}
|
||||||
|
obj := q.ring[q.head%len(q.ring)]
|
||||||
|
q.head++
|
||||||
|
return obj
|
||||||
|
}
|
606
vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go
generated
vendored
Normal file
606
vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go
generated
vendored
Normal file
|
@ -0,0 +1,606 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// Indexed package import.
|
||||||
|
// See cmd/compile/internal/gc/iexport.go for the export data format.
|
||||||
|
|
||||||
|
// This file is a copy of $GOROOT/src/go/internal/gcimporter/iimport.go.
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
"go/constant"
|
||||||
|
"go/token"
|
||||||
|
"go/types"
|
||||||
|
"io"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
type intReader struct {
|
||||||
|
*bytes.Reader
|
||||||
|
path string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *intReader) int64() int64 {
|
||||||
|
i, err := binary.ReadVarint(r.Reader)
|
||||||
|
if err != nil {
|
||||||
|
errorf("import %q: read varint error: %v", r.path, err)
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *intReader) uint64() uint64 {
|
||||||
|
i, err := binary.ReadUvarint(r.Reader)
|
||||||
|
if err != nil {
|
||||||
|
errorf("import %q: read varint error: %v", r.path, err)
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
const predeclReserved = 32
|
||||||
|
|
||||||
|
type itag uint64
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Types
|
||||||
|
definedType itag = iota
|
||||||
|
pointerType
|
||||||
|
sliceType
|
||||||
|
arrayType
|
||||||
|
chanType
|
||||||
|
mapType
|
||||||
|
signatureType
|
||||||
|
structType
|
||||||
|
interfaceType
|
||||||
|
)
|
||||||
|
|
||||||
|
// IImportData imports a package from the serialized package data
|
||||||
|
// and returns the number of bytes consumed and a reference to the package.
|
||||||
|
// If the export data version is not recognized or the format is otherwise
|
||||||
|
// compromised, an error is returned.
|
||||||
|
func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
|
||||||
|
const currentVersion = 0
|
||||||
|
version := -1
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
if version > currentVersion {
|
||||||
|
err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e)
|
||||||
|
} else {
|
||||||
|
err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
r := &intReader{bytes.NewReader(data), path}
|
||||||
|
|
||||||
|
version = int(r.uint64())
|
||||||
|
switch version {
|
||||||
|
case currentVersion:
|
||||||
|
default:
|
||||||
|
errorf("unknown iexport format version %d", version)
|
||||||
|
}
|
||||||
|
|
||||||
|
sLen := int64(r.uint64())
|
||||||
|
dLen := int64(r.uint64())
|
||||||
|
|
||||||
|
whence, _ := r.Seek(0, io.SeekCurrent)
|
||||||
|
stringData := data[whence : whence+sLen]
|
||||||
|
declData := data[whence+sLen : whence+sLen+dLen]
|
||||||
|
r.Seek(sLen+dLen, io.SeekCurrent)
|
||||||
|
|
||||||
|
p := iimporter{
|
||||||
|
ipath: path,
|
||||||
|
|
||||||
|
stringData: stringData,
|
||||||
|
stringCache: make(map[uint64]string),
|
||||||
|
pkgCache: make(map[uint64]*types.Package),
|
||||||
|
|
||||||
|
declData: declData,
|
||||||
|
pkgIndex: make(map[*types.Package]map[string]uint64),
|
||||||
|
typCache: make(map[uint64]types.Type),
|
||||||
|
|
||||||
|
fake: fakeFileSet{
|
||||||
|
fset: fset,
|
||||||
|
files: make(map[string]*token.File),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, pt := range predeclared() {
|
||||||
|
p.typCache[uint64(i)] = pt
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgList := make([]*types.Package, r.uint64())
|
||||||
|
for i := range pkgList {
|
||||||
|
pkgPathOff := r.uint64()
|
||||||
|
pkgPath := p.stringAt(pkgPathOff)
|
||||||
|
pkgName := p.stringAt(r.uint64())
|
||||||
|
_ = r.uint64() // package height; unused by go/types
|
||||||
|
|
||||||
|
if pkgPath == "" {
|
||||||
|
pkgPath = path
|
||||||
|
}
|
||||||
|
pkg := imports[pkgPath]
|
||||||
|
if pkg == nil {
|
||||||
|
pkg = types.NewPackage(pkgPath, pkgName)
|
||||||
|
imports[pkgPath] = pkg
|
||||||
|
} else if pkg.Name() != pkgName {
|
||||||
|
errorf("conflicting names %s and %s for package %q", pkg.Name(), pkgName, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.pkgCache[pkgPathOff] = pkg
|
||||||
|
|
||||||
|
nameIndex := make(map[string]uint64)
|
||||||
|
for nSyms := r.uint64(); nSyms > 0; nSyms-- {
|
||||||
|
name := p.stringAt(r.uint64())
|
||||||
|
nameIndex[name] = r.uint64()
|
||||||
|
}
|
||||||
|
|
||||||
|
p.pkgIndex[pkg] = nameIndex
|
||||||
|
pkgList[i] = pkg
|
||||||
|
}
|
||||||
|
var localpkg *types.Package
|
||||||
|
for _, pkg := range pkgList {
|
||||||
|
if pkg.Path() == path {
|
||||||
|
localpkg = pkg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
names := make([]string, 0, len(p.pkgIndex[localpkg]))
|
||||||
|
for name := range p.pkgIndex[localpkg] {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
sort.Strings(names)
|
||||||
|
for _, name := range names {
|
||||||
|
p.doDecl(localpkg, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, typ := range p.interfaceList {
|
||||||
|
typ.Complete()
|
||||||
|
}
|
||||||
|
|
||||||
|
// record all referenced packages as imports
|
||||||
|
list := append(([]*types.Package)(nil), pkgList[1:]...)
|
||||||
|
sort.Sort(byPath(list))
|
||||||
|
localpkg.SetImports(list)
|
||||||
|
|
||||||
|
// package was imported completely and without errors
|
||||||
|
localpkg.MarkComplete()
|
||||||
|
|
||||||
|
consumed, _ := r.Seek(0, io.SeekCurrent)
|
||||||
|
return int(consumed), localpkg, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type iimporter struct {
|
||||||
|
ipath string
|
||||||
|
|
||||||
|
stringData []byte
|
||||||
|
stringCache map[uint64]string
|
||||||
|
pkgCache map[uint64]*types.Package
|
||||||
|
|
||||||
|
declData []byte
|
||||||
|
pkgIndex map[*types.Package]map[string]uint64
|
||||||
|
typCache map[uint64]types.Type
|
||||||
|
|
||||||
|
fake fakeFileSet
|
||||||
|
interfaceList []*types.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iimporter) doDecl(pkg *types.Package, name string) {
|
||||||
|
// See if we've already imported this declaration.
|
||||||
|
if obj := pkg.Scope().Lookup(name); obj != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
off, ok := p.pkgIndex[pkg][name]
|
||||||
|
if !ok {
|
||||||
|
errorf("%v.%v not in index", pkg, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
r := &importReader{p: p, currPkg: pkg}
|
||||||
|
r.declReader.Reset(p.declData[off:])
|
||||||
|
|
||||||
|
r.obj(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iimporter) stringAt(off uint64) string {
|
||||||
|
if s, ok := p.stringCache[off]; ok {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
slen, n := binary.Uvarint(p.stringData[off:])
|
||||||
|
if n <= 0 {
|
||||||
|
errorf("varint failed")
|
||||||
|
}
|
||||||
|
spos := off + uint64(n)
|
||||||
|
s := string(p.stringData[spos : spos+slen])
|
||||||
|
p.stringCache[off] = s
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iimporter) pkgAt(off uint64) *types.Package {
|
||||||
|
if pkg, ok := p.pkgCache[off]; ok {
|
||||||
|
return pkg
|
||||||
|
}
|
||||||
|
path := p.stringAt(off)
|
||||||
|
errorf("missing package %q in %q", path, p.ipath)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *iimporter) typAt(off uint64, base *types.Named) types.Type {
|
||||||
|
if t, ok := p.typCache[off]; ok && (base == nil || !isInterface(t)) {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
if off < predeclReserved {
|
||||||
|
errorf("predeclared type missing from cache: %v", off)
|
||||||
|
}
|
||||||
|
|
||||||
|
r := &importReader{p: p}
|
||||||
|
r.declReader.Reset(p.declData[off-predeclReserved:])
|
||||||
|
t := r.doType(base)
|
||||||
|
|
||||||
|
if base == nil || !isInterface(t) {
|
||||||
|
p.typCache[off] = t
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
type importReader struct {
|
||||||
|
p *iimporter
|
||||||
|
declReader bytes.Reader
|
||||||
|
currPkg *types.Package
|
||||||
|
prevFile string
|
||||||
|
prevLine int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) obj(name string) {
|
||||||
|
tag := r.byte()
|
||||||
|
pos := r.pos()
|
||||||
|
|
||||||
|
switch tag {
|
||||||
|
case 'A':
|
||||||
|
typ := r.typ()
|
||||||
|
|
||||||
|
r.declare(types.NewTypeName(pos, r.currPkg, name, typ))
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
typ, val := r.value()
|
||||||
|
|
||||||
|
r.declare(types.NewConst(pos, r.currPkg, name, typ, val))
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
sig := r.signature(nil)
|
||||||
|
|
||||||
|
r.declare(types.NewFunc(pos, r.currPkg, name, sig))
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
// Types can be recursive. We need to setup a stub
|
||||||
|
// declaration before recursing.
|
||||||
|
obj := types.NewTypeName(pos, r.currPkg, name, nil)
|
||||||
|
named := types.NewNamed(obj, nil, nil)
|
||||||
|
r.declare(obj)
|
||||||
|
|
||||||
|
underlying := r.p.typAt(r.uint64(), named).Underlying()
|
||||||
|
named.SetUnderlying(underlying)
|
||||||
|
|
||||||
|
if !isInterface(underlying) {
|
||||||
|
for n := r.uint64(); n > 0; n-- {
|
||||||
|
mpos := r.pos()
|
||||||
|
mname := r.ident()
|
||||||
|
recv := r.param()
|
||||||
|
msig := r.signature(recv)
|
||||||
|
|
||||||
|
named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'V':
|
||||||
|
typ := r.typ()
|
||||||
|
|
||||||
|
r.declare(types.NewVar(pos, r.currPkg, name, typ))
|
||||||
|
|
||||||
|
default:
|
||||||
|
errorf("unexpected tag: %v", tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) declare(obj types.Object) {
|
||||||
|
obj.Pkg().Scope().Insert(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) value() (typ types.Type, val constant.Value) {
|
||||||
|
typ = r.typ()
|
||||||
|
|
||||||
|
switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType {
|
||||||
|
case types.IsBoolean:
|
||||||
|
val = constant.MakeBool(r.bool())
|
||||||
|
|
||||||
|
case types.IsString:
|
||||||
|
val = constant.MakeString(r.string())
|
||||||
|
|
||||||
|
case types.IsInteger:
|
||||||
|
val = r.mpint(b)
|
||||||
|
|
||||||
|
case types.IsFloat:
|
||||||
|
val = r.mpfloat(b)
|
||||||
|
|
||||||
|
case types.IsComplex:
|
||||||
|
re := r.mpfloat(b)
|
||||||
|
im := r.mpfloat(b)
|
||||||
|
val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im))
|
||||||
|
|
||||||
|
default:
|
||||||
|
if b.Kind() == types.Invalid {
|
||||||
|
val = constant.MakeUnknown()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errorf("unexpected type %v", typ) // panics
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func intSize(b *types.Basic) (signed bool, maxBytes uint) {
|
||||||
|
if (b.Info() & types.IsUntyped) != 0 {
|
||||||
|
return true, 64
|
||||||
|
}
|
||||||
|
|
||||||
|
switch b.Kind() {
|
||||||
|
case types.Float32, types.Complex64:
|
||||||
|
return true, 3
|
||||||
|
case types.Float64, types.Complex128:
|
||||||
|
return true, 7
|
||||||
|
}
|
||||||
|
|
||||||
|
signed = (b.Info() & types.IsUnsigned) == 0
|
||||||
|
switch b.Kind() {
|
||||||
|
case types.Int8, types.Uint8:
|
||||||
|
maxBytes = 1
|
||||||
|
case types.Int16, types.Uint16:
|
||||||
|
maxBytes = 2
|
||||||
|
case types.Int32, types.Uint32:
|
||||||
|
maxBytes = 4
|
||||||
|
default:
|
||||||
|
maxBytes = 8
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) mpint(b *types.Basic) constant.Value {
|
||||||
|
signed, maxBytes := intSize(b)
|
||||||
|
|
||||||
|
maxSmall := 256 - maxBytes
|
||||||
|
if signed {
|
||||||
|
maxSmall = 256 - 2*maxBytes
|
||||||
|
}
|
||||||
|
if maxBytes == 1 {
|
||||||
|
maxSmall = 256
|
||||||
|
}
|
||||||
|
|
||||||
|
n, _ := r.declReader.ReadByte()
|
||||||
|
if uint(n) < maxSmall {
|
||||||
|
v := int64(n)
|
||||||
|
if signed {
|
||||||
|
v >>= 1
|
||||||
|
if n&1 != 0 {
|
||||||
|
v = ^v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return constant.MakeInt64(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
v := -n
|
||||||
|
if signed {
|
||||||
|
v = -(n &^ 1) >> 1
|
||||||
|
}
|
||||||
|
if v < 1 || uint(v) > maxBytes {
|
||||||
|
errorf("weird decoding: %v, %v => %v", n, signed, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := make([]byte, v)
|
||||||
|
io.ReadFull(&r.declReader, buf)
|
||||||
|
|
||||||
|
// convert to little endian
|
||||||
|
// TODO(gri) go/constant should have a more direct conversion function
|
||||||
|
// (e.g., once it supports a big.Float based implementation)
|
||||||
|
for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
|
||||||
|
buf[i], buf[j] = buf[j], buf[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
x := constant.MakeFromBytes(buf)
|
||||||
|
if signed && n&1 != 0 {
|
||||||
|
x = constant.UnaryOp(token.SUB, x, 0)
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) mpfloat(b *types.Basic) constant.Value {
|
||||||
|
x := r.mpint(b)
|
||||||
|
if constant.Sign(x) == 0 {
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
exp := r.int64()
|
||||||
|
switch {
|
||||||
|
case exp > 0:
|
||||||
|
x = constant.Shift(x, token.SHL, uint(exp))
|
||||||
|
case exp < 0:
|
||||||
|
d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp))
|
||||||
|
x = constant.BinaryOp(x, token.QUO, d)
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) ident() string {
|
||||||
|
return r.string()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) qualifiedIdent() (*types.Package, string) {
|
||||||
|
name := r.string()
|
||||||
|
pkg := r.pkg()
|
||||||
|
return pkg, name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) pos() token.Pos {
|
||||||
|
delta := r.int64()
|
||||||
|
if delta != deltaNewFile {
|
||||||
|
r.prevLine += delta
|
||||||
|
} else if l := r.int64(); l == -1 {
|
||||||
|
r.prevLine += deltaNewFile
|
||||||
|
} else {
|
||||||
|
r.prevFile = r.string()
|
||||||
|
r.prevLine = l
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.prevFile == "" && r.prevLine == 0 {
|
||||||
|
return token.NoPos
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.p.fake.pos(r.prevFile, int(r.prevLine))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) typ() types.Type {
|
||||||
|
return r.p.typAt(r.uint64(), nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isInterface(t types.Type) bool {
|
||||||
|
_, ok := t.(*types.Interface)
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) }
|
||||||
|
func (r *importReader) string() string { return r.p.stringAt(r.uint64()) }
|
||||||
|
|
||||||
|
func (r *importReader) doType(base *types.Named) types.Type {
|
||||||
|
switch k := r.kind(); k {
|
||||||
|
default:
|
||||||
|
errorf("unexpected kind tag in %q: %v", r.p.ipath, k)
|
||||||
|
return nil
|
||||||
|
|
||||||
|
case definedType:
|
||||||
|
pkg, name := r.qualifiedIdent()
|
||||||
|
r.p.doDecl(pkg, name)
|
||||||
|
return pkg.Scope().Lookup(name).(*types.TypeName).Type()
|
||||||
|
case pointerType:
|
||||||
|
return types.NewPointer(r.typ())
|
||||||
|
case sliceType:
|
||||||
|
return types.NewSlice(r.typ())
|
||||||
|
case arrayType:
|
||||||
|
n := r.uint64()
|
||||||
|
return types.NewArray(r.typ(), int64(n))
|
||||||
|
case chanType:
|
||||||
|
dir := chanDir(int(r.uint64()))
|
||||||
|
return types.NewChan(dir, r.typ())
|
||||||
|
case mapType:
|
||||||
|
return types.NewMap(r.typ(), r.typ())
|
||||||
|
case signatureType:
|
||||||
|
r.currPkg = r.pkg()
|
||||||
|
return r.signature(nil)
|
||||||
|
|
||||||
|
case structType:
|
||||||
|
r.currPkg = r.pkg()
|
||||||
|
|
||||||
|
fields := make([]*types.Var, r.uint64())
|
||||||
|
tags := make([]string, len(fields))
|
||||||
|
for i := range fields {
|
||||||
|
fpos := r.pos()
|
||||||
|
fname := r.ident()
|
||||||
|
ftyp := r.typ()
|
||||||
|
emb := r.bool()
|
||||||
|
tag := r.string()
|
||||||
|
|
||||||
|
fields[i] = types.NewField(fpos, r.currPkg, fname, ftyp, emb)
|
||||||
|
tags[i] = tag
|
||||||
|
}
|
||||||
|
return types.NewStruct(fields, tags)
|
||||||
|
|
||||||
|
case interfaceType:
|
||||||
|
r.currPkg = r.pkg()
|
||||||
|
|
||||||
|
embeddeds := make([]types.Type, r.uint64())
|
||||||
|
for i := range embeddeds {
|
||||||
|
_ = r.pos()
|
||||||
|
embeddeds[i] = r.typ()
|
||||||
|
}
|
||||||
|
|
||||||
|
methods := make([]*types.Func, r.uint64())
|
||||||
|
for i := range methods {
|
||||||
|
mpos := r.pos()
|
||||||
|
mname := r.ident()
|
||||||
|
|
||||||
|
// TODO(mdempsky): Matches bimport.go, but I
|
||||||
|
// don't agree with this.
|
||||||
|
var recv *types.Var
|
||||||
|
if base != nil {
|
||||||
|
recv = types.NewVar(token.NoPos, r.currPkg, "", base)
|
||||||
|
}
|
||||||
|
|
||||||
|
msig := r.signature(recv)
|
||||||
|
methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig)
|
||||||
|
}
|
||||||
|
|
||||||
|
typ := newInterface(methods, embeddeds)
|
||||||
|
r.p.interfaceList = append(r.p.interfaceList, typ)
|
||||||
|
return typ
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) kind() itag {
|
||||||
|
return itag(r.uint64())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) signature(recv *types.Var) *types.Signature {
|
||||||
|
params := r.paramList()
|
||||||
|
results := r.paramList()
|
||||||
|
variadic := params.Len() > 0 && r.bool()
|
||||||
|
return types.NewSignature(recv, params, results, variadic)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) paramList() *types.Tuple {
|
||||||
|
xs := make([]*types.Var, r.uint64())
|
||||||
|
for i := range xs {
|
||||||
|
xs[i] = r.param()
|
||||||
|
}
|
||||||
|
return types.NewTuple(xs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) param() *types.Var {
|
||||||
|
pos := r.pos()
|
||||||
|
name := r.ident()
|
||||||
|
typ := r.typ()
|
||||||
|
return types.NewParam(pos, r.currPkg, name, typ)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) bool() bool {
|
||||||
|
return r.uint64() != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) int64() int64 {
|
||||||
|
n, err := binary.ReadVarint(&r.declReader)
|
||||||
|
if err != nil {
|
||||||
|
errorf("readVarint: %v", err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) uint64() uint64 {
|
||||||
|
n, err := binary.ReadUvarint(&r.declReader)
|
||||||
|
if err != nil {
|
||||||
|
errorf("readUvarint: %v", err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *importReader) byte() byte {
|
||||||
|
x, err := r.declReader.ReadByte()
|
||||||
|
if err != nil {
|
||||||
|
errorf("declReader.ReadByte: %v", err)
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
21
vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go
generated
vendored
Normal file
21
vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// +build !go1.11
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import "go/types"
|
||||||
|
|
||||||
|
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
|
||||||
|
named := make([]*types.Named, len(embeddeds))
|
||||||
|
for i, e := range embeddeds {
|
||||||
|
var ok bool
|
||||||
|
named[i], ok = e.(*types.Named)
|
||||||
|
if !ok {
|
||||||
|
panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return types.NewInterface(methods, named)
|
||||||
|
}
|
13
vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go
generated
vendored
Normal file
13
vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// +build go1.11
|
||||||
|
|
||||||
|
package gcimporter
|
||||||
|
|
||||||
|
import "go/types"
|
||||||
|
|
||||||
|
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
|
||||||
|
return types.NewInterfaceType(methods, embeddeds)
|
||||||
|
}
|
160
vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go
generated
vendored
Normal file
160
vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go
generated
vendored
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
// 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 packagesdriver fetches type sizes for go/packages and go/analysis.
|
||||||
|
package packagesdriver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var debug = false
|
||||||
|
|
||||||
|
// GetSizes returns the sizes used by the underlying driver with the given parameters.
|
||||||
|
func GetSizes(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) {
|
||||||
|
// TODO(matloob): Clean this up. This code is mostly a copy of packages.findExternalDriver.
|
||||||
|
const toolPrefix = "GOPACKAGESDRIVER="
|
||||||
|
tool := ""
|
||||||
|
for _, env := range env {
|
||||||
|
if val := strings.TrimPrefix(env, toolPrefix); val != env {
|
||||||
|
tool = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if tool == "" {
|
||||||
|
var err error
|
||||||
|
tool, err = exec.LookPath("gopackagesdriver")
|
||||||
|
if err != nil {
|
||||||
|
// We did not find the driver, so use "go list".
|
||||||
|
tool = "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if tool == "off" {
|
||||||
|
return GetSizesGolist(ctx, buildFlags, env, dir, usesExportData)
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := json.Marshal(struct {
|
||||||
|
Command string `json:"command"`
|
||||||
|
Env []string `json:"env"`
|
||||||
|
BuildFlags []string `json:"build_flags"`
|
||||||
|
}{
|
||||||
|
Command: "sizes",
|
||||||
|
Env: env,
|
||||||
|
BuildFlags: buildFlags,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to encode message to driver tool: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
cmd := exec.CommandContext(ctx, tool)
|
||||||
|
cmd.Dir = dir
|
||||||
|
cmd.Env = env
|
||||||
|
cmd.Stdin = bytes.NewReader(req)
|
||||||
|
cmd.Stdout = buf
|
||||||
|
cmd.Stderr = new(bytes.Buffer)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr)
|
||||||
|
}
|
||||||
|
var response struct {
|
||||||
|
// Sizes, if not nil, is the types.Sizes to use when type checking.
|
||||||
|
Sizes *types.StdSizes
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(buf.Bytes(), &response); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response.Sizes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetSizesGolist(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) {
|
||||||
|
args := []string{"list", "-f", "{{context.GOARCH}} {{context.Compiler}}"}
|
||||||
|
args = append(args, buildFlags...)
|
||||||
|
args = append(args, "--", "unsafe")
|
||||||
|
stdout, err := InvokeGo(ctx, env, dir, usesExportData, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fields := strings.Fields(stdout.String())
|
||||||
|
if len(fields) < 2 {
|
||||||
|
return nil, fmt.Errorf("could not determine GOARCH and Go compiler")
|
||||||
|
}
|
||||||
|
goarch := fields[0]
|
||||||
|
compiler := fields[1]
|
||||||
|
return types.SizesFor(compiler, goarch), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// InvokeGo returns the stdout of a go command invocation.
|
||||||
|
func InvokeGo(ctx context.Context, env []string, dir string, usesExportData bool, args ...string) (*bytes.Buffer, error) {
|
||||||
|
if debug {
|
||||||
|
defer func(start time.Time) { log.Printf("%s for %v", time.Since(start), cmdDebugStr(env, args...)) }(time.Now())
|
||||||
|
}
|
||||||
|
stdout := new(bytes.Buffer)
|
||||||
|
stderr := new(bytes.Buffer)
|
||||||
|
cmd := exec.CommandContext(ctx, "go", args...)
|
||||||
|
// On darwin the cwd gets resolved to the real path, which breaks anything that
|
||||||
|
// expects the working directory to keep the original path, including the
|
||||||
|
// go command when dealing with modules.
|
||||||
|
// The Go stdlib has a special feature where if the cwd and the PWD are the
|
||||||
|
// same node then it trusts the PWD, so by setting it in the env for the child
|
||||||
|
// process we fix up all the paths returned by the go command.
|
||||||
|
cmd.Env = append(append([]string{}, env...), "PWD="+dir)
|
||||||
|
cmd.Dir = dir
|
||||||
|
cmd.Stdout = stdout
|
||||||
|
cmd.Stderr = stderr
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
exitErr, ok := err.(*exec.ExitError)
|
||||||
|
if !ok {
|
||||||
|
// Catastrophic error:
|
||||||
|
// - executable not found
|
||||||
|
// - context cancellation
|
||||||
|
return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export mode entails a build.
|
||||||
|
// If that build fails, errors appear on stderr
|
||||||
|
// (despite the -e flag) and the Export field is blank.
|
||||||
|
// Do not fail in that case.
|
||||||
|
if !usesExportData {
|
||||||
|
return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// As of writing, go list -export prints some non-fatal compilation
|
||||||
|
// errors to stderr, even with -e set. We would prefer that it put
|
||||||
|
// 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
|
||||||
|
// be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS
|
||||||
|
// is set.
|
||||||
|
if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(env, args...), stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// debugging
|
||||||
|
if false {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(env, args...), stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
return stdout, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func cmdDebugStr(envlist []string, args ...string) string {
|
||||||
|
env := make(map[string]string)
|
||||||
|
for _, kv := range envlist {
|
||||||
|
split := strings.Split(kv, "=")
|
||||||
|
k, v := split[0], split[1]
|
||||||
|
env[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], args)
|
||||||
|
}
|
222
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
Normal file
222
vendor/golang.org/x/tools/go/packages/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
// 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 loads Go packages for inspection and analysis.
|
||||||
|
|
||||||
|
The Load function takes as input a list of patterns and return a list of Package
|
||||||
|
structs describing individual packages matched by those patterns.
|
||||||
|
The LoadMode controls the amount of detail in the loaded packages.
|
||||||
|
|
||||||
|
Load passes most patterns directly to the underlying build tool,
|
||||||
|
but all patterns with the prefix "query=", where query is a
|
||||||
|
non-empty string of letters from [a-z], are reserved and may be
|
||||||
|
interpreted as query operators.
|
||||||
|
|
||||||
|
Two query operators are currently supported: "file" and "pattern".
|
||||||
|
|
||||||
|
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"
|
||||||
|
might return the packages "fmt" and "fmt [fmt.test]".
|
||||||
|
|
||||||
|
The query "pattern=string" causes "string" to be passed directly to
|
||||||
|
the underlying build tool. In most cases this is unnecessary,
|
||||||
|
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 '='.
|
||||||
|
|
||||||
|
All other query operators are reserved for future use and currently
|
||||||
|
cause Load to report an error.
|
||||||
|
|
||||||
|
The Package struct provides basic information about the package, including
|
||||||
|
|
||||||
|
- ID, a unique identifier for the package in the returned set;
|
||||||
|
- GoFiles, the names of the package's Go source files;
|
||||||
|
- Imports, a map from source import strings to the Packages they name;
|
||||||
|
- Types, the type information for the package's exported symbols;
|
||||||
|
- Syntax, the parsed syntax trees for the package's source code; and
|
||||||
|
- TypeInfo, the result of a complete type-check of the package syntax trees.
|
||||||
|
|
||||||
|
(See the documentation for type Package for the complete list of fields
|
||||||
|
and more detailed descriptions.)
|
||||||
|
|
||||||
|
For example,
|
||||||
|
|
||||||
|
Load(nil, "bytes", "unicode...")
|
||||||
|
|
||||||
|
returns four Package structs describing the standard library packages
|
||||||
|
bytes, unicode, unicode/utf16, and unicode/utf8. Note that one pattern
|
||||||
|
can match multiple packages and that a package might be matched by
|
||||||
|
multiple patterns: in general it is not possible to determine which
|
||||||
|
packages correspond to which patterns.
|
||||||
|
|
||||||
|
Note that the list returned by Load contains only the packages matched
|
||||||
|
by the patterns. Their dependencies can be found by walking the import
|
||||||
|
graph using the Imports fields.
|
||||||
|
|
||||||
|
The Load function can be configured by passing a pointer to a Config as
|
||||||
|
the first argument. A nil Config is equivalent to the zero Config, which
|
||||||
|
causes Load to run in LoadFiles mode, collecting minimal information.
|
||||||
|
See the documentation for type Config for details.
|
||||||
|
|
||||||
|
As noted earlier, the Config.Mode controls the amount of detail
|
||||||
|
reported about the loaded packages, with each mode returning all the data of the
|
||||||
|
previous mode with some extra added. See the documentation for type LoadMode
|
||||||
|
for details.
|
||||||
|
|
||||||
|
Most tools should pass their command-line arguments (after any flags)
|
||||||
|
uninterpreted to the loader, so that the loader can interpret them
|
||||||
|
according to the conventions of the underlying build system.
|
||||||
|
See the Example function for typical usage.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package packages // import "golang.org/x/tools/go/packages"
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Motivation and design considerations
|
||||||
|
|
||||||
|
The new package's design solves problems addressed by two existing
|
||||||
|
packages: go/build, which locates and describes packages, and
|
||||||
|
golang.org/x/tools/go/loader, which loads, parses and type-checks them.
|
||||||
|
The go/build.Package structure encodes too much of the 'go build' way
|
||||||
|
of organizing projects, leaving us in need of a data type that describes a
|
||||||
|
package of Go source code independent of the underlying build system.
|
||||||
|
We wanted something that works equally well with go build and vgo, and
|
||||||
|
also other build systems such as Bazel and Blaze, making it possible to
|
||||||
|
construct analysis tools that work in all these environments.
|
||||||
|
Tools such as errcheck and staticcheck were essentially unavailable to
|
||||||
|
the Go community at Google, and some of Google's internal tools for Go
|
||||||
|
are unavailable externally.
|
||||||
|
This new package provides a uniform way to obtain package metadata by
|
||||||
|
querying each of these build systems, optionally supporting their
|
||||||
|
preferred command-line notations for packages, so that tools integrate
|
||||||
|
neatly with users' build environments. The Metadata query function
|
||||||
|
executes an external query tool appropriate to the current workspace.
|
||||||
|
|
||||||
|
Loading packages always returns the complete import graph "all the way down",
|
||||||
|
even if all you want is information about a single package, because the query
|
||||||
|
mechanisms of all the build systems we currently support ({go,vgo} list, and
|
||||||
|
blaze/bazel aspect-based query) cannot provide detailed information
|
||||||
|
about one package without visiting all its dependencies too, so there is
|
||||||
|
no additional asymptotic cost to providing transitive information.
|
||||||
|
(This property might not be true of a hypothetical 5th build system.)
|
||||||
|
|
||||||
|
In calls to TypeCheck, all initial packages, and any package that
|
||||||
|
transitively depends on one of them, must be loaded from source.
|
||||||
|
Consider A->B->C->D->E: if A,C are initial, A,B,C must be loaded from
|
||||||
|
source; D may be loaded from export data, and E may not be loaded at all
|
||||||
|
(though it's possible that D's export data mentions it, so a
|
||||||
|
types.Package may be created for it and exposed.)
|
||||||
|
|
||||||
|
The old loader had a feature to suppress type-checking of function
|
||||||
|
bodies on a per-package basis, primarily intended to reduce the work of
|
||||||
|
obtaining type information for imported packages. Now that imports are
|
||||||
|
satisfied by export data, the optimization no longer seems necessary.
|
||||||
|
|
||||||
|
Despite some early attempts, the old loader did not exploit export data,
|
||||||
|
instead always using the equivalent of WholeProgram mode. This was due
|
||||||
|
to the complexity of mixing source and export data packages (now
|
||||||
|
resolved by the upward traversal mentioned above), and because export data
|
||||||
|
files were nearly always missing or stale. Now that 'go build' supports
|
||||||
|
caching, all the underlying build systems can guarantee to produce
|
||||||
|
export data in a reasonable (amortized) time.
|
||||||
|
|
||||||
|
Test "main" packages synthesized by the build system are now reported as
|
||||||
|
first-class packages, avoiding the need for clients (such as go/ssa) to
|
||||||
|
reinvent this generation logic.
|
||||||
|
|
||||||
|
One way in which go/packages is simpler than the old loader is in its
|
||||||
|
treatment of in-package tests. In-package tests are packages that
|
||||||
|
consist of all the files of the library under test, plus the test files.
|
||||||
|
The old loader constructed in-package tests by a two-phase process of
|
||||||
|
mutation called "augmentation": first it would construct and type check
|
||||||
|
all the ordinary library packages and type-check the packages that
|
||||||
|
depend on them; then it would add more (test) files to the package and
|
||||||
|
type-check again. This two-phase approach had four major problems:
|
||||||
|
1) in processing the tests, the loader modified the library package,
|
||||||
|
leaving no way for a client application to see both the test
|
||||||
|
package and the library package; one would mutate into the other.
|
||||||
|
2) because test files can declare additional methods on types defined in
|
||||||
|
the library portion of the package, the dispatch of method calls in
|
||||||
|
the library portion was affected by the presence of the test files.
|
||||||
|
This should have been a clue that the packages were logically
|
||||||
|
different.
|
||||||
|
3) this model of "augmentation" assumed at most one in-package test
|
||||||
|
per library package, which is true of projects using 'go build',
|
||||||
|
but not other build systems.
|
||||||
|
4) because of the two-phase nature of test processing, all packages that
|
||||||
|
import the library package had to be processed before augmentation,
|
||||||
|
forcing a "one-shot" API and preventing the client from calling Load
|
||||||
|
in several times in sequence as is now possible in WholeProgram mode.
|
||||||
|
(TypeCheck mode has a similar one-shot restriction for a different reason.)
|
||||||
|
|
||||||
|
Early drafts of this package supported "multi-shot" operation.
|
||||||
|
Although it allowed clients to make a sequence of calls (or concurrent
|
||||||
|
calls) to Load, building up the graph of Packages incrementally,
|
||||||
|
it was of marginal value: it complicated the API
|
||||||
|
(since it allowed some options to vary across calls but not others),
|
||||||
|
it complicated the implementation,
|
||||||
|
it cannot be made to work in Types mode, as explained above,
|
||||||
|
and it was less efficient than making one combined call (when this is possible).
|
||||||
|
Among the clients we have inspected, none made multiple calls to load
|
||||||
|
but could not be easily and satisfactorily modified to make only a single call.
|
||||||
|
However, applications changes may be required.
|
||||||
|
For example, the ssadump command loads the user-specified packages
|
||||||
|
and in addition the runtime package. It is tempting to simply append
|
||||||
|
"runtime" to the user-provided list, but that does not work if the user
|
||||||
|
specified an ad-hoc package such as [a.go b.go].
|
||||||
|
Instead, ssadump no longer requests the runtime package,
|
||||||
|
but seeks it among the dependencies of the user-specified packages,
|
||||||
|
and emits an error if it is not found.
|
||||||
|
|
||||||
|
Overlays: The Overlay field in the Config allows providing alternate contents
|
||||||
|
for Go source files, by providing a mapping from file path to contents.
|
||||||
|
go/packages will pull in new imports added in overlay files when go/packages
|
||||||
|
is run in LoadImports mode or greater.
|
||||||
|
Overlay support for the go list driver isn't complete yet: if the file doesn't
|
||||||
|
exist on disk, it will only be recognized in an overlay if it is a non-test file
|
||||||
|
and the package would be reported even without the overlay.
|
||||||
|
|
||||||
|
Questions & Tasks
|
||||||
|
|
||||||
|
- Add GOARCH/GOOS?
|
||||||
|
They are not portable concepts, but could be made portable.
|
||||||
|
Our goal has been to allow users to express themselves using the conventions
|
||||||
|
of the underlying build system: if the build system honors GOARCH
|
||||||
|
during a build and during a metadata query, then so should
|
||||||
|
applications built atop that query mechanism.
|
||||||
|
Conversely, if the target architecture of the build is determined by
|
||||||
|
command-line flags, the application can pass the relevant
|
||||||
|
flags through to the build system using a command such as:
|
||||||
|
myapp -query_flag="--cpu=amd64" -query_flag="--os=darwin"
|
||||||
|
However, this approach is low-level, unwieldy, and non-portable.
|
||||||
|
GOOS and GOARCH seem important enough to warrant a dedicated option.
|
||||||
|
|
||||||
|
- How should we handle partial failures such as a mixture of good and
|
||||||
|
malformed patterns, existing and non-existent packages, successful and
|
||||||
|
failed builds, import failures, import cycles, and so on, in a call to
|
||||||
|
Load?
|
||||||
|
|
||||||
|
- Support bazel, blaze, and go1.10 list, not just go1.11 list.
|
||||||
|
|
||||||
|
- Handle (and test) various partial success cases, e.g.
|
||||||
|
a mixture of good packages and:
|
||||||
|
invalid patterns
|
||||||
|
nonexistent packages
|
||||||
|
empty packages
|
||||||
|
packages with malformed package or import declarations
|
||||||
|
unreadable files
|
||||||
|
import cycles
|
||||||
|
other parse errors
|
||||||
|
type errors
|
||||||
|
Make sure we record errors at the correct place in the graph.
|
||||||
|
|
||||||
|
- Missing packages among initial arguments are not reported.
|
||||||
|
Return bogus packages for them, like golist does.
|
||||||
|
|
||||||
|
- "undeclared name" errors (for example) are reported out of source file
|
||||||
|
order. I suspect this is due to the breadth-first resolution now used
|
||||||
|
by go/types. Is that a bug? Discuss with gri.
|
||||||
|
|
||||||
|
*/
|
79
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
Normal file
79
vendor/golang.org/x/tools/go/packages/external.go
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
// 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 enables an external tool to intercept package requests.
|
||||||
|
// If the tool is present then its results are used in preference to
|
||||||
|
// the go list command.
|
||||||
|
|
||||||
|
package packages
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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."
|
||||||
|
// If GOPACKAGESDRIVER is set in the environment findExternalTool returns its
|
||||||
|
// value, otherwise it searches for a binary named gopackagesdriver on the PATH.
|
||||||
|
func findExternalDriver(cfg *Config) driver {
|
||||||
|
const toolPrefix = "GOPACKAGESDRIVER="
|
||||||
|
tool := ""
|
||||||
|
for _, env := range cfg.Env {
|
||||||
|
if val := strings.TrimPrefix(env, toolPrefix); val != env {
|
||||||
|
tool = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if tool != "" && tool == "off" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if tool == "" {
|
||||||
|
var err error
|
||||||
|
tool, err = exec.LookPath("gopackagesdriver")
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
cmd := exec.CommandContext(cfg.Context, tool, words...)
|
||||||
|
cmd.Dir = cfg.Dir
|
||||||
|
cmd.Env = cfg.Env
|
||||||
|
cmd.Stdin = bytes.NewReader(req)
|
||||||
|
cmd.Stdout = buf
|
||||||
|
cmd.Stderr = new(bytes.Buffer)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr)
|
||||||
|
}
|
||||||
|
var response driverResponse
|
||||||
|
if err := json.Unmarshal(buf.Bytes(), &response); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &response, nil
|
||||||
|
}
|
||||||
|
}
|
821
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
Normal file
821
vendor/golang.org/x/tools/go/packages/golist.go
generated
vendored
Normal file
|
@ -0,0 +1,821 @@
|
||||||
|
// 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 (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"go/types"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/tools/go/internal/packagesdriver"
|
||||||
|
"golang.org/x/tools/internal/gopathwalk"
|
||||||
|
"golang.org/x/tools/internal/semver"
|
||||||
|
)
|
||||||
|
|
||||||
|
// debug controls verbose logging.
|
||||||
|
var debug, _ = strconv.ParseBool(os.Getenv("GOPACKAGESDEBUG"))
|
||||||
|
|
||||||
|
// A goTooOldError reports that the go command
|
||||||
|
// found by exec.LookPath is too old to use the new go list behavior.
|
||||||
|
type goTooOldError struct {
|
||||||
|
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
|
||||||
|
// the build system package structure.
|
||||||
|
// See driver for more details.
|
||||||
|
func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) {
|
||||||
|
var sizes types.Sizes
|
||||||
|
var sizeserr error
|
||||||
|
var sizeswg sync.WaitGroup
|
||||||
|
if cfg.Mode&NeedTypesSizes != 0 {
|
||||||
|
sizeswg.Add(1)
|
||||||
|
go func() {
|
||||||
|
sizes, sizeserr = getSizes(cfg)
|
||||||
|
sizeswg.Done()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine files requested in contains patterns
|
||||||
|
var containFiles []string
|
||||||
|
var packagesNamed []string
|
||||||
|
restPatterns := make([]string, 0, len(patterns))
|
||||||
|
// Extract file= and other [querytype]= patterns. Report an error if querytype
|
||||||
|
// doesn't exist.
|
||||||
|
extractQueries:
|
||||||
|
for _, pattern := range patterns {
|
||||||
|
eqidx := strings.Index(pattern, "=")
|
||||||
|
if eqidx < 0 {
|
||||||
|
restPatterns = append(restPatterns, pattern)
|
||||||
|
} else {
|
||||||
|
query, value := pattern[:eqidx], pattern[eqidx+len("="):]
|
||||||
|
switch query {
|
||||||
|
case "file":
|
||||||
|
containFiles = append(containFiles, value)
|
||||||
|
case "pattern":
|
||||||
|
restPatterns = append(restPatterns, value)
|
||||||
|
case "iamashamedtousethedisabledqueryname":
|
||||||
|
packagesNamed = append(packagesNamed, value)
|
||||||
|
case "": // not a reserved query
|
||||||
|
restPatterns = append(restPatterns, pattern)
|
||||||
|
default:
|
||||||
|
for _, rune := range query {
|
||||||
|
if rune < 'a' || rune > 'z' { // not a reserved query
|
||||||
|
restPatterns = append(restPatterns, pattern)
|
||||||
|
continue extractQueries
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Reject all other patterns containing "="
|
||||||
|
return nil, fmt.Errorf("invalid query type %q in query pattern %q", query, pattern)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response := &responseDeduper{}
|
||||||
|
var err error
|
||||||
|
|
||||||
|
// See if we have any patterns to pass through to go list. Zero initial
|
||||||
|
// patterns also requires a go list call, since it's the equivalent of
|
||||||
|
// ".".
|
||||||
|
if len(restPatterns) > 0 || len(patterns) == 0 {
|
||||||
|
dr, err := golistDriverCurrent(cfg, restPatterns...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
response.init(dr)
|
||||||
|
} else {
|
||||||
|
response.init(&driverResponse{})
|
||||||
|
}
|
||||||
|
|
||||||
|
sizeswg.Wait()
|
||||||
|
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, golistDriverCurrent, response, containFiles); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(packagesNamed) != 0 {
|
||||||
|
if err := runNamedQueries(cfg, golistDriverCurrent, response, packagesNamed); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response.dr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(containFiles) > 0 {
|
||||||
|
containsCandidates = append(containsCandidates, modifiedPkgs...)
|
||||||
|
containsCandidates = append(containsCandidates, needPkgs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(needPkgs) > 0 {
|
||||||
|
addNeededOverlayPackages(cfg, golistDriverCurrent, response, needPkgs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check candidate packages for containFiles.
|
||||||
|
if len(containFiles) > 0 {
|
||||||
|
for _, id := range containsCandidates {
|
||||||
|
pkg := response.seenPackages[id]
|
||||||
|
for _, f := range containFiles {
|
||||||
|
for _, g := range pkg.GoFiles {
|
||||||
|
if sameFile(f, g) {
|
||||||
|
response.addRoot(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.dr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string) error {
|
||||||
|
dr, err := driver(cfg, pkgs...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, pkg := range dr.Packages {
|
||||||
|
response.addPackage(pkg)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error {
|
||||||
|
for _, query := range queries {
|
||||||
|
// TODO(matloob): Do only one query per directory.
|
||||||
|
fdir := filepath.Dir(query)
|
||||||
|
// Pass absolute path of directory to go list so that it knows to treat it as a directory,
|
||||||
|
// not a package path.
|
||||||
|
pattern, err := filepath.Abs(fdir)
|
||||||
|
if err != nil {
|
||||||
|
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))
|
||||||
|
for _, root := range dirResponse.Roots {
|
||||||
|
isRoot[root] = true
|
||||||
|
}
|
||||||
|
for _, pkg := range dirResponse.Packages {
|
||||||
|
// Add any new packages to the main set
|
||||||
|
// 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.
|
||||||
|
// Over-reporting packages is not a problem.
|
||||||
|
response.addPackage(pkg)
|
||||||
|
// if the package was not a root one, it cannot have the file
|
||||||
|
if !isRoot[pkg.ID] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, pkgFile := range pkg.GoFiles {
|
||||||
|
if filepath.Base(query) == filepath.Base(pkgFile) {
|
||||||
|
response.addRoot(pkg.ID)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// modCacheRegexp splits a path in a module cache into module, module version, and package.
|
||||||
|
var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`)
|
||||||
|
|
||||||
|
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.
|
||||||
|
roots, modRoot, err := roots(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan the selected directories. Simple matches, from GOPATH/GOROOT
|
||||||
|
// or the local module, can simply be "go list"ed. Matches from the
|
||||||
|
// module cache need special treatment.
|
||||||
|
var matchesMu sync.Mutex
|
||||||
|
var simpleMatches, modCacheMatches []string
|
||||||
|
add := func(root gopathwalk.Root, dir string) {
|
||||||
|
// Walk calls this concurrently; protect the result slices.
|
||||||
|
matchesMu.Lock()
|
||||||
|
defer matchesMu.Unlock()
|
||||||
|
|
||||||
|
path := dir
|
||||||
|
if dir != root.Path {
|
||||||
|
path = dir[len(root.Path)+1:]
|
||||||
|
}
|
||||||
|
if pathMatchesQueries(path, queries) {
|
||||||
|
switch root.Type {
|
||||||
|
case gopathwalk.RootModuleCache:
|
||||||
|
modCacheMatches = append(modCacheMatches, path)
|
||||||
|
case gopathwalk.RootCurrentModule:
|
||||||
|
// We'd need to read go.mod to find the full
|
||||||
|
// import path. Relative's easier.
|
||||||
|
rel, err := filepath.Rel(cfg.Dir, dir)
|
||||||
|
if err != nil {
|
||||||
|
// This ought to be impossible, since
|
||||||
|
// we found dir in the current module.
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
simpleMatches = append(simpleMatches, "./"+rel)
|
||||||
|
case gopathwalk.RootGOPATH, gopathwalk.RootGOROOT:
|
||||||
|
simpleMatches = append(simpleMatches, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
for _, pkg := range r.Packages {
|
||||||
|
response.addPackage(pkg)
|
||||||
|
for _, name := range queries {
|
||||||
|
if pkg.Name == name {
|
||||||
|
response.addRoot(pkg.ID)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(simpleMatches) != 0 {
|
||||||
|
resp, err := driver(cfg, simpleMatches...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
addResponse(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Module cache matches are tricky. We want to avoid downloading new
|
||||||
|
// versions of things, so we need to use the ones present in the cache.
|
||||||
|
// go list doesn't accept version specifiers, so we have to write out a
|
||||||
|
// temporary module, and do the list in that module.
|
||||||
|
if len(modCacheMatches) != 0 {
|
||||||
|
// Collect all the matches, deduplicating by major version
|
||||||
|
// and preferring the newest.
|
||||||
|
type modInfo struct {
|
||||||
|
mod string
|
||||||
|
major string
|
||||||
|
}
|
||||||
|
mods := make(map[modInfo]string)
|
||||||
|
var imports []string
|
||||||
|
for _, modPath := range modCacheMatches {
|
||||||
|
matches := modCacheRegexp.FindStringSubmatch(modPath)
|
||||||
|
mod, ver := filepath.ToSlash(matches[1]), matches[2]
|
||||||
|
importPath := filepath.ToSlash(filepath.Join(matches[1], matches[3]))
|
||||||
|
|
||||||
|
major := semver.Major(ver)
|
||||||
|
if prevVer, ok := mods[modInfo{mod, major}]; !ok || semver.Compare(ver, prevVer) > 0 {
|
||||||
|
mods[modInfo{mod, major}] = ver
|
||||||
|
}
|
||||||
|
|
||||||
|
imports = append(imports, importPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the temporary module.
|
||||||
|
var gomod bytes.Buffer
|
||||||
|
gomod.WriteString("module modquery\nrequire (\n")
|
||||||
|
for mod, version := range mods {
|
||||||
|
gomod.WriteString("\t" + mod.mod + " " + version + "\n")
|
||||||
|
}
|
||||||
|
gomod.WriteString(")\n")
|
||||||
|
|
||||||
|
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
|
||||||
|
tmpCfg.Dir, err = ioutil.TempDir("", "gopackages-modquery")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tmpCfg.Dir)
|
||||||
|
|
||||||
|
if err := ioutil.WriteFile(filepath.Join(tmpCfg.Dir, "go.mod"), gomod.Bytes(), 0777); err != nil {
|
||||||
|
return fmt.Errorf("writing go.mod for module cache query: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the query, using the import paths calculated from the matches above.
|
||||||
|
resp, err := driver(&tmpCfg, imports...)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("querying module cache matches: %v", err)
|
||||||
|
}
|
||||||
|
addResponse(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
// particularly the environment and the presence of a go.mod in cfg.Dir's parents.
|
||||||
|
func roots(cfg *Config) ([]gopathwalk.Root, string, error) {
|
||||||
|
stdout, err := invokeGo(cfg, "env", "GOROOT", "GOPATH", "GOMOD")
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
fields := strings.Split(stdout.String(), "\n")
|
||||||
|
if len(fields) != 4 || len(fields[3]) != 0 {
|
||||||
|
return nil, "", fmt.Errorf("go env returned unexpected output: %q", stdout.String())
|
||||||
|
}
|
||||||
|
goroot, gopath, gomod := fields[0], filepath.SplitList(fields[1]), fields[2]
|
||||||
|
var modDir string
|
||||||
|
if gomod != "" {
|
||||||
|
modDir = filepath.Dir(gomod)
|
||||||
|
}
|
||||||
|
|
||||||
|
var roots []gopathwalk.Root
|
||||||
|
// Always add GOROOT.
|
||||||
|
roots = append(roots, gopathwalk.Root{filepath.Join(goroot, "/src"), gopathwalk.RootGOROOT})
|
||||||
|
// If modules are enabled, scan the module dir.
|
||||||
|
if modDir != "" {
|
||||||
|
roots = append(roots, gopathwalk.Root{modDir, gopathwalk.RootCurrentModule})
|
||||||
|
}
|
||||||
|
// Add either GOPATH/src or GOPATH/pkg/mod, depending on module mode.
|
||||||
|
for _, p := range gopath {
|
||||||
|
if modDir != "" {
|
||||||
|
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache})
|
||||||
|
} else {
|
||||||
|
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/src"), gopathwalk.RootGOPATH})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return roots, modDir, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// These functions were copied from goimports. See further documentation there.
|
||||||
|
|
||||||
|
// pathMatchesQueries is adapted from pkgIsCandidate.
|
||||||
|
// TODO: is it reasonable to do Contains here, rather than an exact match on a path component?
|
||||||
|
func pathMatchesQueries(path string, queries []string) bool {
|
||||||
|
lastTwo := lastTwoComponents(path)
|
||||||
|
for _, query := range queries {
|
||||||
|
if strings.Contains(lastTwo, query) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(query) {
|
||||||
|
lastTwo = lowerASCIIAndRemoveHyphen(lastTwo)
|
||||||
|
if strings.Contains(lastTwo, query) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// lastTwoComponents returns at most the last two path components
|
||||||
|
// of v, using either / or \ as the path separator.
|
||||||
|
func lastTwoComponents(v string) string {
|
||||||
|
nslash := 0
|
||||||
|
for i := len(v) - 1; i >= 0; i-- {
|
||||||
|
if v[i] == '/' || v[i] == '\\' {
|
||||||
|
nslash++
|
||||||
|
if nslash == 2 {
|
||||||
|
return v[i:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
func hasHyphenOrUpperASCII(s string) bool {
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
b := s[i]
|
||||||
|
if b == '-' || ('A' <= b && b <= 'Z') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func lowerASCIIAndRemoveHyphen(s string) (ret string) {
|
||||||
|
buf := make([]byte, 0, len(s))
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
b := s[i]
|
||||||
|
switch {
|
||||||
|
case b == '-':
|
||||||
|
continue
|
||||||
|
case 'A' <= b && b <= 'Z':
|
||||||
|
buf = append(buf, b+('a'-'A'))
|
||||||
|
default:
|
||||||
|
buf = append(buf, b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string(buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields must match go list;
|
||||||
|
// see $GOROOT/src/cmd/go/internal/load/pkg.go.
|
||||||
|
type jsonPackage struct {
|
||||||
|
ImportPath string
|
||||||
|
Dir string
|
||||||
|
Name string
|
||||||
|
Export string
|
||||||
|
GoFiles []string
|
||||||
|
CompiledGoFiles []string
|
||||||
|
CFiles []string
|
||||||
|
CgoFiles []string
|
||||||
|
CXXFiles []string
|
||||||
|
MFiles []string
|
||||||
|
HFiles []string
|
||||||
|
FFiles []string
|
||||||
|
SFiles []string
|
||||||
|
SwigFiles []string
|
||||||
|
SwigCXXFiles []string
|
||||||
|
SysoFiles []string
|
||||||
|
Imports []string
|
||||||
|
ImportMap map[string]string
|
||||||
|
Deps []string
|
||||||
|
TestGoFiles []string
|
||||||
|
TestImports []string
|
||||||
|
XTestGoFiles []string
|
||||||
|
XTestImports []string
|
||||||
|
ForTest string // q in a "p [q.test]" package, else ""
|
||||||
|
DepOnly bool
|
||||||
|
|
||||||
|
Error *jsonPackageError
|
||||||
|
}
|
||||||
|
|
||||||
|
type jsonPackageError struct {
|
||||||
|
ImportStack []string
|
||||||
|
Pos string
|
||||||
|
Err string
|
||||||
|
}
|
||||||
|
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
|
||||||
|
// golistDriverCurrent uses the "go list" command to expand the
|
||||||
|
// pattern words and return metadata for the specified packages.
|
||||||
|
// dir may be "" and env may be nil, as per os/exec.Command.
|
||||||
|
func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error) {
|
||||||
|
// go list uses the following identifiers in ImportPath and Imports:
|
||||||
|
//
|
||||||
|
// "p" -- importable package or main (command)
|
||||||
|
// "q.test" -- q's test executable
|
||||||
|
// "p [q.test]" -- variant of p as built for q's test executable
|
||||||
|
// "q_test [q.test]" -- q's external test package
|
||||||
|
//
|
||||||
|
// The packages p that are built differently for a test q.test
|
||||||
|
// are q itself, plus any helpers used by the external test q_test,
|
||||||
|
// typically including "testing" and all its dependencies.
|
||||||
|
|
||||||
|
// Run "go list" for complete
|
||||||
|
// information on the specified packages.
|
||||||
|
buf, err := invokeGo(cfg, golistargs(cfg, words)...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
seen := make(map[string]*jsonPackage)
|
||||||
|
// Decode the JSON and convert it to Package form.
|
||||||
|
var response driverResponse
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.ImportPath == "" {
|
||||||
|
// The documentation for go list says that “[e]rroneous packages will have
|
||||||
|
// a non-empty ImportPath”. If for some reason it comes back empty, we
|
||||||
|
// prefer to error out rather than silently discarding data or handing
|
||||||
|
// back a package without any way to refer to it.
|
||||||
|
if p.Error != nil {
|
||||||
|
return nil, Error{
|
||||||
|
Pos: p.Error.Pos,
|
||||||
|
Msg: p.Error.Err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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{
|
||||||
|
Name: p.Name,
|
||||||
|
ID: p.ImportPath,
|
||||||
|
GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles),
|
||||||
|
CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles),
|
||||||
|
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.
|
||||||
|
if i := strings.IndexByte(pkg.ID, ' '); i >= 0 {
|
||||||
|
pkg.PkgPath = pkg.ID[:i]
|
||||||
|
} else {
|
||||||
|
pkg.PkgPath = pkg.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
if pkg.PkgPath == "unsafe" {
|
||||||
|
pkg.GoFiles = nil // ignore fake unsafe.go file
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assume go list emits only absolute paths for Dir.
|
||||||
|
if p.Dir != "" && !filepath.IsAbs(p.Dir) {
|
||||||
|
log.Fatalf("internal error: go list returned non-absolute Package.Dir: %s", p.Dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.Export != "" && !filepath.IsAbs(p.Export) {
|
||||||
|
pkg.ExportFile = filepath.Join(p.Dir, p.Export)
|
||||||
|
} else {
|
||||||
|
pkg.ExportFile = p.Export
|
||||||
|
}
|
||||||
|
|
||||||
|
// imports
|
||||||
|
//
|
||||||
|
// Imports contains the IDs of all imported packages.
|
||||||
|
// ImportsMap records (path, ID) only where they differ.
|
||||||
|
ids := make(map[string]bool)
|
||||||
|
for _, id := range p.Imports {
|
||||||
|
ids[id] = true
|
||||||
|
}
|
||||||
|
pkg.Imports = make(map[string]*Package)
|
||||||
|
for path, id := range p.ImportMap {
|
||||||
|
pkg.Imports[path] = &Package{ID: id} // non-identity import
|
||||||
|
delete(ids, id)
|
||||||
|
}
|
||||||
|
for id := range ids {
|
||||||
|
if id == "C" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg.Imports[id] = &Package{ID: id} // identity import
|
||||||
|
}
|
||||||
|
if !p.DepOnly {
|
||||||
|
response.Roots = append(response.Roots, pkg.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
pkg.CompiledGoFiles = pkg.GoFiles
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.Error != nil {
|
||||||
|
pkg.Errors = append(pkg.Errors, Error{
|
||||||
|
Pos: p.Error.Pos,
|
||||||
|
Msg: p.Error.Err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
response.Packages = append(response.Packages, pkg)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &response, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// absJoin absolutizes and flattens the lists of files.
|
||||||
|
func absJoin(dir string, fileses ...[]string) (res []string) {
|
||||||
|
for _, files := range fileses {
|
||||||
|
for _, file := range files {
|
||||||
|
if !filepath.IsAbs(file) {
|
||||||
|
file = filepath.Join(dir, file)
|
||||||
|
}
|
||||||
|
res = append(res, file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func golistargs(cfg *Config, words []string) []string {
|
||||||
|
const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo
|
||||||
|
fullargs := []string{
|
||||||
|
"list", "-e", "-json",
|
||||||
|
fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypesInfo|NeedTypesSizes) != 0),
|
||||||
|
fmt.Sprintf("-test=%t", cfg.Tests),
|
||||||
|
fmt.Sprintf("-export=%t", usesExportData(cfg)),
|
||||||
|
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, "--")
|
||||||
|
fullargs = append(fullargs, words...)
|
||||||
|
return fullargs
|
||||||
|
}
|
||||||
|
|
||||||
|
// invokeGo returns the stdout of a go command invocation.
|
||||||
|
func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) {
|
||||||
|
stdout := new(bytes.Buffer)
|
||||||
|
stderr := new(bytes.Buffer)
|
||||||
|
cmd := exec.CommandContext(cfg.Context, "go", args...)
|
||||||
|
// On darwin the cwd gets resolved to the real path, which breaks anything that
|
||||||
|
// expects the working directory to keep the original path, including the
|
||||||
|
// go command when dealing with modules.
|
||||||
|
// The Go stdlib has a special feature where if the cwd and the PWD are the
|
||||||
|
// same node then it trusts the PWD, so by setting it in the env for the child
|
||||||
|
// process we fix up all the paths returned by the go command.
|
||||||
|
cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir)
|
||||||
|
cmd.Dir = cfg.Dir
|
||||||
|
cmd.Stdout = stdout
|
||||||
|
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 {
|
||||||
|
// 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)
|
||||||
|
if !ok {
|
||||||
|
// Catastrophic error:
|
||||||
|
// - context cancellation
|
||||||
|
return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Old go version?
|
||||||
|
if strings.Contains(stderr.String(), "flag provided but not defined") {
|
||||||
|
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": "","Incomplete": true,"Error": {"Pos": "","Err": %s}}`,
|
||||||
|
strconv.Quote(strings.Trim(stderr.String(), "\n")))
|
||||||
|
return bytes.NewBufferString(output), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export mode entails a build.
|
||||||
|
// If that build fails, errors appear on stderr
|
||||||
|
// (despite the -e flag) and the Export field is blank.
|
||||||
|
// Do not fail in that case.
|
||||||
|
// 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// As of writing, go list -export prints some non-fatal compilation
|
||||||
|
// errors to stderr, even with -e set. We would prefer that it put
|
||||||
|
// 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
|
||||||
|
// be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS
|
||||||
|
// is set.
|
||||||
|
if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd, args...), stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// debugging
|
||||||
|
if false {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(cmd, args...), stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
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, " "))
|
||||||
|
}
|
104
vendor/golang.org/x/tools/go/packages/golist_overlay.go
generated
vendored
Normal file
104
vendor/golang.org/x/tools/go/packages/golist_overlay.go
generated
vendored
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
package packages
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/parser"
|
||||||
|
"go/token"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// processGolistOverlay provides rudimentary support for adding
|
||||||
|
// files that don't exist on disk to an overlay. The results can be
|
||||||
|
// sometimes incorrect.
|
||||||
|
// TODO(matloob): Handle unsupported cases, including the following:
|
||||||
|
// - test files
|
||||||
|
// - adding test and non-test files to test variants of packages
|
||||||
|
// - determining the correct package to add given a new import path
|
||||||
|
// - creating packages that don't exist
|
||||||
|
func processGolistOverlay(cfg *Config, response *driverResponse) (modifiedPkgs, needPkgs []string, err error) {
|
||||||
|
havePkgs := make(map[string]string) // importPath -> non-test package ID
|
||||||
|
needPkgsSet := make(map[string]bool)
|
||||||
|
modifiedPkgsSet := make(map[string]bool)
|
||||||
|
|
||||||
|
for _, pkg := range response.Packages {
|
||||||
|
// This is an approximation of import path to id. This can be
|
||||||
|
// wrong for tests, vendored packages, and a number of other cases.
|
||||||
|
havePkgs[pkg.PkgPath] = pkg.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
outer:
|
||||||
|
for path, contents := range cfg.Overlay {
|
||||||
|
base := filepath.Base(path)
|
||||||
|
if strings.HasSuffix(path, "_test.go") {
|
||||||
|
// Overlays don't support adding new test files yet.
|
||||||
|
// TODO(matloob): support adding new test files.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dir := filepath.Dir(path)
|
||||||
|
for _, pkg := range response.Packages {
|
||||||
|
var dirContains, fileExists bool
|
||||||
|
for _, f := range pkg.GoFiles {
|
||||||
|
if sameFile(filepath.Dir(f), dir) {
|
||||||
|
dirContains = true
|
||||||
|
}
|
||||||
|
if filepath.Base(f) == base {
|
||||||
|
fileExists = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if dirContains {
|
||||||
|
if !fileExists {
|
||||||
|
pkg.GoFiles = append(pkg.GoFiles, path) // TODO(matloob): should the file just be added to GoFiles?
|
||||||
|
pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, path)
|
||||||
|
modifiedPkgsSet[pkg.ID] = true
|
||||||
|
}
|
||||||
|
imports, err := extractImports(path, contents)
|
||||||
|
if err != nil {
|
||||||
|
// Let the parser or type checker report errors later.
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
for _, imp := range imports {
|
||||||
|
_, found := pkg.Imports[imp]
|
||||||
|
if !found {
|
||||||
|
needPkgsSet[imp] = true
|
||||||
|
// TODO(matloob): Handle cases when the following block isn't correct.
|
||||||
|
// These include imports of test variants, imports of vendored packages, etc.
|
||||||
|
id, ok := havePkgs[imp]
|
||||||
|
if !ok {
|
||||||
|
id = imp
|
||||||
|
}
|
||||||
|
pkg.Imports[imp] = &Package{ID: id}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
needPkgs = make([]string, 0, len(needPkgsSet))
|
||||||
|
for pkg := range needPkgsSet {
|
||||||
|
needPkgs = append(needPkgs, pkg)
|
||||||
|
}
|
||||||
|
modifiedPkgs = make([]string, 0, len(modifiedPkgsSet))
|
||||||
|
for pkg := range modifiedPkgsSet {
|
||||||
|
modifiedPkgs = append(modifiedPkgs, pkg)
|
||||||
|
}
|
||||||
|
return modifiedPkgs, needPkgs, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractImports(filename string, contents []byte) ([]string, error) {
|
||||||
|
f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.ImportsOnly) // TODO(matloob): reuse fileset?
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var res []string
|
||||||
|
for _, imp := range f.Imports {
|
||||||
|
quotedPath := imp.Path.Value
|
||||||
|
path, err := strconv.Unquote(quotedPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
res = append(res, path)
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
1048
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
Normal file
1048
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
55
vendor/golang.org/x/tools/go/packages/visit.go
generated
vendored
Normal file
55
vendor/golang.org/x/tools/go/packages/visit.go
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package packages
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Visit visits all the packages in the import graph whose roots are
|
||||||
|
// pkgs, calling the optional pre function the first time each package
|
||||||
|
// is encountered (preorder), and the optional post function after a
|
||||||
|
// package's dependencies have been visited (postorder).
|
||||||
|
// The boolean result of pre(pkg) determines whether
|
||||||
|
// the imports of package pkg are visited.
|
||||||
|
func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) {
|
||||||
|
seen := make(map[*Package]bool)
|
||||||
|
var visit func(*Package)
|
||||||
|
visit = func(pkg *Package) {
|
||||||
|
if !seen[pkg] {
|
||||||
|
seen[pkg] = true
|
||||||
|
|
||||||
|
if pre == nil || pre(pkg) {
|
||||||
|
paths := make([]string, 0, len(pkg.Imports))
|
||||||
|
for path := range pkg.Imports {
|
||||||
|
paths = append(paths, path)
|
||||||
|
}
|
||||||
|
sort.Strings(paths) // Imports is a map, this makes visit stable
|
||||||
|
for _, path := range paths {
|
||||||
|
visit(pkg.Imports[path])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if post != nil {
|
||||||
|
post(pkg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, pkg := range pkgs {
|
||||||
|
visit(pkg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintErrors prints to os.Stderr the accumulated errors of all
|
||||||
|
// packages in the import graph rooted at pkgs, dependencies first.
|
||||||
|
// PrintErrors returns the number of errors printed.
|
||||||
|
func PrintErrors(pkgs []*Package) int {
|
||||||
|
var n int
|
||||||
|
Visit(pkgs, nil, func(pkg *Package) {
|
||||||
|
for _, err := range pkg.Errors {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return n
|
||||||
|
}
|
1259
vendor/golang.org/x/tools/imports/fix.go
generated
vendored
Normal file
1259
vendor/golang.org/x/tools/imports/fix.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
315
vendor/golang.org/x/tools/imports/imports.go
generated
vendored
Normal file
315
vendor/golang.org/x/tools/imports/imports.go
generated
vendored
Normal file
|
@ -0,0 +1,315 @@
|
||||||
|
// Copyright 2013 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:generate go run mkstdlib.go
|
||||||
|
|
||||||
|
// Package imports implements a Go pretty-printer (like package "go/format")
|
||||||
|
// that also adds or removes import statements as necessary.
|
||||||
|
package imports // import "golang.org/x/tools/imports"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/build"
|
||||||
|
"go/format"
|
||||||
|
"go/parser"
|
||||||
|
"go/printer"
|
||||||
|
"go/token"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/tools/go/ast/astutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Options specifies options for processing files.
|
||||||
|
type Options struct {
|
||||||
|
Fragment bool // Accept fragment of a source file (no package statement)
|
||||||
|
AllErrors bool // Report all errors (not just the first 10 on different lines)
|
||||||
|
|
||||||
|
Comments bool // Print comments (true if nil *Options provided)
|
||||||
|
TabIndent bool // Use tabs for indent (true if nil *Options provided)
|
||||||
|
TabWidth int // Tab width (8 if nil *Options provided)
|
||||||
|
|
||||||
|
FormatOnly bool // Disable the insertion and deletion of imports
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process formats and adjusts imports for the provided file.
|
||||||
|
// If opt is nil the defaults are used.
|
||||||
|
//
|
||||||
|
// Note that filename's directory influences which imports can be chosen,
|
||||||
|
// so it is important that filename be accurate.
|
||||||
|
// To process data ``as if'' it were in filename, pass the data as a non-nil src.
|
||||||
|
func Process(filename string, src []byte, opt *Options) ([]byte, error) {
|
||||||
|
env := &fixEnv{GOPATH: build.Default.GOPATH, GOROOT: build.Default.GOROOT}
|
||||||
|
return process(filename, src, opt, env)
|
||||||
|
}
|
||||||
|
|
||||||
|
func process(filename string, src []byte, opt *Options, env *fixEnv) ([]byte, error) {
|
||||||
|
if opt == nil {
|
||||||
|
opt = &Options{Comments: true, TabIndent: true, TabWidth: 8}
|
||||||
|
}
|
||||||
|
if src == nil {
|
||||||
|
b, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
src = b
|
||||||
|
}
|
||||||
|
|
||||||
|
fileSet := token.NewFileSet()
|
||||||
|
file, adjust, err := parse(fileSet, filename, src, opt)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !opt.FormatOnly {
|
||||||
|
if err := fixImports(fileSet, file, filename, env); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sortImports(fileSet, file)
|
||||||
|
imps := astutil.Imports(fileSet, file)
|
||||||
|
var spacesBefore []string // import paths we need spaces before
|
||||||
|
for _, impSection := range imps {
|
||||||
|
// Within each block of contiguous imports, see if any
|
||||||
|
// import lines are in different group numbers. If so,
|
||||||
|
// we'll need to put a space between them so it's
|
||||||
|
// compatible with gofmt.
|
||||||
|
lastGroup := -1
|
||||||
|
for _, importSpec := range impSection {
|
||||||
|
importPath, _ := strconv.Unquote(importSpec.Path.Value)
|
||||||
|
groupNum := importGroup(importPath)
|
||||||
|
if groupNum != lastGroup && lastGroup != -1 {
|
||||||
|
spacesBefore = append(spacesBefore, importPath)
|
||||||
|
}
|
||||||
|
lastGroup = groupNum
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printerMode := printer.UseSpaces
|
||||||
|
if opt.TabIndent {
|
||||||
|
printerMode |= printer.TabIndent
|
||||||
|
}
|
||||||
|
printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err = printConfig.Fprint(&buf, fileSet, file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
out := buf.Bytes()
|
||||||
|
if adjust != nil {
|
||||||
|
out = adjust(src, out)
|
||||||
|
}
|
||||||
|
if len(spacesBefore) > 0 {
|
||||||
|
out, err = addImportSpaces(bytes.NewReader(out), spacesBefore)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out, err = format.Source(out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse parses src, which was read from filename,
|
||||||
|
// as a Go source file or statement list.
|
||||||
|
func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) {
|
||||||
|
parserMode := parser.Mode(0)
|
||||||
|
if opt.Comments {
|
||||||
|
parserMode |= parser.ParseComments
|
||||||
|
}
|
||||||
|
if opt.AllErrors {
|
||||||
|
parserMode |= parser.AllErrors
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try as whole source file.
|
||||||
|
file, err := parser.ParseFile(fset, filename, src, parserMode)
|
||||||
|
if err == nil {
|
||||||
|
return file, nil, nil
|
||||||
|
}
|
||||||
|
// If the error is that the source file didn't begin with a
|
||||||
|
// package line and we accept fragmented input, fall through to
|
||||||
|
// try as a source fragment. Stop and return on any other error.
|
||||||
|
if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is a declaration list, make it a source file
|
||||||
|
// by inserting a package clause.
|
||||||
|
// Insert using a ;, not a newline, so that parse errors are on
|
||||||
|
// the correct line.
|
||||||
|
const prefix = "package main;"
|
||||||
|
psrc := append([]byte(prefix), src...)
|
||||||
|
file, err = parser.ParseFile(fset, filename, psrc, parserMode)
|
||||||
|
if err == nil {
|
||||||
|
// Gofmt will turn the ; into a \n.
|
||||||
|
// Do that ourselves now and update the file contents,
|
||||||
|
// so that positions and line numbers are correct going forward.
|
||||||
|
psrc[len(prefix)-1] = '\n'
|
||||||
|
fset.File(file.Package).SetLinesForContent(psrc)
|
||||||
|
|
||||||
|
// If a main function exists, we will assume this is a main
|
||||||
|
// package and leave the file.
|
||||||
|
if containsMainFunc(file) {
|
||||||
|
return file, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
adjust := func(orig, src []byte) []byte {
|
||||||
|
// Remove the package clause.
|
||||||
|
src = src[len(prefix):]
|
||||||
|
return matchSpace(orig, src)
|
||||||
|
}
|
||||||
|
return file, adjust, nil
|
||||||
|
}
|
||||||
|
// If the error is that the source file didn't begin with a
|
||||||
|
// declaration, fall through to try as a statement list.
|
||||||
|
// Stop and return on any other error.
|
||||||
|
if !strings.Contains(err.Error(), "expected declaration") {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is a statement list, make it a source file
|
||||||
|
// by inserting a package clause and turning the list
|
||||||
|
// into a function body. This handles expressions too.
|
||||||
|
// Insert using a ;, not a newline, so that the line numbers
|
||||||
|
// in fsrc match the ones in src.
|
||||||
|
fsrc := append(append([]byte("package p; func _() {"), src...), '}')
|
||||||
|
file, err = parser.ParseFile(fset, filename, fsrc, parserMode)
|
||||||
|
if err == nil {
|
||||||
|
adjust := func(orig, src []byte) []byte {
|
||||||
|
// Remove the wrapping.
|
||||||
|
// Gofmt has turned the ; into a \n\n.
|
||||||
|
src = src[len("package p\n\nfunc _() {"):]
|
||||||
|
src = src[:len(src)-len("}\n")]
|
||||||
|
// Gofmt has also indented the function body one level.
|
||||||
|
// Remove that indent.
|
||||||
|
src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1)
|
||||||
|
return matchSpace(orig, src)
|
||||||
|
}
|
||||||
|
return file, adjust, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Failed, and out of options.
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// containsMainFunc checks if a file contains a function declaration with the
|
||||||
|
// function signature 'func main()'
|
||||||
|
func containsMainFunc(file *ast.File) bool {
|
||||||
|
for _, decl := range file.Decls {
|
||||||
|
if f, ok := decl.(*ast.FuncDecl); ok {
|
||||||
|
if f.Name.Name != "main" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(f.Type.Params.List) != 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if f.Type.Results != nil && len(f.Type.Results.List) != 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func cutSpace(b []byte) (before, middle, after []byte) {
|
||||||
|
i := 0
|
||||||
|
for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
j := len(b)
|
||||||
|
for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') {
|
||||||
|
j--
|
||||||
|
}
|
||||||
|
if i <= j {
|
||||||
|
return b[:i], b[i:j], b[j:]
|
||||||
|
}
|
||||||
|
return nil, nil, b[j:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// matchSpace reformats src to use the same space context as orig.
|
||||||
|
// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src.
|
||||||
|
// 2) matchSpace copies the indentation of the first non-blank line in orig
|
||||||
|
// to every non-blank line in src.
|
||||||
|
// 3) matchSpace copies the trailing space from orig and uses it in place
|
||||||
|
// of src's trailing space.
|
||||||
|
func matchSpace(orig []byte, src []byte) []byte {
|
||||||
|
before, _, after := cutSpace(orig)
|
||||||
|
i := bytes.LastIndex(before, []byte{'\n'})
|
||||||
|
before, indent := before[:i+1], before[i+1:]
|
||||||
|
|
||||||
|
_, src, _ = cutSpace(src)
|
||||||
|
|
||||||
|
var b bytes.Buffer
|
||||||
|
b.Write(before)
|
||||||
|
for len(src) > 0 {
|
||||||
|
line := src
|
||||||
|
if i := bytes.IndexByte(line, '\n'); i >= 0 {
|
||||||
|
line, src = line[:i+1], line[i+1:]
|
||||||
|
} else {
|
||||||
|
src = nil
|
||||||
|
}
|
||||||
|
if len(line) > 0 && line[0] != '\n' { // not blank
|
||||||
|
b.Write(indent)
|
||||||
|
}
|
||||||
|
b.Write(line)
|
||||||
|
}
|
||||||
|
b.Write(after)
|
||||||
|
return b.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`)
|
||||||
|
|
||||||
|
func addImportSpaces(r io.Reader, breaks []string) ([]byte, error) {
|
||||||
|
var out bytes.Buffer
|
||||||
|
in := bufio.NewReader(r)
|
||||||
|
inImports := false
|
||||||
|
done := false
|
||||||
|
for {
|
||||||
|
s, err := in.ReadString('\n')
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !inImports && !done && strings.HasPrefix(s, "import") {
|
||||||
|
inImports = true
|
||||||
|
}
|
||||||
|
if inImports && (strings.HasPrefix(s, "var") ||
|
||||||
|
strings.HasPrefix(s, "func") ||
|
||||||
|
strings.HasPrefix(s, "const") ||
|
||||||
|
strings.HasPrefix(s, "type")) {
|
||||||
|
done = true
|
||||||
|
inImports = false
|
||||||
|
}
|
||||||
|
if inImports && len(breaks) > 0 {
|
||||||
|
if m := impLine.FindStringSubmatch(s); m != nil {
|
||||||
|
if m[1] == breaks[0] {
|
||||||
|
out.WriteByte('\n')
|
||||||
|
breaks = breaks[1:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprint(&out, s)
|
||||||
|
}
|
||||||
|
return out.Bytes(), nil
|
||||||
|
}
|
173
vendor/golang.org/x/tools/imports/mkindex.go
generated
vendored
Normal file
173
vendor/golang.org/x/tools/imports/mkindex.go
generated
vendored
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
// Copyright 2013 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.
|
||||||
|
|
||||||
|
// Command mkindex creates the file "pkgindex.go" containing an index of the Go
|
||||||
|
// standard library. The file is intended to be built as part of the imports
|
||||||
|
// package, so that the package may be used in environments where a GOROOT is
|
||||||
|
// not available (such as App Engine).
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/build"
|
||||||
|
"go/format"
|
||||||
|
"go/parser"
|
||||||
|
"go/token"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
pkgIndex = make(map[string][]pkg)
|
||||||
|
exports = make(map[string]map[string]bool)
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Don't use GOPATH.
|
||||||
|
ctx := build.Default
|
||||||
|
ctx.GOPATH = ""
|
||||||
|
|
||||||
|
// Populate pkgIndex global from GOROOT.
|
||||||
|
for _, path := range ctx.SrcDirs() {
|
||||||
|
f, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
children, err := f.Readdir(-1)
|
||||||
|
f.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, child := range children {
|
||||||
|
if child.IsDir() {
|
||||||
|
loadPkg(path, child.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Populate exports global.
|
||||||
|
for _, ps := range pkgIndex {
|
||||||
|
for _, p := range ps {
|
||||||
|
e := loadExports(p.dir)
|
||||||
|
if e != nil {
|
||||||
|
exports[p.dir] = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct source file.
|
||||||
|
var buf bytes.Buffer
|
||||||
|
fmt.Fprint(&buf, pkgIndexHead)
|
||||||
|
fmt.Fprintf(&buf, "var pkgIndexMaster = %#v\n", pkgIndex)
|
||||||
|
fmt.Fprintf(&buf, "var exportsMaster = %#v\n", exports)
|
||||||
|
src := buf.Bytes()
|
||||||
|
|
||||||
|
// Replace main.pkg type name with pkg.
|
||||||
|
src = bytes.Replace(src, []byte("main.pkg"), []byte("pkg"), -1)
|
||||||
|
// Replace actual GOROOT with "/go".
|
||||||
|
src = bytes.Replace(src, []byte(ctx.GOROOT), []byte("/go"), -1)
|
||||||
|
// Add some line wrapping.
|
||||||
|
src = bytes.Replace(src, []byte("}, "), []byte("},\n"), -1)
|
||||||
|
src = bytes.Replace(src, []byte("true, "), []byte("true,\n"), -1)
|
||||||
|
|
||||||
|
var err error
|
||||||
|
src, err = format.Source(src)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write out source file.
|
||||||
|
err = ioutil.WriteFile("pkgindex.go", src, 0644)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pkgIndexHead = `package imports
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
pkgIndexOnce.Do(func() {
|
||||||
|
pkgIndex.m = pkgIndexMaster
|
||||||
|
})
|
||||||
|
loadExports = func(dir string) map[string]bool {
|
||||||
|
return exportsMaster[dir]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
type pkg struct {
|
||||||
|
importpath string // full pkg import path, e.g. "net/http"
|
||||||
|
dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt"
|
||||||
|
}
|
||||||
|
|
||||||
|
var fset = token.NewFileSet()
|
||||||
|
|
||||||
|
func loadPkg(root, importpath string) {
|
||||||
|
shortName := path.Base(importpath)
|
||||||
|
if shortName == "testdata" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dir := filepath.Join(root, importpath)
|
||||||
|
pkgIndex[shortName] = append(pkgIndex[shortName], pkg{
|
||||||
|
importpath: importpath,
|
||||||
|
dir: dir,
|
||||||
|
})
|
||||||
|
|
||||||
|
pkgDir, err := os.Open(dir)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
children, err := pkgDir.Readdir(-1)
|
||||||
|
pkgDir.Close()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, child := range children {
|
||||||
|
name := child.Name()
|
||||||
|
if name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if c := name[0]; c == '.' || ('0' <= c && c <= '9') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if child.IsDir() {
|
||||||
|
loadPkg(root, filepath.Join(importpath, name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadExports(dir string) map[string]bool {
|
||||||
|
exports := make(map[string]bool)
|
||||||
|
buildPkg, err := build.ImportDir(dir, 0)
|
||||||
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "no buildable Go source files in") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
log.Printf("could not import %q: %v", dir, err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for _, file := range buildPkg.GoFiles {
|
||||||
|
f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("could not parse %q: %v", file, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for name := range f.Scope.Objects {
|
||||||
|
if ast.IsExported(name) {
|
||||||
|
exports[name] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exports
|
||||||
|
}
|
112
vendor/golang.org/x/tools/imports/mkstdlib.go
generated
vendored
Normal file
112
vendor/golang.org/x/tools/imports/mkstdlib.go
generated
vendored
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
// mkstdlib generates the zstdlib.go file, containing the Go standard
|
||||||
|
// library API symbols. It's baked into the binary to avoid scanning
|
||||||
|
// GOPATH in the common case.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"go/format"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func mustOpen(name string) io.Reader {
|
||||||
|
f, err := os.Open(name)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
func api(base string) string {
|
||||||
|
return filepath.Join(runtime.GOROOT(), "api", base)
|
||||||
|
}
|
||||||
|
|
||||||
|
var sym = regexp.MustCompile(`^pkg (\S+).*?, (?:var|func|type|const) ([A-Z]\w*)`)
|
||||||
|
|
||||||
|
var unsafeSyms = map[string]bool{"Alignof": true, "ArbitraryType": true, "Offsetof": true, "Pointer": true, "Sizeof": true}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
outf := func(format string, args ...interface{}) {
|
||||||
|
fmt.Fprintf(&buf, format, args...)
|
||||||
|
}
|
||||||
|
outf("// Code generated by mkstdlib.go. DO NOT EDIT.\n\n")
|
||||||
|
outf("package imports\n")
|
||||||
|
outf("var stdlib = map[string]map[string]bool{\n")
|
||||||
|
f := io.MultiReader(
|
||||||
|
mustOpen(api("go1.txt")),
|
||||||
|
mustOpen(api("go1.1.txt")),
|
||||||
|
mustOpen(api("go1.2.txt")),
|
||||||
|
mustOpen(api("go1.3.txt")),
|
||||||
|
mustOpen(api("go1.4.txt")),
|
||||||
|
mustOpen(api("go1.5.txt")),
|
||||||
|
mustOpen(api("go1.6.txt")),
|
||||||
|
mustOpen(api("go1.7.txt")),
|
||||||
|
mustOpen(api("go1.8.txt")),
|
||||||
|
mustOpen(api("go1.9.txt")),
|
||||||
|
mustOpen(api("go1.10.txt")),
|
||||||
|
mustOpen(api("go1.11.txt")),
|
||||||
|
mustOpen(api("go1.12.txt")),
|
||||||
|
)
|
||||||
|
sc := bufio.NewScanner(f)
|
||||||
|
|
||||||
|
pkgs := map[string]map[string]bool{
|
||||||
|
"unsafe": unsafeSyms,
|
||||||
|
}
|
||||||
|
paths := []string{"unsafe"}
|
||||||
|
|
||||||
|
for sc.Scan() {
|
||||||
|
l := sc.Text()
|
||||||
|
has := func(v string) bool { return strings.Contains(l, v) }
|
||||||
|
if has("struct, ") || has("interface, ") || has(", method (") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if m := sym.FindStringSubmatch(l); m != nil {
|
||||||
|
path, sym := m[1], m[2]
|
||||||
|
|
||||||
|
if _, ok := pkgs[path]; !ok {
|
||||||
|
pkgs[path] = map[string]bool{}
|
||||||
|
paths = append(paths, path)
|
||||||
|
}
|
||||||
|
pkgs[path][sym] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := sc.Err(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
sort.Strings(paths)
|
||||||
|
for _, path := range paths {
|
||||||
|
outf("\t%q: map[string]bool{\n", path)
|
||||||
|
pkg := pkgs[path]
|
||||||
|
var syms []string
|
||||||
|
for sym := range pkg {
|
||||||
|
syms = append(syms, sym)
|
||||||
|
}
|
||||||
|
sort.Strings(syms)
|
||||||
|
for _, sym := range syms {
|
||||||
|
outf("\t\t%q: true,\n", sym)
|
||||||
|
}
|
||||||
|
outf("},\n")
|
||||||
|
}
|
||||||
|
outf("}\n")
|
||||||
|
fmtbuf, err := format.Source(buf.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
err = ioutil.WriteFile("zstdlib.go", fmtbuf, 0666)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
355
vendor/golang.org/x/tools/imports/mod.go
generated
vendored
Normal file
355
vendor/golang.org/x/tools/imports/mod.go
generated
vendored
Normal file
|
@ -0,0 +1,355 @@
|
||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/gopathwalk"
|
||||||
|
"golang.org/x/tools/internal/module"
|
||||||
|
)
|
||||||
|
|
||||||
|
// moduleResolver implements resolver for modules using the go command as little
|
||||||
|
// as feasible.
|
||||||
|
type moduleResolver struct {
|
||||||
|
env *fixEnv
|
||||||
|
|
||||||
|
initialized bool
|
||||||
|
main *moduleJSON
|
||||||
|
modsByModPath []*moduleJSON // All modules, ordered by # of path components in module Path...
|
||||||
|
modsByDir []*moduleJSON // ...or Dir.
|
||||||
|
}
|
||||||
|
|
||||||
|
type moduleJSON struct {
|
||||||
|
Path string // module path
|
||||||
|
Version string // module version
|
||||||
|
Versions []string // available module versions (with -versions)
|
||||||
|
Replace *moduleJSON // replaced by this module
|
||||||
|
Time *time.Time // time version was created
|
||||||
|
Update *moduleJSON // available update, if any (with -u)
|
||||||
|
Main bool // is this the main module?
|
||||||
|
Indirect bool // is this module only an indirect dependency of main module?
|
||||||
|
Dir string // directory holding files for this module, if any
|
||||||
|
GoMod string // path to go.mod file for this module, if any
|
||||||
|
Error *moduleErrorJSON // error loading module
|
||||||
|
}
|
||||||
|
|
||||||
|
type moduleErrorJSON struct {
|
||||||
|
Err string // the error itself
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *moduleResolver) init() error {
|
||||||
|
if r.initialized {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
stdout, err := r.env.invokeGo("list", "-m", "-json", "...")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for dec := json.NewDecoder(stdout); dec.More(); {
|
||||||
|
mod := &moduleJSON{}
|
||||||
|
if err := dec.Decode(mod); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if mod.Dir == "" {
|
||||||
|
if Debug {
|
||||||
|
log.Printf("module %v has not been downloaded and will be ignored", mod.Path)
|
||||||
|
}
|
||||||
|
// Can't do anything with a module that's not downloaded.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
r.modsByModPath = append(r.modsByModPath, mod)
|
||||||
|
r.modsByDir = append(r.modsByDir, mod)
|
||||||
|
if mod.Main {
|
||||||
|
r.main = mod
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(r.modsByModPath, func(i, j int) bool {
|
||||||
|
count := func(x int) int {
|
||||||
|
return strings.Count(r.modsByModPath[x].Path, "/")
|
||||||
|
}
|
||||||
|
return count(j) < count(i) // descending order
|
||||||
|
})
|
||||||
|
sort.Slice(r.modsByDir, func(i, j int) bool {
|
||||||
|
count := func(x int) int {
|
||||||
|
return strings.Count(r.modsByDir[x].Dir, "/")
|
||||||
|
}
|
||||||
|
return count(j) < count(i) // descending order
|
||||||
|
})
|
||||||
|
|
||||||
|
r.initialized = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// findPackage returns the module and directory that contains the package at
|
||||||
|
// the given import path, or returns nil, "" if no module is in scope.
|
||||||
|
func (r *moduleResolver) findPackage(importPath string) (*moduleJSON, string) {
|
||||||
|
for _, m := range r.modsByModPath {
|
||||||
|
if !strings.HasPrefix(importPath, m.Path) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pathInModule := importPath[len(m.Path):]
|
||||||
|
pkgDir := filepath.Join(m.Dir, pathInModule)
|
||||||
|
if dirIsNestedModule(pkgDir, m) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgFiles, err := ioutil.ReadDir(pkgDir)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// A module only contains a package if it has buildable go
|
||||||
|
// files in that directory. If not, it could be provided by an
|
||||||
|
// outer module. See #29736.
|
||||||
|
for _, fi := range pkgFiles {
|
||||||
|
if ok, _ := r.env.buildContext().MatchFile(pkgDir, fi.Name()); ok {
|
||||||
|
return m, pkgDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// findModuleByDir returns the module that contains dir, or nil if no such
|
||||||
|
// module is in scope.
|
||||||
|
func (r *moduleResolver) findModuleByDir(dir string) *moduleJSON {
|
||||||
|
// This is quite tricky and may not be correct. dir could be:
|
||||||
|
// - a package in the main module.
|
||||||
|
// - a replace target underneath the main module's directory.
|
||||||
|
// - a nested module in the above.
|
||||||
|
// - a replace target somewhere totally random.
|
||||||
|
// - a nested module in the above.
|
||||||
|
// - in the mod cache.
|
||||||
|
// - in /vendor/ in -mod=vendor mode.
|
||||||
|
// - nested module? Dunno.
|
||||||
|
// Rumor has it that replace targets cannot contain other replace targets.
|
||||||
|
for _, m := range r.modsByDir {
|
||||||
|
if !strings.HasPrefix(dir, m.Dir) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if dirIsNestedModule(dir, m) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// dirIsNestedModule reports if dir is contained in a nested module underneath
|
||||||
|
// mod, not actually in mod.
|
||||||
|
func dirIsNestedModule(dir string, mod *moduleJSON) bool {
|
||||||
|
if !strings.HasPrefix(dir, mod.Dir) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
mf := findModFile(dir)
|
||||||
|
if mf == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return filepath.Dir(mf) != mod.Dir
|
||||||
|
}
|
||||||
|
|
||||||
|
func findModFile(dir string) string {
|
||||||
|
for {
|
||||||
|
f := filepath.Join(dir, "go.mod")
|
||||||
|
info, err := os.Stat(f)
|
||||||
|
if err == nil && !info.IsDir() {
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
d := filepath.Dir(dir)
|
||||||
|
if len(d) >= len(dir) {
|
||||||
|
return "" // reached top of file system, no go.mod
|
||||||
|
}
|
||||||
|
dir = d
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *moduleResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) {
|
||||||
|
if err := r.init(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
names := map[string]string{}
|
||||||
|
for _, path := range importPaths {
|
||||||
|
_, packageDir := r.findPackage(path)
|
||||||
|
if packageDir == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
name, err := packageDirToName(packageDir)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
names[path] = name
|
||||||
|
}
|
||||||
|
return names, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *moduleResolver) scan(_ references) ([]*pkg, error) {
|
||||||
|
if err := r.init(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk GOROOT, GOPATH/pkg/mod, and the main module.
|
||||||
|
roots := []gopathwalk.Root{
|
||||||
|
{filepath.Join(r.env.GOROOT, "/src"), gopathwalk.RootGOROOT},
|
||||||
|
}
|
||||||
|
if r.main != nil {
|
||||||
|
roots = append(roots, gopathwalk.Root{r.main.Dir, gopathwalk.RootCurrentModule})
|
||||||
|
}
|
||||||
|
for _, p := range filepath.SplitList(r.env.GOPATH) {
|
||||||
|
roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk replace targets, just in case they're not in any of the above.
|
||||||
|
for _, mod := range r.modsByModPath {
|
||||||
|
if mod.Replace != nil {
|
||||||
|
roots = append(roots, gopathwalk.Root{mod.Dir, gopathwalk.RootOther})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var result []*pkg
|
||||||
|
dupCheck := make(map[string]bool)
|
||||||
|
var mu sync.Mutex
|
||||||
|
|
||||||
|
gopathwalk.Walk(roots, func(root gopathwalk.Root, dir string) {
|
||||||
|
mu.Lock()
|
||||||
|
defer mu.Unlock()
|
||||||
|
|
||||||
|
if _, dup := dupCheck[dir]; dup {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dupCheck[dir] = true
|
||||||
|
|
||||||
|
subdir := ""
|
||||||
|
if dir != root.Path {
|
||||||
|
subdir = dir[len(root.Path)+len("/"):]
|
||||||
|
}
|
||||||
|
importPath := filepath.ToSlash(subdir)
|
||||||
|
if strings.HasPrefix(importPath, "vendor/") {
|
||||||
|
// Ignore vendor dirs. If -mod=vendor is on, then things
|
||||||
|
// should mostly just work, but when it's not vendor/
|
||||||
|
// is a mess. There's no easy way to tell if it's on.
|
||||||
|
// We can still find things in the mod cache and
|
||||||
|
// map them into /vendor when -mod=vendor is on.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch root.Type {
|
||||||
|
case gopathwalk.RootCurrentModule:
|
||||||
|
importPath = path.Join(r.main.Path, filepath.ToSlash(subdir))
|
||||||
|
case gopathwalk.RootModuleCache:
|
||||||
|
matches := modCacheRegexp.FindStringSubmatch(subdir)
|
||||||
|
modPath, err := module.DecodePath(filepath.ToSlash(matches[1]))
|
||||||
|
if err != nil {
|
||||||
|
if Debug {
|
||||||
|
log.Printf("decoding module cache path %q: %v", subdir, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
importPath = path.Join(modPath, filepath.ToSlash(matches[3]))
|
||||||
|
case gopathwalk.RootGOROOT:
|
||||||
|
importPath = subdir
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the directory is underneath a module that's in scope.
|
||||||
|
if mod := r.findModuleByDir(dir); mod != nil {
|
||||||
|
// It is. If dir is the target of a replace directive,
|
||||||
|
// our guessed import path is wrong. Use the real one.
|
||||||
|
if mod.Dir == dir {
|
||||||
|
importPath = mod.Path
|
||||||
|
} else {
|
||||||
|
dirInMod := dir[len(mod.Dir)+len("/"):]
|
||||||
|
importPath = path.Join(mod.Path, filepath.ToSlash(dirInMod))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// The package is in an unknown module. Check that it's
|
||||||
|
// not obviously impossible to import.
|
||||||
|
var modFile string
|
||||||
|
switch root.Type {
|
||||||
|
case gopathwalk.RootModuleCache:
|
||||||
|
matches := modCacheRegexp.FindStringSubmatch(subdir)
|
||||||
|
modFile = filepath.Join(matches[1], "@", matches[2], "go.mod")
|
||||||
|
default:
|
||||||
|
modFile = findModFile(dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
modBytes, err := ioutil.ReadFile(modFile)
|
||||||
|
if err == nil && !strings.HasPrefix(importPath, modulePath(modBytes)) {
|
||||||
|
// The module's declared path does not match
|
||||||
|
// its expected path. It probably needs a
|
||||||
|
// replace directive we don't have.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We may have discovered a package that has a different version
|
||||||
|
// in scope already. Canonicalize to that one if possible.
|
||||||
|
if _, canonicalDir := r.findPackage(importPath); canonicalDir != "" {
|
||||||
|
dir = canonicalDir
|
||||||
|
}
|
||||||
|
|
||||||
|
result = append(result, &pkg{
|
||||||
|
importPathShort: VendorlessPath(importPath),
|
||||||
|
dir: dir,
|
||||||
|
})
|
||||||
|
}, gopathwalk.Options{Debug: Debug, ModulesEnabled: true})
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// modCacheRegexp splits a path in a module cache into module, module version, and package.
|
||||||
|
var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`)
|
||||||
|
|
||||||
|
var (
|
||||||
|
slashSlash = []byte("//")
|
||||||
|
moduleStr = []byte("module")
|
||||||
|
)
|
||||||
|
|
||||||
|
// modulePath returns the module path from the gomod file text.
|
||||||
|
// If it cannot find a module path, it returns an empty string.
|
||||||
|
// It is tolerant of unrelated problems in the go.mod file.
|
||||||
|
//
|
||||||
|
// Copied from cmd/go/internal/modfile.
|
||||||
|
func modulePath(mod []byte) string {
|
||||||
|
for len(mod) > 0 {
|
||||||
|
line := mod
|
||||||
|
mod = nil
|
||||||
|
if i := bytes.IndexByte(line, '\n'); i >= 0 {
|
||||||
|
line, mod = line[:i], line[i+1:]
|
||||||
|
}
|
||||||
|
if i := bytes.Index(line, slashSlash); i >= 0 {
|
||||||
|
line = line[:i]
|
||||||
|
}
|
||||||
|
line = bytes.TrimSpace(line)
|
||||||
|
if !bytes.HasPrefix(line, moduleStr) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
line = line[len(moduleStr):]
|
||||||
|
n := len(line)
|
||||||
|
line = bytes.TrimSpace(line)
|
||||||
|
if len(line) == n || len(line) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if line[0] == '"' || line[0] == '`' {
|
||||||
|
p, err := strconv.Unquote(string(line))
|
||||||
|
if err != nil {
|
||||||
|
return "" // malformed quoted string or multiline module path
|
||||||
|
}
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(line)
|
||||||
|
}
|
||||||
|
return "" // missing module path
|
||||||
|
}
|
230
vendor/golang.org/x/tools/imports/sortimports.go
generated
vendored
Normal file
230
vendor/golang.org/x/tools/imports/sortimports.go
generated
vendored
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
// Copyright 2013 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.
|
||||||
|
|
||||||
|
// Hacked up copy of go/ast/import.go
|
||||||
|
|
||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// sortImports sorts runs of consecutive import lines in import blocks in f.
|
||||||
|
// It also removes duplicate imports when it is possible to do so without data loss.
|
||||||
|
func sortImports(fset *token.FileSet, f *ast.File) {
|
||||||
|
for i, d := range f.Decls {
|
||||||
|
d, ok := d.(*ast.GenDecl)
|
||||||
|
if !ok || d.Tok != token.IMPORT {
|
||||||
|
// Not an import declaration, so we're done.
|
||||||
|
// Imports are always first.
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(d.Specs) == 0 {
|
||||||
|
// Empty import block, remove it.
|
||||||
|
f.Decls = append(f.Decls[:i], f.Decls[i+1:]...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !d.Lparen.IsValid() {
|
||||||
|
// Not a block: sorted by default.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identify and sort runs of specs on successive lines.
|
||||||
|
i := 0
|
||||||
|
specs := d.Specs[:0]
|
||||||
|
for j, s := range d.Specs {
|
||||||
|
if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line {
|
||||||
|
// j begins a new run. End this one.
|
||||||
|
specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...)
|
||||||
|
i = j
|
||||||
|
}
|
||||||
|
}
|
||||||
|
specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...)
|
||||||
|
d.Specs = specs
|
||||||
|
|
||||||
|
// Deduping can leave a blank line before the rparen; clean that up.
|
||||||
|
if len(d.Specs) > 0 {
|
||||||
|
lastSpec := d.Specs[len(d.Specs)-1]
|
||||||
|
lastLine := fset.Position(lastSpec.Pos()).Line
|
||||||
|
if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 {
|
||||||
|
fset.File(d.Rparen).MergeLine(rParenLine - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func importPath(s ast.Spec) string {
|
||||||
|
t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value)
|
||||||
|
if err == nil {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func importName(s ast.Spec) string {
|
||||||
|
n := s.(*ast.ImportSpec).Name
|
||||||
|
if n == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return n.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func importComment(s ast.Spec) string {
|
||||||
|
c := s.(*ast.ImportSpec).Comment
|
||||||
|
if c == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return c.Text()
|
||||||
|
}
|
||||||
|
|
||||||
|
// collapse indicates whether prev may be removed, leaving only next.
|
||||||
|
func collapse(prev, next ast.Spec) bool {
|
||||||
|
if importPath(next) != importPath(prev) || importName(next) != importName(prev) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return prev.(*ast.ImportSpec).Comment == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type posSpan struct {
|
||||||
|
Start token.Pos
|
||||||
|
End token.Pos
|
||||||
|
}
|
||||||
|
|
||||||
|
func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
|
||||||
|
// Can't short-circuit here even if specs are already sorted,
|
||||||
|
// since they might yet need deduplication.
|
||||||
|
// A lone import, however, may be safely ignored.
|
||||||
|
if len(specs) <= 1 {
|
||||||
|
return specs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Record positions for specs.
|
||||||
|
pos := make([]posSpan, len(specs))
|
||||||
|
for i, s := range specs {
|
||||||
|
pos[i] = posSpan{s.Pos(), s.End()}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identify comments in this range.
|
||||||
|
// Any comment from pos[0].Start to the final line counts.
|
||||||
|
lastLine := fset.Position(pos[len(pos)-1].End).Line
|
||||||
|
cstart := len(f.Comments)
|
||||||
|
cend := len(f.Comments)
|
||||||
|
for i, g := range f.Comments {
|
||||||
|
if g.Pos() < pos[0].Start {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if i < cstart {
|
||||||
|
cstart = i
|
||||||
|
}
|
||||||
|
if fset.Position(g.End()).Line > lastLine {
|
||||||
|
cend = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
comments := f.Comments[cstart:cend]
|
||||||
|
|
||||||
|
// Assign each comment to the import spec preceding it.
|
||||||
|
importComment := map[*ast.ImportSpec][]*ast.CommentGroup{}
|
||||||
|
specIndex := 0
|
||||||
|
for _, g := range comments {
|
||||||
|
for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() {
|
||||||
|
specIndex++
|
||||||
|
}
|
||||||
|
s := specs[specIndex].(*ast.ImportSpec)
|
||||||
|
importComment[s] = append(importComment[s], g)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the import specs by import path.
|
||||||
|
// Remove duplicates, when possible without data loss.
|
||||||
|
// Reassign the import paths to have the same position sequence.
|
||||||
|
// Reassign each comment to abut the end of its spec.
|
||||||
|
// Sort the comments by new position.
|
||||||
|
sort.Sort(byImportSpec(specs))
|
||||||
|
|
||||||
|
// Dedup. Thanks to our sorting, we can just consider
|
||||||
|
// adjacent pairs of imports.
|
||||||
|
deduped := specs[:0]
|
||||||
|
for i, s := range specs {
|
||||||
|
if i == len(specs)-1 || !collapse(s, specs[i+1]) {
|
||||||
|
deduped = append(deduped, s)
|
||||||
|
} else {
|
||||||
|
p := s.Pos()
|
||||||
|
fset.File(p).MergeLine(fset.Position(p).Line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
specs = deduped
|
||||||
|
|
||||||
|
// Fix up comment positions
|
||||||
|
for i, s := range specs {
|
||||||
|
s := s.(*ast.ImportSpec)
|
||||||
|
if s.Name != nil {
|
||||||
|
s.Name.NamePos = pos[i].Start
|
||||||
|
}
|
||||||
|
s.Path.ValuePos = pos[i].Start
|
||||||
|
s.EndPos = pos[i].End
|
||||||
|
nextSpecPos := pos[i].End
|
||||||
|
|
||||||
|
for _, g := range importComment[s] {
|
||||||
|
for _, c := range g.List {
|
||||||
|
c.Slash = pos[i].End
|
||||||
|
nextSpecPos = c.End()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if i < len(specs)-1 {
|
||||||
|
pos[i+1].Start = nextSpecPos
|
||||||
|
pos[i+1].End = nextSpecPos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Sort(byCommentPos(comments))
|
||||||
|
|
||||||
|
// Fixup comments can insert blank lines, because import specs are on different lines.
|
||||||
|
// We remove those blank lines here by merging import spec to the first import spec line.
|
||||||
|
firstSpecLine := fset.Position(specs[0].Pos()).Line
|
||||||
|
for _, s := range specs[1:] {
|
||||||
|
p := s.Pos()
|
||||||
|
line := fset.File(p).Line(p)
|
||||||
|
for previousLine := line - 1; previousLine >= firstSpecLine; {
|
||||||
|
fset.File(p).MergeLine(previousLine)
|
||||||
|
previousLine--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return specs
|
||||||
|
}
|
||||||
|
|
||||||
|
type byImportSpec []ast.Spec // slice of *ast.ImportSpec
|
||||||
|
|
||||||
|
func (x byImportSpec) Len() int { return len(x) }
|
||||||
|
func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||||
|
func (x byImportSpec) Less(i, j int) bool {
|
||||||
|
ipath := importPath(x[i])
|
||||||
|
jpath := importPath(x[j])
|
||||||
|
|
||||||
|
igroup := importGroup(ipath)
|
||||||
|
jgroup := importGroup(jpath)
|
||||||
|
if igroup != jgroup {
|
||||||
|
return igroup < jgroup
|
||||||
|
}
|
||||||
|
|
||||||
|
if ipath != jpath {
|
||||||
|
return ipath < jpath
|
||||||
|
}
|
||||||
|
iname := importName(x[i])
|
||||||
|
jname := importName(x[j])
|
||||||
|
|
||||||
|
if iname != jname {
|
||||||
|
return iname < jname
|
||||||
|
}
|
||||||
|
return importComment(x[i]) < importComment(x[j])
|
||||||
|
}
|
||||||
|
|
||||||
|
type byCommentPos []*ast.CommentGroup
|
||||||
|
|
||||||
|
func (x byCommentPos) Len() int { return len(x) }
|
||||||
|
func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||||
|
func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() }
|
10302
vendor/golang.org/x/tools/imports/zstdlib.go
generated
vendored
Normal file
10302
vendor/golang.org/x/tools/imports/zstdlib.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
196
vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go
generated
vendored
Normal file
196
vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go
generated
vendored
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
// Copyright 2016 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 fastwalk provides a faster version of filepath.Walk for file system
|
||||||
|
// scanning tools.
|
||||||
|
package fastwalk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TraverseLink is used as a return value from WalkFuncs to indicate that the
|
||||||
|
// symlink named in the call may be traversed.
|
||||||
|
var TraverseLink = errors.New("fastwalk: traverse symlink, assuming target is a directory")
|
||||||
|
|
||||||
|
// SkipFiles is a used as a return value from WalkFuncs to indicate that the
|
||||||
|
// callback should not be called for any other files in the current directory.
|
||||||
|
// Child directories will still be traversed.
|
||||||
|
var SkipFiles = errors.New("fastwalk: skip remaining files in directory")
|
||||||
|
|
||||||
|
// Walk is a faster implementation of filepath.Walk.
|
||||||
|
//
|
||||||
|
// filepath.Walk's design necessarily calls os.Lstat on each file,
|
||||||
|
// even if the caller needs less info.
|
||||||
|
// Many tools need only the type of each file.
|
||||||
|
// On some platforms, this information is provided directly by the readdir
|
||||||
|
// system call, avoiding the need to stat each file individually.
|
||||||
|
// fastwalk_unix.go contains a fork of the syscall routines.
|
||||||
|
//
|
||||||
|
// See golang.org/issue/16399
|
||||||
|
//
|
||||||
|
// Walk walks the file tree rooted at root, calling walkFn for
|
||||||
|
// each file or directory in the tree, including root.
|
||||||
|
//
|
||||||
|
// If fastWalk returns filepath.SkipDir, the directory is skipped.
|
||||||
|
//
|
||||||
|
// Unlike filepath.Walk:
|
||||||
|
// * file stat calls must be done by the user.
|
||||||
|
// The only provided metadata is the file type, which does not include
|
||||||
|
// any permission bits.
|
||||||
|
// * multiple goroutines stat the filesystem concurrently. The provided
|
||||||
|
// walkFn must be safe for concurrent use.
|
||||||
|
// * fastWalk can follow symlinks if walkFn returns the TraverseLink
|
||||||
|
// sentinel error. It is the walkFn's responsibility to prevent
|
||||||
|
// fastWalk from going into symlink cycles.
|
||||||
|
func Walk(root string, walkFn func(path string, typ os.FileMode) error) error {
|
||||||
|
// TODO(bradfitz): make numWorkers configurable? We used a
|
||||||
|
// minimum of 4 to give the kernel more info about multiple
|
||||||
|
// things we want, in hopes its I/O scheduling can take
|
||||||
|
// advantage of that. Hopefully most are in cache. Maybe 4 is
|
||||||
|
// even too low of a minimum. Profile more.
|
||||||
|
numWorkers := 4
|
||||||
|
if n := runtime.NumCPU(); n > numWorkers {
|
||||||
|
numWorkers = n
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure to wait for all workers to finish, otherwise
|
||||||
|
// walkFn could still be called after returning. This Wait call
|
||||||
|
// runs after close(e.donec) below.
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
defer wg.Wait()
|
||||||
|
|
||||||
|
w := &walker{
|
||||||
|
fn: walkFn,
|
||||||
|
enqueuec: make(chan walkItem, numWorkers), // buffered for performance
|
||||||
|
workc: make(chan walkItem, numWorkers), // buffered for performance
|
||||||
|
donec: make(chan struct{}),
|
||||||
|
|
||||||
|
// buffered for correctness & not leaking goroutines:
|
||||||
|
resc: make(chan error, numWorkers),
|
||||||
|
}
|
||||||
|
defer close(w.donec)
|
||||||
|
|
||||||
|
for i := 0; i < numWorkers; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go w.doWork(&wg)
|
||||||
|
}
|
||||||
|
todo := []walkItem{{dir: root}}
|
||||||
|
out := 0
|
||||||
|
for {
|
||||||
|
workc := w.workc
|
||||||
|
var workItem walkItem
|
||||||
|
if len(todo) == 0 {
|
||||||
|
workc = nil
|
||||||
|
} else {
|
||||||
|
workItem = todo[len(todo)-1]
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case workc <- workItem:
|
||||||
|
todo = todo[:len(todo)-1]
|
||||||
|
out++
|
||||||
|
case it := <-w.enqueuec:
|
||||||
|
todo = append(todo, it)
|
||||||
|
case err := <-w.resc:
|
||||||
|
out--
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if out == 0 && len(todo) == 0 {
|
||||||
|
// It's safe to quit here, as long as the buffered
|
||||||
|
// enqueue channel isn't also readable, which might
|
||||||
|
// happen if the worker sends both another unit of
|
||||||
|
// work and its result before the other select was
|
||||||
|
// scheduled and both w.resc and w.enqueuec were
|
||||||
|
// readable.
|
||||||
|
select {
|
||||||
|
case it := <-w.enqueuec:
|
||||||
|
todo = append(todo, it)
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// doWork reads directories as instructed (via workc) and runs the
|
||||||
|
// user's callback function.
|
||||||
|
func (w *walker) doWork(wg *sync.WaitGroup) {
|
||||||
|
defer wg.Done()
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-w.donec:
|
||||||
|
return
|
||||||
|
case it := <-w.workc:
|
||||||
|
select {
|
||||||
|
case <-w.donec:
|
||||||
|
return
|
||||||
|
case w.resc <- w.walk(it.dir, !it.callbackDone):
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type walker struct {
|
||||||
|
fn func(path string, typ os.FileMode) error
|
||||||
|
|
||||||
|
donec chan struct{} // closed on fastWalk's return
|
||||||
|
workc chan walkItem // to workers
|
||||||
|
enqueuec chan walkItem // from workers
|
||||||
|
resc chan error // from workers
|
||||||
|
}
|
||||||
|
|
||||||
|
type walkItem struct {
|
||||||
|
dir string
|
||||||
|
callbackDone bool // callback already called; don't do it again
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *walker) enqueue(it walkItem) {
|
||||||
|
select {
|
||||||
|
case w.enqueuec <- it:
|
||||||
|
case <-w.donec:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error {
|
||||||
|
joined := dirName + string(os.PathSeparator) + baseName
|
||||||
|
if typ == os.ModeDir {
|
||||||
|
w.enqueue(walkItem{dir: joined})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err := w.fn(joined, typ)
|
||||||
|
if typ == os.ModeSymlink {
|
||||||
|
if err == TraverseLink {
|
||||||
|
// Set callbackDone so we don't call it twice for both the
|
||||||
|
// symlink-as-symlink and the symlink-as-directory later:
|
||||||
|
w.enqueue(walkItem{dir: joined, callbackDone: true})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err == filepath.SkipDir {
|
||||||
|
// Permit SkipDir on symlinks too.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *walker) walk(root string, runUserCallback bool) error {
|
||||||
|
if runUserCallback {
|
||||||
|
err := w.fn(root, os.ModeDir)
|
||||||
|
if err == filepath.SkipDir {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return readDir(root, w.onDirEnt)
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue