mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-11-21 05:05:52 +02:00
сделал nrpc
This commit is contained in:
parent
969d562ed9
commit
b2048dff81
2
Makefile
2
Makefile
@ -15,7 +15,7 @@ run:
|
||||
mod:
|
||||
clear
|
||||
go get -u ./internal/...
|
||||
go mod tidy -compat=1.22
|
||||
go mod tidy -compat=1.22.1
|
||||
go mod vendor
|
||||
go fmt ./...
|
||||
build:
|
||||
|
20
go.mod
20
go.mod
@ -1,11 +1,9 @@
|
||||
module github.com/ManyakRus/crud_generator
|
||||
|
||||
go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
go 1.22.1
|
||||
|
||||
require (
|
||||
github.com/ManyakRus/starter v1.0.66
|
||||
github.com/ManyakRus/starter v1.0.84
|
||||
github.com/alexsergivan/transliterator v1.0.1
|
||||
github.com/bxcodec/faker/v3 v3.8.1
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
@ -17,7 +15,7 @@ require (
|
||||
github.com/ompluscator/dynamic-struct v1.4.0
|
||||
github.com/otiai10/copy v1.14.0
|
||||
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e
|
||||
golang.org/x/tools v0.26.0
|
||||
golang.org/x/tools v0.27.0
|
||||
gorm.io/gorm v1.25.12
|
||||
)
|
||||
|
||||
@ -30,11 +28,11 @@ require (
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/crypto v0.29.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
|
||||
golang.org/x/mod v0.22.0 // indirect
|
||||
golang.org/x/sync v0.9.0 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
gorm.io/driver/postgres v1.5.9 // indirect
|
||||
)
|
||||
|
46
go.sum
46
go.sum
@ -3,10 +3,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJc
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
|
||||
github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 h1:bxwxD0H3kSUAH3uNk/b74gkImcUiP7dyibmMoVwk338=
|
||||
github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792/go.mod h1:OUyxCVbPW/2lC1e6cM7Am941SJiC88BhNnb24x2R3a8=
|
||||
github.com/ManyakRus/starter v1.0.65 h1:3TvYfrO2N55qUziPFxuLCVZI3nGKmKupTb4v7zMbNqo=
|
||||
github.com/ManyakRus/starter v1.0.65/go.mod h1:U9WyHWnavyxu4+J5D6VpF3G2yZ4KagfSNM2Soo9O+7c=
|
||||
github.com/ManyakRus/starter v1.0.66 h1:wwX2Z6l35wzGs9bNCVAgBatK57ElYqzompBRBaXiWU4=
|
||||
github.com/ManyakRus/starter v1.0.66/go.mod h1:U9WyHWnavyxu4+J5D6VpF3G2yZ4KagfSNM2Soo9O+7c=
|
||||
github.com/ManyakRus/starter v1.0.84 h1:qvKAiV/ujX9dHMiIF1FCRvvfeNNOHY0fwFTrk/fA4Js=
|
||||
github.com/ManyakRus/starter v1.0.84/go.mod h1:fvTy6+PHRIDeNXvXAAkYBSJl1kkupiNe/CpCgcB0mZM=
|
||||
github.com/alexsergivan/transliterator v1.0.1 h1:vON2ilWCHjq+S5Y4obhLGhHK4Y1VIhsHEtQlij5d9pI=
|
||||
github.com/alexsergivan/transliterator v1.0.1/go.mod h1:0IrumukulURJ4PD0z6UcdJKP2job1DYDhnHAP5y+5pE=
|
||||
github.com/bxcodec/faker/v3 v3.8.1 h1:qO/Xq19V6uHt2xujwpaetgKhraGCapqY2CRWGD/SqcM=
|
||||
@ -89,8 +87,8 @@ github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWtuw0=
|
||||
github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
|
||||
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
@ -148,17 +146,17 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
|
||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
|
||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@ -177,8 +175,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
||||
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -186,8 +184,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -213,8 +211,8 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@ -228,8 +226,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
@ -237,8 +235,8 @@ golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
|
||||
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
|
||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
|
||||
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
|
||||
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
|
||||
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -254,8 +252,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
|
@ -68,8 +68,22 @@ func CreateFileProto(MapAll map[string]*types.Table) error {
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
//найдём куда вставить текст
|
||||
sFind := "\nservice "
|
||||
PosProtoService := strings.Index(TextProto, sFind)
|
||||
if PosProtoService < 0 {
|
||||
log.Panic("Not found text ", sFind)
|
||||
}
|
||||
|
||||
s2 := TextProto[PosProtoService+1:]
|
||||
sFind = "\n"
|
||||
posEnd := strings.Index(s2, sFind)
|
||||
if posEnd < 0 {
|
||||
log.Panic("Not found text ", sFind)
|
||||
}
|
||||
PosProtoService = PosProtoService + posEnd + 1
|
||||
|
||||
//найдём новый текст для каждой таблицы
|
||||
TextProtoNew := ""
|
||||
for _, key1 := range keys {
|
||||
Table1, ok := MapAll[key1]
|
||||
if ok == false {
|
||||
@ -83,8 +97,22 @@ func CreateFileProto(MapAll map[string]*types.Table) error {
|
||||
continue
|
||||
}
|
||||
|
||||
//Найдём место куда добавить текст
|
||||
TextProtoNew := ""
|
||||
Text1 := ""
|
||||
|
||||
//
|
||||
Text1 = Find_CommentModel(TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + Text1
|
||||
//TextProto = micro.InsertTextFrom(TextProto, Text1, PosProtoService)
|
||||
|
||||
//
|
||||
TextProtoNew = TextProtoNew + FindText_ProtoTable1(TextProto, Table1)
|
||||
|
||||
//
|
||||
TextProtoNew = TextProtoNew + FindText_ProtoTable1_UpdateManyFields(TextProto, Table1)
|
||||
|
||||
//
|
||||
TextProtoNew = TextProtoNew + FindText_ProtoTable1_UpdateEveryColumn(TextProto, Table1)
|
||||
|
||||
//добавим текст FindBy
|
||||
@ -94,48 +122,43 @@ func CreateFileProto(MapAll map[string]*types.Table) error {
|
||||
|
||||
//добавим текст FindMassBy
|
||||
TextProto, TextProtoNew1 = FindText_FindMassBy(TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
Text1 = TextProtoNew1
|
||||
TextProtoNew = TextProtoNew + Text1
|
||||
|
||||
//добавим текст ReadAll
|
||||
TextProto, TextProtoNew1 = FindText_ReadAll(TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
Text1 = TextProtoNew1
|
||||
TextProtoNew = TextProtoNew + Text1
|
||||
|
||||
//добавим текст FindModelBy
|
||||
TextProto, TextProtoNew1 = FindText_FindModelBy(MapAll, TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
Text1 = TextProtoNew1
|
||||
TextProtoNew = TextProtoNew + Text1
|
||||
|
||||
//cache
|
||||
if config.Settings.NEED_CREATE_CACHE_API == true {
|
||||
TextProtoNew = TextProtoNew + FindText_ProtoTable1_Cache(TextProto, Table1)
|
||||
Text1 = FindText_ProtoTable1_Cache(TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + Text1
|
||||
}
|
||||
|
||||
//ReadObject
|
||||
if config.Settings.NEED_CREATE_READOBJECT == true {
|
||||
TextProto, TextProtoNew1 = FindText_ReadObject(TextProto, Table1)
|
||||
TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
}
|
||||
TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
|
||||
//TextProtoNew = TextProtoNew + TextProtoNew1
|
||||
|
||||
//
|
||||
TextProto = AddTextMessageRequestID(TextProto, Table1)
|
||||
}
|
||||
|
||||
//найдём куда вставить текст
|
||||
sFind := "\nservice "
|
||||
pos1 := strings.Index(TextProto, sFind)
|
||||
if pos1 < 0 {
|
||||
log.Panic("Not found text ", sFind)
|
||||
//
|
||||
PosProto_ForInsert := FindPosProto_ForInsert(TextProto, Table1, PosProtoService)
|
||||
TextProto = micro.InsertTextFrom(TextProto, TextProtoNew, PosProto_ForInsert)
|
||||
//TextProto = TextProto[:PosProto_ForInsert] + TextProtoNew + TextProto[PosProtoService:]
|
||||
}
|
||||
|
||||
s2 := TextProto[pos1+1:]
|
||||
sFind = "\n"
|
||||
posEnd := strings.Index(s2, sFind)
|
||||
if posEnd < 0 {
|
||||
log.Panic("Not found text ", sFind)
|
||||
}
|
||||
PosStart := pos1 + posEnd + 1
|
||||
|
||||
//
|
||||
TextProto = TextProto[:PosStart] + TextProtoNew + TextProto[PosStart:]
|
||||
|
||||
//
|
||||
TextProto = create_files.Delete_EmptyLines(TextProto)
|
||||
@ -447,3 +470,50 @@ func AddTextMessageRequestID(TextProto string, Table1 *types.Table) string {
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// Find_CommentModel - возвращает комментарий //ИмяМодели
|
||||
func Find_CommentModel(TextProto string, Table1 *types.Table) string {
|
||||
Otvet := ""
|
||||
|
||||
TextComment := "\n\t//" + Table1.NameGo + "\n"
|
||||
pos1 := strings.Index(TextProto, TextComment)
|
||||
if pos1 >= 0 {
|
||||
return Otvet
|
||||
}
|
||||
|
||||
Otvet = TextComment
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// FindPosAfterCommentModel - возвращает позицию комментария //ИмяМодели
|
||||
func FindPosAfterCommentModel(TextProto string, Table1 *types.Table) int {
|
||||
//найдём начало где комментарий
|
||||
TextComment := "\t//" + Table1.NameGo + "\n"
|
||||
pos1 := strings.Index(TextProto, TextComment)
|
||||
if pos1 < 0 {
|
||||
return -1
|
||||
}
|
||||
pos1 = pos1 + len(TextComment)
|
||||
|
||||
//найдём конец "\n\n"
|
||||
s2 := TextProto[pos1:]
|
||||
TextFind := "\n\n"
|
||||
pos2 := strings.Index(s2, TextFind)
|
||||
if pos2 < 0 {
|
||||
return pos1
|
||||
}
|
||||
pos2 = pos1 + pos2 + len(TextFind) - 2
|
||||
|
||||
return pos2
|
||||
}
|
||||
|
||||
// FindPosProto_ForInsert - возвращает позицию .proto для вставки, = ищет "//ИмяМодели\т" или "service"
|
||||
func FindPosProto_ForInsert(TextProto string, Table1 *types.Table, PosProtoService int) int {
|
||||
Otvet := PosProtoService
|
||||
|
||||
PosProtoTable := FindPosAfterCommentModel(TextProto, Table1)
|
||||
Otvet = micro.Max(PosProtoTable, PosProtoService)
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
// FindText_ProtoTable1 - возвращает текст всех функций .proto для таблицы
|
||||
func FindText_ProtoTable1(TextProto string, Table1 *types.Table) string {
|
||||
Otvet := "\n" //"\n\t//\n"
|
||||
Otvet := "" //"\n\t//\n"
|
||||
|
||||
ModelName := Table1.NameGo_translit
|
||||
//Otvet = Otvet + AddTextMessageRequestID(TextProto, Table1)
|
||||
|
@ -27,7 +27,7 @@ func FindText_ReadObject(TextProto string, Table1 *types.Table) (TextProtoNew st
|
||||
|
||||
// FindText_ReadObject1 - находит текст FindBy
|
||||
func FindText_ReadObject1(Table1 *types.Table) string {
|
||||
Otvet := ""
|
||||
Otvet := "\n"
|
||||
|
||||
ModelName := Table1.NameGo_translit
|
||||
//PrimaryKeyColumn := create_files.Find_PrimaryKeyColumn(Table1)
|
||||
|
68
vendor/github.com/ManyakRus/starter/micro/microfunctions.go
generated
vendored
68
vendor/github.com/ManyakRus/starter/micro/microfunctions.go
generated
vendored
@ -575,6 +575,15 @@ func StringDate(t time.Time) string {
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// StringDateTime - возвращает строку дата и время, без миллисекунд
|
||||
func StringDateTime(t time.Time) string {
|
||||
Otvet := ""
|
||||
|
||||
Otvet = t.Format("02.01.2006 15:04:05")
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// ProgramDir_bin - возвращает каталог "bin" или каталог программы
|
||||
func ProgramDir_bin() string {
|
||||
Otvet := ""
|
||||
@ -1206,3 +1215,62 @@ func MassFrom_Map[C constraints.Ordered, V any](Map map[C]V) []V {
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// Substring - take at most last n characters, from start index
|
||||
func Substring(input string, StartIndex int, length int) string {
|
||||
//asRunes := []rune(input)
|
||||
|
||||
if StartIndex >= len(input) {
|
||||
return ""
|
||||
}
|
||||
|
||||
if (StartIndex + length) >= len(input) {
|
||||
length = len(input) - StartIndex
|
||||
}
|
||||
|
||||
//if StartIndex+length > len(asRunes) {
|
||||
// length = len(asRunes) - StartIndex
|
||||
//}
|
||||
|
||||
Otvet := string(input[StartIndex : StartIndex+length])
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// IntNot0 - возвращает первое ненулевое значение
|
||||
func IntNot0(MassInt ...int) int {
|
||||
Otvet := 0
|
||||
|
||||
for _, v := range MassInt {
|
||||
if v != 0 {
|
||||
Otvet = v
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return Otvet
|
||||
}
|
||||
|
||||
// InsertTextFrom - вставляет текст в середину строки
|
||||
func InsertTextFrom(Text string, TextAdd string, IndexFrom int) string {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
//
|
||||
if IndexFrom >= len(Text) {
|
||||
return Text + TextAdd
|
||||
}
|
||||
|
||||
//
|
||||
if IndexFrom < 0 {
|
||||
return TextAdd + Text
|
||||
}
|
||||
|
||||
//
|
||||
s2 := SubstringLeft(Text, IndexFrom+1)
|
||||
buffer.WriteString(s2)
|
||||
buffer.WriteString(TextAdd)
|
||||
s3 := Substring(Text, IndexFrom, len(Text+TextAdd))
|
||||
buffer.WriteString(s3)
|
||||
|
||||
Otvet := buffer.String()
|
||||
return Otvet
|
||||
}
|
||||
|
34
vendor/github.com/ManyakRus/starter/postgres_gorm/postgres_gorm.go
generated
vendored
34
vendor/github.com/ManyakRus/starter/postgres_gorm/postgres_gorm.go
generated
vendored
@ -52,7 +52,7 @@ type SettingsINI struct {
|
||||
// NamingStrategy - структура для хранения настроек наименования таблиц
|
||||
var NamingStrategy = schema.NamingStrategy{}
|
||||
|
||||
// Connect_err - подключается к базе данных
|
||||
// Connect - подключается к базе данных
|
||||
func Connect() {
|
||||
|
||||
if Settings.DB_HOST == "" {
|
||||
@ -66,16 +66,6 @@ func Connect() {
|
||||
|
||||
}
|
||||
|
||||
// LogInfo_Connected - выводит сообщение в Лог, или паника при ошибке
|
||||
func LogInfo_Connected(err error) {
|
||||
if err != nil {
|
||||
log.Panicln("POSTGRES gorm Connect() to database host: ", Settings.DB_HOST, ", Error: ", err)
|
||||
} else {
|
||||
log.Info("POSTGRES gorm Connected. host: ", Settings.DB_HOST, ", base name: ", Settings.DB_NAME, ", schema: ", Settings.DB_SCHEMA)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Connect_err - подключается к базе данных
|
||||
func Connect_err() error {
|
||||
var err error
|
||||
@ -119,6 +109,11 @@ func Connect_WithApplicationName_err(ApplicationName string) error {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
//
|
||||
if contextmain.GetContext().Err() != nil {
|
||||
return contextmain.GetContext().Err()
|
||||
}
|
||||
|
||||
//get the database connection URL.
|
||||
dsn := GetDSN(ApplicationName)
|
||||
|
||||
@ -329,9 +324,10 @@ func Start_ctx(ctx *context.Context, WaitGroup *sync.WaitGroup) error {
|
||||
// Start - делает соединение с БД, отключение и др.
|
||||
func Start(ApplicationName string) {
|
||||
err := Connect_WithApplicationName_err(ApplicationName)
|
||||
if err != nil {
|
||||
log.Panic("Postgres gorm Start() error: ", err)
|
||||
}
|
||||
LogInfo_Connected(err)
|
||||
//if err != nil {
|
||||
// log.Panic("Postgres gorm Start() error: ", err)
|
||||
//}
|
||||
|
||||
stopapp.GetWaitGroup_Main().Add(1)
|
||||
go WaitStop()
|
||||
@ -628,3 +624,13 @@ func ReplaceTemporaryTableNamesToUnique(TextSQL string) string {
|
||||
func SetSingularTableNames(IsSingular bool) {
|
||||
NamingStrategy.SingularTable = IsSingular
|
||||
}
|
||||
|
||||
// LogInfo_Connected - выводит сообщение в Лог, или паника при ошибке
|
||||
func LogInfo_Connected(err error) {
|
||||
if err != nil {
|
||||
log.Panicln("POSTGRES gorm Connect() to database host: ", Settings.DB_HOST, ", Error: ", err)
|
||||
} else {
|
||||
log.Info("POSTGRES gorm Connected. host: ", Settings.DB_HOST, ", base name: ", Settings.DB_NAME, ", schema: ", Settings.DB_SCHEMA)
|
||||
}
|
||||
|
||||
}
|
||||
|
96
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
96
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
@ -58,6 +58,102 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlGetEthtoolTsInfo fetches ethtool timestamping and PHC
|
||||
// association for the network device specified by ifname.
|
||||
func IoctlGetEthtoolTsInfo(fd int, ifname string) (*EthtoolTsInfo, error) {
|
||||
ifr, err := NewIfreq(ifname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
value := EthtoolTsInfo{Cmd: ETHTOOL_GET_TS_INFO}
|
||||
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||
|
||||
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlGetHwTstamp retrieves the hardware timestamping configuration
|
||||
// for the network device specified by ifname.
|
||||
func IoctlGetHwTstamp(fd int, ifname string) (*HwTstampConfig, error) {
|
||||
ifr, err := NewIfreq(ifname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
value := HwTstampConfig{}
|
||||
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||
|
||||
err = ioctlIfreqData(fd, SIOCGHWTSTAMP, &ifrd)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlSetHwTstamp updates the hardware timestamping configuration for
|
||||
// the network device specified by ifname.
|
||||
func IoctlSetHwTstamp(fd int, ifname string, cfg *HwTstampConfig) error {
|
||||
ifr, err := NewIfreq(ifname)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ifrd := ifr.withData(unsafe.Pointer(cfg))
|
||||
return ioctlIfreqData(fd, SIOCSHWTSTAMP, &ifrd)
|
||||
}
|
||||
|
||||
// FdToClockID derives the clock ID from the file descriptor number
|
||||
// - see clock_gettime(3), FD_TO_CLOCKID macros. The resulting ID is
|
||||
// suitable for system calls like ClockGettime.
|
||||
func FdToClockID(fd int) int32 { return int32((int(^fd) << 3) | 3) }
|
||||
|
||||
// IoctlPtpClockGetcaps returns the description of a given PTP device.
|
||||
func IoctlPtpClockGetcaps(fd int) (*PtpClockCaps, error) {
|
||||
var value PtpClockCaps
|
||||
err := ioctlPtr(fd, PTP_CLOCK_GETCAPS2, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlPtpSysOffsetPrecise returns a description of the clock
|
||||
// offset compared to the system clock.
|
||||
func IoctlPtpSysOffsetPrecise(fd int) (*PtpSysOffsetPrecise, error) {
|
||||
var value PtpSysOffsetPrecise
|
||||
err := ioctlPtr(fd, PTP_SYS_OFFSET_PRECISE2, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlPtpSysOffsetExtended returns an extended description of the
|
||||
// clock offset compared to the system clock. The samples parameter
|
||||
// specifies the desired number of measurements.
|
||||
func IoctlPtpSysOffsetExtended(fd int, samples uint) (*PtpSysOffsetExtended, error) {
|
||||
value := PtpSysOffsetExtended{Samples: uint32(samples)}
|
||||
err := ioctlPtr(fd, PTP_SYS_OFFSET_EXTENDED2, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlPtpPinGetfunc returns the configuration of the specified
|
||||
// I/O pin on given PTP device.
|
||||
func IoctlPtpPinGetfunc(fd int, index uint) (*PtpPinDesc, error) {
|
||||
value := PtpPinDesc{Index: uint32(index)}
|
||||
err := ioctlPtr(fd, PTP_PIN_GETFUNC2, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlPtpPinSetfunc updates configuration of the specified PTP
|
||||
// I/O pin.
|
||||
func IoctlPtpPinSetfunc(fd int, pd *PtpPinDesc) error {
|
||||
return ioctlPtr(fd, PTP_PIN_SETFUNC2, unsafe.Pointer(pd))
|
||||
}
|
||||
|
||||
// IoctlPtpPeroutRequest configures the periodic output mode of the
|
||||
// PTP I/O pins.
|
||||
func IoctlPtpPeroutRequest(fd int, r *PtpPeroutRequest) error {
|
||||
return ioctlPtr(fd, PTP_PEROUT_REQUEST2, unsafe.Pointer(r))
|
||||
}
|
||||
|
||||
// IoctlPtpExttsRequest configures the external timestamping mode
|
||||
// of the PTP I/O pins.
|
||||
func IoctlPtpExttsRequest(fd int, r *PtpExttsRequest) error {
|
||||
return ioctlPtr(fd, PTP_EXTTS_REQUEST2, unsafe.Pointer(r))
|
||||
}
|
||||
|
||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||
// Linux watchdog API. For more information, see:
|
||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||
|
12
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
12
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -158,6 +158,16 @@ includes_Linux='
|
||||
#endif
|
||||
#define _GNU_SOURCE
|
||||
|
||||
// See the description in unix/linux/types.go
|
||||
#if defined(__ARM_EABI__) || \
|
||||
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
|
||||
(defined(__powerpc__) && (!defined(__powerpc64__)))
|
||||
# ifdef _TIME_BITS
|
||||
# undef _TIME_BITS
|
||||
# endif
|
||||
# define _TIME_BITS 32
|
||||
#endif
|
||||
|
||||
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
||||
// these structures. We just include them copied from <bits/termios.h>.
|
||||
#if defined(__powerpc__)
|
||||
@ -256,6 +266,7 @@ struct ltchars {
|
||||
#include <linux/nsfs.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/pps.h>
|
||||
#include <linux/ptp_clock.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/reboot.h>
|
||||
@ -527,6 +538,7 @@ ccflags="$@"
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||
$2 ~ /^PTP_/ ||
|
||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||
$2 ~ /^[US]F_/ ||
|
||||
$2 ~ /^TP_STATUS_/ ||
|
||||
|
1
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -1860,6 +1860,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
|
||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys ClockSettime(clockid int32, time *Timespec) (err error)
|
||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
||||
|
104
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
104
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
@ -768,6 +768,15 @@ func Munmap(b []byte) (err error) {
|
||||
return mapper.Munmap(b)
|
||||
}
|
||||
|
||||
func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) {
|
||||
xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset)
|
||||
return unsafe.Pointer(xaddr), err
|
||||
}
|
||||
|
||||
func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) {
|
||||
return mapper.munmap(uintptr(addr), length)
|
||||
}
|
||||
|
||||
//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getpid() (pid int)
|
||||
@ -816,10 +825,10 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
||||
// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/
|
||||
func isSpecialPath(path []byte) (v bool) {
|
||||
var special = [4][8]byte{
|
||||
[8]byte{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
||||
[8]byte{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
||||
{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
||||
{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
||||
{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
||||
{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
||||
|
||||
var i, j int
|
||||
for i = 0; i < len(special); i++ {
|
||||
@ -3115,3 +3124,90 @@ func legacy_Mkfifoat(dirfd int, path string, mode uint32) (err error) {
|
||||
//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT
|
||||
//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT
|
||||
//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT
|
||||
|
||||
func fcntlAsIs(fd uintptr, cmd int, arg uintptr) (val int, err error) {
|
||||
runtime.EnterSyscall()
|
||||
r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), arg)
|
||||
runtime.ExitSyscall()
|
||||
val = int(r0)
|
||||
if int64(r0) == -1 {
|
||||
err = errnoErr2(e1, e2)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Fcntl(fd uintptr, cmd int, op interface{}) (ret int, err error) {
|
||||
switch op.(type) {
|
||||
case *Flock_t:
|
||||
err = FcntlFlock(fd, cmd, op.(*Flock_t))
|
||||
if err != nil {
|
||||
ret = -1
|
||||
}
|
||||
return
|
||||
case int:
|
||||
return FcntlInt(fd, cmd, op.(int))
|
||||
case *F_cnvrt:
|
||||
return fcntlAsIs(fd, cmd, uintptr(unsafe.Pointer(op.(*F_cnvrt))))
|
||||
case unsafe.Pointer:
|
||||
return fcntlAsIs(fd, cmd, uintptr(op.(unsafe.Pointer)))
|
||||
default:
|
||||
return -1, EINVAL
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
// TODO: use LE call instead if the call is implemented
|
||||
originalOffset, err := Seek(infd, 0, SEEK_CUR)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
//start reading data from in_fd
|
||||
if offset != nil {
|
||||
_, err := Seek(infd, *offset, SEEK_SET)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
}
|
||||
|
||||
buf := make([]byte, count)
|
||||
readBuf := make([]byte, 0)
|
||||
var n int = 0
|
||||
for i := 0; i < count; i += n {
|
||||
n, err := Read(infd, buf)
|
||||
if n == 0 {
|
||||
if err != nil {
|
||||
return -1, err
|
||||
} else { // EOF
|
||||
break
|
||||
}
|
||||
}
|
||||
readBuf = append(readBuf, buf...)
|
||||
buf = buf[0:0]
|
||||
}
|
||||
|
||||
n2, err := Write(outfd, readBuf)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
//When sendfile() returns, this variable will be set to the
|
||||
// offset of the byte following the last byte that was read.
|
||||
if offset != nil {
|
||||
*offset = *offset + int64(n)
|
||||
// If offset is not NULL, then sendfile() does not modify the file
|
||||
// offset of in_fd
|
||||
_, err := Seek(infd, originalOffset, SEEK_SET)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
}
|
||||
return n2, nil
|
||||
}
|
||||
|
22
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
22
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@ -2625,6 +2625,28 @@ const (
|
||||
PR_UNALIGN_NOPRINT = 0x1
|
||||
PR_UNALIGN_SIGBUS = 0x2
|
||||
PSTOREFS_MAGIC = 0x6165676c
|
||||
PTP_CLK_MAGIC = '='
|
||||
PTP_ENABLE_FEATURE = 0x1
|
||||
PTP_EXTTS_EDGES = 0x6
|
||||
PTP_EXTTS_EVENT_VALID = 0x1
|
||||
PTP_EXTTS_V1_VALID_FLAGS = 0x7
|
||||
PTP_EXTTS_VALID_FLAGS = 0x1f
|
||||
PTP_EXT_OFFSET = 0x10
|
||||
PTP_FALLING_EDGE = 0x4
|
||||
PTP_MAX_SAMPLES = 0x19
|
||||
PTP_PEROUT_DUTY_CYCLE = 0x2
|
||||
PTP_PEROUT_ONE_SHOT = 0x1
|
||||
PTP_PEROUT_PHASE = 0x4
|
||||
PTP_PEROUT_V1_VALID_FLAGS = 0x0
|
||||
PTP_PEROUT_VALID_FLAGS = 0x7
|
||||
PTP_PIN_GETFUNC = 0xc0603d06
|
||||
PTP_PIN_GETFUNC2 = 0xc0603d0f
|
||||
PTP_RISING_EDGE = 0x2
|
||||
PTP_STRICT_FLAGS = 0x8
|
||||
PTP_SYS_OFFSET_EXTENDED = 0xc4c03d09
|
||||
PTP_SYS_OFFSET_EXTENDED2 = 0xc4c03d12
|
||||
PTP_SYS_OFFSET_PRECISE = 0xc0403d08
|
||||
PTP_SYS_OFFSET_PRECISE2 = 0xc0403d11
|
||||
PTRACE_ATTACH = 0x10
|
||||
PTRACE_CONT = 0x7
|
||||
PTRACE_DETACH = 0x11
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@ -237,6 +237,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETFPXREGS = 0x12
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@ -237,6 +237,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_ARCH_PRCTL = 0x1e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETFPXREGS = 0x12
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_GETCRUNCHREGS = 0x19
|
||||
PTRACE_GETFDPIC = 0x1f
|
||||
PTRACE_GETFDPIC_EXEC = 0x0
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@ -240,6 +240,20 @@ const (
|
||||
PROT_BTI = 0x10
|
||||
PROT_MTE = 0x20
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_PEEKMTETAGS = 0x21
|
||||
PTRACE_POKEMTETAGS = 0x22
|
||||
PTRACE_SYSEMU = 0x1f
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
@ -238,6 +238,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_SYSEMU = 0x1f
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||
RLIMIT_AS = 0x9
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
@ -237,6 +237,20 @@ const (
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PROT_SAO = 0x10
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETEVRREGS = 0x14
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETREGS64 = 0x16
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
@ -237,6 +237,20 @@ const (
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PROT_SAO = 0x10
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETEVRREGS = 0x14
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETREGS64 = 0x16
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
@ -237,6 +237,20 @@ const (
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PROT_SAO = 0x10
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETEVRREGS = 0x14
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETREGS64 = 0x16
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_GETFDPIC = 0x21
|
||||
PTRACE_GETFDPIC_EXEC = 0x0
|
||||
PTRACE_GETFDPIC_INTERP = 0x1
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
@ -234,6 +234,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||
PTP_ENABLE_PPS = 0x40043d04
|
||||
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||
PTP_EXTTS_REQUEST = 0x40103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||
PTP_PEROUT_REQUEST = 0x40383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||
PTP_PIN_SETFUNC = 0x40603d07
|
||||
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||
PTP_SYS_OFFSET = 0x43403d05
|
||||
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||
PTRACE_DISABLE_TE = 0x5010
|
||||
PTRACE_ENABLE_TE = 0x5009
|
||||
PTRACE_GET_LAST_BREAK = 0x5006
|
||||
|
14
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
14
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
@ -239,6 +239,20 @@ const (
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||
PTP_ENABLE_PPS = 0x80043d04
|
||||
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||
PTP_EXTTS_REQUEST = 0x80103d02
|
||||
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||
PTP_PEROUT_REQUEST = 0x80383d03
|
||||
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||
PTP_PIN_SETFUNC = 0x80603d07
|
||||
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||
PTP_SYS_OFFSET = 0x83403d05
|
||||
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||
PTRACE_GETFPAREGS = 0x14
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETFPREGS64 = 0x19
|
||||
|
10
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
10
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
@ -592,6 +592,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ClockSettime(clockid int32, time *Timespec) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOCK_SETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
120
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
120
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
@ -1752,12 +1752,6 @@ const (
|
||||
IFLA_IPVLAN_UNSPEC = 0x0
|
||||
IFLA_IPVLAN_MODE = 0x1
|
||||
IFLA_IPVLAN_FLAGS = 0x2
|
||||
NETKIT_NEXT = -0x1
|
||||
NETKIT_PASS = 0x0
|
||||
NETKIT_DROP = 0x2
|
||||
NETKIT_REDIRECT = 0x7
|
||||
NETKIT_L2 = 0x0
|
||||
NETKIT_L3 = 0x1
|
||||
IFLA_NETKIT_UNSPEC = 0x0
|
||||
IFLA_NETKIT_PEER_INFO = 0x1
|
||||
IFLA_NETKIT_PRIMARY = 0x2
|
||||
@ -1796,6 +1790,7 @@ const (
|
||||
IFLA_VXLAN_DF = 0x1d
|
||||
IFLA_VXLAN_VNIFILTER = 0x1e
|
||||
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
||||
IFLA_VXLAN_LABEL_POLICY = 0x20
|
||||
IFLA_GENEVE_UNSPEC = 0x0
|
||||
IFLA_GENEVE_ID = 0x1
|
||||
IFLA_GENEVE_REMOTE = 0x2
|
||||
@ -1825,6 +1820,8 @@ const (
|
||||
IFLA_GTP_ROLE = 0x4
|
||||
IFLA_GTP_CREATE_SOCKETS = 0x5
|
||||
IFLA_GTP_RESTART_COUNT = 0x6
|
||||
IFLA_GTP_LOCAL = 0x7
|
||||
IFLA_GTP_LOCAL6 = 0x8
|
||||
IFLA_BOND_UNSPEC = 0x0
|
||||
IFLA_BOND_MODE = 0x1
|
||||
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
||||
@ -1857,6 +1854,7 @@ const (
|
||||
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
||||
IFLA_BOND_MISSED_MAX = 0x1e
|
||||
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
||||
IFLA_BOND_COUPLED_CONTROL = 0x20
|
||||
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
||||
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
||||
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
||||
@ -1925,6 +1923,7 @@ const (
|
||||
IFLA_HSR_SEQ_NR = 0x5
|
||||
IFLA_HSR_VERSION = 0x6
|
||||
IFLA_HSR_PROTOCOL = 0x7
|
||||
IFLA_HSR_INTERLINK = 0x8
|
||||
IFLA_STATS_UNSPEC = 0x0
|
||||
IFLA_STATS_LINK_64 = 0x1
|
||||
IFLA_STATS_LINK_XSTATS = 0x2
|
||||
@ -1977,6 +1976,15 @@ const (
|
||||
IFLA_DSA_MASTER = 0x1
|
||||
)
|
||||
|
||||
const (
|
||||
NETKIT_NEXT = -0x1
|
||||
NETKIT_PASS = 0x0
|
||||
NETKIT_DROP = 0x2
|
||||
NETKIT_REDIRECT = 0x7
|
||||
NETKIT_L2 = 0x0
|
||||
NETKIT_L3 = 0x1
|
||||
)
|
||||
|
||||
const (
|
||||
NF_INET_PRE_ROUTING = 0x0
|
||||
NF_INET_LOCAL_IN = 0x1
|
||||
@ -4110,6 +4118,106 @@ type EthtoolDrvinfo struct {
|
||||
Regdump_len uint32
|
||||
}
|
||||
|
||||
type EthtoolTsInfo struct {
|
||||
Cmd uint32
|
||||
So_timestamping uint32
|
||||
Phc_index int32
|
||||
Tx_types uint32
|
||||
Tx_reserved [3]uint32
|
||||
Rx_filters uint32
|
||||
Rx_reserved [3]uint32
|
||||
}
|
||||
|
||||
type HwTstampConfig struct {
|
||||
Flags int32
|
||||
Tx_type int32
|
||||
Rx_filter int32
|
||||
}
|
||||
|
||||
const (
|
||||
HWTSTAMP_FILTER_NONE = 0x0
|
||||
HWTSTAMP_FILTER_ALL = 0x1
|
||||
HWTSTAMP_FILTER_SOME = 0x2
|
||||
HWTSTAMP_FILTER_PTP_V1_L4_EVENT = 0x3
|
||||
HWTSTAMP_FILTER_PTP_V2_L4_EVENT = 0x6
|
||||
HWTSTAMP_FILTER_PTP_V2_L2_EVENT = 0x9
|
||||
HWTSTAMP_FILTER_PTP_V2_EVENT = 0xc
|
||||
)
|
||||
|
||||
const (
|
||||
HWTSTAMP_TX_OFF = 0x0
|
||||
HWTSTAMP_TX_ON = 0x1
|
||||
HWTSTAMP_TX_ONESTEP_SYNC = 0x2
|
||||
)
|
||||
|
||||
type (
|
||||
PtpClockCaps struct {
|
||||
Max_adj int32
|
||||
N_alarm int32
|
||||
N_ext_ts int32
|
||||
N_per_out int32
|
||||
Pps int32
|
||||
N_pins int32
|
||||
Cross_timestamping int32
|
||||
Adjust_phase int32
|
||||
Max_phase_adj int32
|
||||
Rsv [11]int32
|
||||
}
|
||||
PtpClockTime struct {
|
||||
Sec int64
|
||||
Nsec uint32
|
||||
Reserved uint32
|
||||
}
|
||||
PtpExttsEvent struct {
|
||||
T PtpClockTime
|
||||
Index uint32
|
||||
Flags uint32
|
||||
Rsv [2]uint32
|
||||
}
|
||||
PtpExttsRequest struct {
|
||||
Index uint32
|
||||
Flags uint32
|
||||
Rsv [2]uint32
|
||||
}
|
||||
PtpPeroutRequest struct {
|
||||
StartOrPhase PtpClockTime
|
||||
Period PtpClockTime
|
||||
Index uint32
|
||||
Flags uint32
|
||||
On PtpClockTime
|
||||
}
|
||||
PtpPinDesc struct {
|
||||
Name [64]byte
|
||||
Index uint32
|
||||
Func uint32
|
||||
Chan uint32
|
||||
Rsv [5]uint32
|
||||
}
|
||||
PtpSysOffset struct {
|
||||
Samples uint32
|
||||
Rsv [3]uint32
|
||||
Ts [51]PtpClockTime
|
||||
}
|
||||
PtpSysOffsetExtended struct {
|
||||
Samples uint32
|
||||
Rsv [3]uint32
|
||||
Ts [25][3]PtpClockTime
|
||||
}
|
||||
PtpSysOffsetPrecise struct {
|
||||
Device PtpClockTime
|
||||
Realtime PtpClockTime
|
||||
Monoraw PtpClockTime
|
||||
Rsv [4]uint32
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
PTP_PF_NONE = 0x0
|
||||
PTP_PF_EXTTS = 0x1
|
||||
PTP_PF_PEROUT = 0x2
|
||||
PTP_PF_PHYSYNC = 0x3
|
||||
)
|
||||
|
||||
type (
|
||||
HIDRawReportDescriptor struct {
|
||||
Size uint32
|
||||
|
6
vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
generated
vendored
6
vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
generated
vendored
@ -377,6 +377,12 @@ type Flock_t struct {
|
||||
Pid int32
|
||||
}
|
||||
|
||||
type F_cnvrt struct {
|
||||
Cvtcmd int32
|
||||
Pccsid int16
|
||||
Fccsid int16
|
||||
}
|
||||
|
||||
type Termios struct {
|
||||
Cflag uint32
|
||||
Iflag uint32
|
||||
|
34
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
34
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@ -725,20 +725,12 @@ func DurationSinceBoot() time.Duration {
|
||||
}
|
||||
|
||||
func Ftruncate(fd Handle, length int64) (err error) {
|
||||
curoffset, e := Seek(fd, 0, 1)
|
||||
if e != nil {
|
||||
return e
|
||||
type _FILE_END_OF_FILE_INFO struct {
|
||||
EndOfFile int64
|
||||
}
|
||||
defer Seek(fd, curoffset, 0)
|
||||
_, e = Seek(fd, length, 0)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
e = SetEndOfFile(fd)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
return nil
|
||||
var info _FILE_END_OF_FILE_INFO
|
||||
info.EndOfFile = length
|
||||
return SetFileInformationByHandle(fd, FileEndOfFileInfo, (*byte)(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info)))
|
||||
}
|
||||
|
||||
func Gettimeofday(tv *Timeval) (err error) {
|
||||
@ -894,6 +886,11 @@ const socket_error = uintptr(^uint32(0))
|
||||
//sys GetACP() (acp uint32) = kernel32.GetACP
|
||||
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
||||
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
||||
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
|
||||
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
|
||||
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
|
||||
//sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange
|
||||
//sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2
|
||||
|
||||
// For testing: clients can set this flag to force
|
||||
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
||||
@ -1685,13 +1682,16 @@ func (s NTStatus) Error() string {
|
||||
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
|
||||
// the more common *uint16 string type.
|
||||
func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
||||
var u NTUnicodeString
|
||||
s16, err := UTF16PtrFromString(s)
|
||||
s16, err := UTF16FromString(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
RtlInitUnicodeString(&u, s16)
|
||||
return &u, nil
|
||||
n := uint16(len(s16) * 2)
|
||||
return &NTUnicodeString{
|
||||
Length: n - 2, // subtract 2 bytes for the NULL terminator
|
||||
MaximumLength: n,
|
||||
Buffer: &s16[0],
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
|
||||
|
126
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
126
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
@ -2203,6 +2203,132 @@ const (
|
||||
IfOperStatusLowerLayerDown = 7
|
||||
)
|
||||
|
||||
const (
|
||||
IF_MAX_PHYS_ADDRESS_LENGTH = 32
|
||||
IF_MAX_STRING_SIZE = 256
|
||||
)
|
||||
|
||||
// MIB_IF_ENTRY_LEVEL enumeration from netioapi.h or
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-getifentry2ex.
|
||||
const (
|
||||
MibIfEntryNormal = 0
|
||||
MibIfEntryNormalWithoutStatistics = 2
|
||||
)
|
||||
|
||||
// MIB_NOTIFICATION_TYPE enumeration from netioapi.h or
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_notification_type.
|
||||
const (
|
||||
MibParameterNotification = 0
|
||||
MibAddInstance = 1
|
||||
MibDeleteInstance = 2
|
||||
MibInitialNotification = 3
|
||||
)
|
||||
|
||||
// MibIfRow2 stores information about a particular interface. See
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_row2.
|
||||
type MibIfRow2 struct {
|
||||
InterfaceLuid uint64
|
||||
InterfaceIndex uint32
|
||||
InterfaceGuid GUID
|
||||
Alias [IF_MAX_STRING_SIZE + 1]uint16
|
||||
Description [IF_MAX_STRING_SIZE + 1]uint16
|
||||
PhysicalAddressLength uint32
|
||||
PhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||
PermanentPhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||
Mtu uint32
|
||||
Type uint32
|
||||
TunnelType uint32
|
||||
MediaType uint32
|
||||
PhysicalMediumType uint32
|
||||
AccessType uint32
|
||||
DirectionType uint32
|
||||
InterfaceAndOperStatusFlags uint8
|
||||
OperStatus uint32
|
||||
AdminStatus uint32
|
||||
MediaConnectState uint32
|
||||
NetworkGuid GUID
|
||||
ConnectionType uint32
|
||||
TransmitLinkSpeed uint64
|
||||
ReceiveLinkSpeed uint64
|
||||
InOctets uint64
|
||||
InUcastPkts uint64
|
||||
InNUcastPkts uint64
|
||||
InDiscards uint64
|
||||
InErrors uint64
|
||||
InUnknownProtos uint64
|
||||
InUcastOctets uint64
|
||||
InMulticastOctets uint64
|
||||
InBroadcastOctets uint64
|
||||
OutOctets uint64
|
||||
OutUcastPkts uint64
|
||||
OutNUcastPkts uint64
|
||||
OutDiscards uint64
|
||||
OutErrors uint64
|
||||
OutUcastOctets uint64
|
||||
OutMulticastOctets uint64
|
||||
OutBroadcastOctets uint64
|
||||
OutQLen uint64
|
||||
}
|
||||
|
||||
// MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row.
|
||||
type MibUnicastIpAddressRow struct {
|
||||
Address RawSockaddrInet6 // SOCKADDR_INET union
|
||||
InterfaceLuid uint64
|
||||
InterfaceIndex uint32
|
||||
PrefixOrigin uint32
|
||||
SuffixOrigin uint32
|
||||
ValidLifetime uint32
|
||||
PreferredLifetime uint32
|
||||
OnLinkPrefixLength uint8
|
||||
SkipAsSource uint8
|
||||
DadState uint32
|
||||
ScopeId uint32
|
||||
CreationTimeStamp Filetime
|
||||
}
|
||||
|
||||
const ScopeLevelCount = 16
|
||||
|
||||
// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
|
||||
// See https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row.
|
||||
type MibIpInterfaceRow struct {
|
||||
Family uint16
|
||||
InterfaceLuid uint64
|
||||
InterfaceIndex uint32
|
||||
MaxReassemblySize uint32
|
||||
InterfaceIdentifier uint64
|
||||
MinRouterAdvertisementInterval uint32
|
||||
MaxRouterAdvertisementInterval uint32
|
||||
AdvertisingEnabled uint8
|
||||
ForwardingEnabled uint8
|
||||
WeakHostSend uint8
|
||||
WeakHostReceive uint8
|
||||
UseAutomaticMetric uint8
|
||||
UseNeighborUnreachabilityDetection uint8
|
||||
ManagedAddressConfigurationSupported uint8
|
||||
OtherStatefulConfigurationSupported uint8
|
||||
AdvertiseDefaultRoute uint8
|
||||
RouterDiscoveryBehavior uint32
|
||||
DadTransmits uint32
|
||||
BaseReachableTime uint32
|
||||
RetransmitTime uint32
|
||||
PathMtuDiscoveryTimeout uint32
|
||||
LinkLocalAddressBehavior uint32
|
||||
LinkLocalAddressTimeout uint32
|
||||
ZoneIndices [ScopeLevelCount]uint32
|
||||
SitePrefixLength uint32
|
||||
Metric uint32
|
||||
NlMtu uint32
|
||||
Connected uint8
|
||||
SupportsWakeUpPatterns uint8
|
||||
SupportsNeighborDiscovery uint8
|
||||
SupportsRouterDiscovery uint8
|
||||
ReachableTime uint32
|
||||
TransmitOffload uint32
|
||||
ReceiveOffload uint32
|
||||
DisableDefaultRoutes uint8
|
||||
}
|
||||
|
||||
// Console related constants used for the mode parameter to SetConsoleMode. See
|
||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
||||
|
||||
|
53
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
53
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@ -181,10 +181,15 @@ var (
|
||||
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
|
||||
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
|
||||
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
|
||||
procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2")
|
||||
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
||||
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
||||
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
||||
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
||||
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
|
||||
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
|
||||
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
|
||||
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
|
||||
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
||||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||
procCancelIo = modkernel32.NewProc("CancelIo")
|
||||
@ -1606,6 +1611,14 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si
|
||||
return
|
||||
}
|
||||
|
||||
func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) {
|
||||
r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle))
|
||||
if r0 != 0 {
|
||||
errcode = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
||||
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
||||
if r0 != 0 {
|
||||
@ -1638,6 +1651,46 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) {
|
||||
r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row)))
|
||||
if r0 != 0 {
|
||||
errcode = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
||||
r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
|
||||
if r0 != 0 {
|
||||
errcode = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||
var _p0 uint32
|
||||
if initialNotification {
|
||||
_p0 = 1
|
||||
}
|
||||
r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
|
||||
if r0 != 0 {
|
||||
errcode = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||
var _p0 uint32
|
||||
if initialNotification {
|
||||
_p0 = 1
|
||||
}
|
||||
r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
|
||||
if r0 != 0 {
|
||||
errcode = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||
cookie = uintptr(r0)
|
||||
|
5
vendor/golang.org/x/tools/go/ast/astutil/imports.go
generated
vendored
5
vendor/golang.org/x/tools/go/ast/astutil/imports.go
generated
vendored
@ -344,7 +344,12 @@ func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (r
|
||||
}
|
||||
|
||||
// UsesImport reports whether a given import is used.
|
||||
// The provided File must have been parsed with syntactic object resolution
|
||||
// (not using go/parser.SkipObjectResolution).
|
||||
func UsesImport(f *ast.File, path string) (used bool) {
|
||||
if f.Scope == nil {
|
||||
panic("file f was not parsed with syntactic object resolution")
|
||||
}
|
||||
spec := importSpec(f, path)
|
||||
if spec == nil {
|
||||
return
|
||||
|
233
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
233
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
@ -27,7 +27,6 @@ import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/tools/go/ast/astutil"
|
||||
"golang.org/x/tools/internal/event"
|
||||
"golang.org/x/tools/internal/gocommand"
|
||||
@ -91,18 +90,6 @@ type ImportFix struct {
|
||||
Relevance float64 // see pkg
|
||||
}
|
||||
|
||||
// An ImportInfo represents a single import statement.
|
||||
type ImportInfo struct {
|
||||
ImportPath string // import path, e.g. "crypto/rand".
|
||||
Name string // import name, e.g. "crand", or "" if none.
|
||||
}
|
||||
|
||||
// A packageInfo represents what's known about a package.
|
||||
type packageInfo struct {
|
||||
name string // real package name, if known.
|
||||
exports map[string]bool // known exports.
|
||||
}
|
||||
|
||||
// parseOtherFiles parses all the Go files in srcDir except filename, including
|
||||
// test files if filename looks like a test.
|
||||
//
|
||||
@ -162,8 +149,8 @@ func addGlobals(f *ast.File, globals map[string]bool) {
|
||||
|
||||
// collectReferences builds a map of selector expressions, from
|
||||
// left hand side (X) to a set of right hand sides (Sel).
|
||||
func collectReferences(f *ast.File) references {
|
||||
refs := references{}
|
||||
func collectReferences(f *ast.File) References {
|
||||
refs := References{}
|
||||
|
||||
var visitor visitFn
|
||||
visitor = func(node ast.Node) ast.Visitor {
|
||||
@ -233,7 +220,7 @@ func (p *pass) findMissingImport(pkg string, syms map[string]bool) *ImportInfo {
|
||||
|
||||
allFound := true
|
||||
for right := range syms {
|
||||
if !pkgInfo.exports[right] {
|
||||
if !pkgInfo.Exports[right] {
|
||||
allFound = false
|
||||
break
|
||||
}
|
||||
@ -246,11 +233,6 @@ func (p *pass) findMissingImport(pkg string, syms map[string]bool) *ImportInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
// references is set of references found in a Go file. The first map key is the
|
||||
// left hand side of a selector expression, the second key is the right hand
|
||||
// side, and the value should always be true.
|
||||
type references map[string]map[string]bool
|
||||
|
||||
// A pass contains all the inputs and state necessary to fix a file's imports.
|
||||
// It can be modified in some ways during use; see comments below.
|
||||
type pass struct {
|
||||
@ -258,27 +240,29 @@ type pass struct {
|
||||
fset *token.FileSet // fset used to parse f and its siblings.
|
||||
f *ast.File // the file being fixed.
|
||||
srcDir string // the directory containing f.
|
||||
env *ProcessEnv // the environment to use for go commands, etc.
|
||||
loadRealPackageNames bool // if true, load package names from disk rather than guessing them.
|
||||
otherFiles []*ast.File // sibling files.
|
||||
logf func(string, ...any)
|
||||
source Source // the environment to use for go commands, etc.
|
||||
loadRealPackageNames bool // if true, load package names from disk rather than guessing them.
|
||||
otherFiles []*ast.File // sibling files.
|
||||
goroot string
|
||||
|
||||
// Intermediate state, generated by load.
|
||||
existingImports map[string][]*ImportInfo
|
||||
allRefs references
|
||||
missingRefs references
|
||||
allRefs References
|
||||
missingRefs References
|
||||
|
||||
// Inputs to fix. These can be augmented between successive fix calls.
|
||||
lastTry bool // indicates that this is the last call and fix should clean up as best it can.
|
||||
candidates []*ImportInfo // candidate imports in priority order.
|
||||
knownPackages map[string]*packageInfo // information about all known packages.
|
||||
knownPackages map[string]*PackageInfo // information about all known packages.
|
||||
}
|
||||
|
||||
// loadPackageNames saves the package names for everything referenced by imports.
|
||||
func (p *pass) loadPackageNames(imports []*ImportInfo) error {
|
||||
if p.env.Logf != nil {
|
||||
p.env.Logf("loading package names for %v packages", len(imports))
|
||||
func (p *pass) loadPackageNames(ctx context.Context, imports []*ImportInfo) error {
|
||||
if p.logf != nil {
|
||||
p.logf("loading package names for %v packages", len(imports))
|
||||
defer func() {
|
||||
p.env.Logf("done loading package names for %v packages", len(imports))
|
||||
p.logf("done loading package names for %v packages", len(imports))
|
||||
}()
|
||||
}
|
||||
var unknown []string
|
||||
@ -289,20 +273,17 @@ func (p *pass) loadPackageNames(imports []*ImportInfo) error {
|
||||
unknown = append(unknown, imp.ImportPath)
|
||||
}
|
||||
|
||||
resolver, err := p.env.GetResolver()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
names, err := resolver.loadPackageNames(unknown, p.srcDir)
|
||||
names, err := p.source.LoadPackageNames(ctx, p.srcDir, unknown)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO(rfindley): revisit this. Why do we need to store known packages with
|
||||
// no exports? The inconsistent data is confusing.
|
||||
for path, name := range names {
|
||||
p.knownPackages[path] = &packageInfo{
|
||||
name: name,
|
||||
exports: map[string]bool{},
|
||||
p.knownPackages[path] = &PackageInfo{
|
||||
Name: name,
|
||||
Exports: map[string]bool{},
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -330,8 +311,8 @@ func (p *pass) importIdentifier(imp *ImportInfo) string {
|
||||
return imp.Name
|
||||
}
|
||||
known := p.knownPackages[imp.ImportPath]
|
||||
if known != nil && known.name != "" {
|
||||
return withoutVersion(known.name)
|
||||
if known != nil && known.Name != "" {
|
||||
return withoutVersion(known.Name)
|
||||
}
|
||||
return ImportPathToAssumedName(imp.ImportPath)
|
||||
}
|
||||
@ -339,9 +320,9 @@ func (p *pass) importIdentifier(imp *ImportInfo) string {
|
||||
// load reads in everything necessary to run a pass, and reports whether the
|
||||
// file already has all the imports it needs. It fills in p.missingRefs with the
|
||||
// file's missing symbols, if any, or removes unused imports if not.
|
||||
func (p *pass) load() ([]*ImportFix, bool) {
|
||||
p.knownPackages = map[string]*packageInfo{}
|
||||
p.missingRefs = references{}
|
||||
func (p *pass) load(ctx context.Context) ([]*ImportFix, bool) {
|
||||
p.knownPackages = map[string]*PackageInfo{}
|
||||
p.missingRefs = References{}
|
||||
p.existingImports = map[string][]*ImportInfo{}
|
||||
|
||||
// Load basic information about the file in question.
|
||||
@ -364,9 +345,11 @@ func (p *pass) load() ([]*ImportFix, bool) {
|
||||
// f's imports by the identifier they introduce.
|
||||
imports := collectImports(p.f)
|
||||
if p.loadRealPackageNames {
|
||||
err := p.loadPackageNames(append(imports, p.candidates...))
|
||||
err := p.loadPackageNames(ctx, append(imports, p.candidates...))
|
||||
if err != nil {
|
||||
p.env.logf("loading package names: %v", err)
|
||||
if p.logf != nil {
|
||||
p.logf("loading package names: %v", err)
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
@ -535,9 +518,10 @@ func (p *pass) assumeSiblingImportsValid() {
|
||||
// We have the stdlib in memory; no need to guess.
|
||||
rights = symbolNameSet(m)
|
||||
}
|
||||
p.addCandidate(imp, &packageInfo{
|
||||
// TODO(rfindley): we should set package name here, for consistency.
|
||||
p.addCandidate(imp, &PackageInfo{
|
||||
// no name; we already know it.
|
||||
exports: rights,
|
||||
Exports: rights,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -546,14 +530,14 @@ func (p *pass) assumeSiblingImportsValid() {
|
||||
|
||||
// addCandidate adds a candidate import to p, and merges in the information
|
||||
// in pkg.
|
||||
func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) {
|
||||
func (p *pass) addCandidate(imp *ImportInfo, pkg *PackageInfo) {
|
||||
p.candidates = append(p.candidates, imp)
|
||||
if existing, ok := p.knownPackages[imp.ImportPath]; ok {
|
||||
if existing.name == "" {
|
||||
existing.name = pkg.name
|
||||
if existing.Name == "" {
|
||||
existing.Name = pkg.Name
|
||||
}
|
||||
for export := range pkg.exports {
|
||||
existing.exports[export] = true
|
||||
for export := range pkg.Exports {
|
||||
existing.Exports[export] = true
|
||||
}
|
||||
} else {
|
||||
p.knownPackages[imp.ImportPath] = pkg
|
||||
@ -581,19 +565,42 @@ func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *P
|
||||
// getFixes gets the import fixes that need to be made to f in order to fix the imports.
|
||||
// It does not modify the ast.
|
||||
func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) {
|
||||
source, err := NewProcessEnvSource(env, filename, f.Name.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
goEnv, err := env.goEnv()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return getFixesWithSource(ctx, fset, f, filename, goEnv["GOROOT"], env.logf, source)
|
||||
}
|
||||
|
||||
func getFixesWithSource(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, goroot string, logf func(string, ...any), source Source) ([]*ImportFix, error) {
|
||||
// This logic is defensively duplicated from getFixes.
|
||||
abs, err := filepath.Abs(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
srcDir := filepath.Dir(abs)
|
||||
env.logf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir)
|
||||
|
||||
if logf != nil {
|
||||
logf("fixImports(filename=%q), srcDir=%q ...", filename, abs, srcDir)
|
||||
}
|
||||
|
||||
// First pass: looking only at f, and using the naive algorithm to
|
||||
// derive package names from import paths, see if the file is already
|
||||
// complete. We can't add any imports yet, because we don't know
|
||||
// if missing references are actually package vars.
|
||||
p := &pass{fset: fset, f: f, srcDir: srcDir, env: env}
|
||||
if fixes, done := p.load(); done {
|
||||
p := &pass{
|
||||
fset: fset,
|
||||
f: f,
|
||||
srcDir: srcDir,
|
||||
logf: logf,
|
||||
goroot: goroot,
|
||||
source: source,
|
||||
}
|
||||
if fixes, done := p.load(ctx); done {
|
||||
return fixes, nil
|
||||
}
|
||||
|
||||
@ -605,7 +612,7 @@ func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename st
|
||||
// Second pass: add information from other files in the same package,
|
||||
// like their package vars and imports.
|
||||
p.otherFiles = otherFiles
|
||||
if fixes, done := p.load(); done {
|
||||
if fixes, done := p.load(ctx); done {
|
||||
return fixes, nil
|
||||
}
|
||||
|
||||
@ -618,10 +625,17 @@ func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename st
|
||||
|
||||
// Third pass: get real package names where we had previously used
|
||||
// the naive algorithm.
|
||||
p = &pass{fset: fset, f: f, srcDir: srcDir, env: env}
|
||||
p = &pass{
|
||||
fset: fset,
|
||||
f: f,
|
||||
srcDir: srcDir,
|
||||
logf: logf,
|
||||
goroot: goroot,
|
||||
source: p.source, // safe to reuse, as it's just a wrapper around env
|
||||
}
|
||||
p.loadRealPackageNames = true
|
||||
p.otherFiles = otherFiles
|
||||
if fixes, done := p.load(); done {
|
||||
if fixes, done := p.load(ctx); done {
|
||||
return fixes, nil
|
||||
}
|
||||
|
||||
@ -835,7 +849,7 @@ func GetPackageExports(ctx context.Context, wrapped func(PackageExport), searchP
|
||||
return true
|
||||
},
|
||||
dirFound: func(pkg *pkg) bool {
|
||||
return pkgIsCandidate(filename, references{searchPkg: nil}, pkg)
|
||||
return pkgIsCandidate(filename, References{searchPkg: nil}, pkg)
|
||||
},
|
||||
packageNameLoaded: func(pkg *pkg) bool {
|
||||
return pkg.packageName == searchPkg
|
||||
@ -1086,11 +1100,7 @@ func (e *ProcessEnv) invokeGo(ctx context.Context, verb string, args ...string)
|
||||
return e.GocmdRunner.Run(ctx, inv)
|
||||
}
|
||||
|
||||
func addStdlibCandidates(pass *pass, refs references) error {
|
||||
goenv, err := pass.env.goEnv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func addStdlibCandidates(pass *pass, refs References) error {
|
||||
localbase := func(nm string) string {
|
||||
ans := path.Base(nm)
|
||||
if ans[0] == 'v' {
|
||||
@ -1105,13 +1115,13 @@ func addStdlibCandidates(pass *pass, refs references) error {
|
||||
}
|
||||
add := func(pkg string) {
|
||||
// Prevent self-imports.
|
||||
if path.Base(pkg) == pass.f.Name.Name && filepath.Join(goenv["GOROOT"], "src", pkg) == pass.srcDir {
|
||||
if path.Base(pkg) == pass.f.Name.Name && filepath.Join(pass.goroot, "src", pkg) == pass.srcDir {
|
||||
return
|
||||
}
|
||||
exports := symbolNameSet(stdlib.PackageSymbols[pkg])
|
||||
pass.addCandidate(
|
||||
&ImportInfo{ImportPath: pkg},
|
||||
&packageInfo{name: localbase(pkg), exports: exports})
|
||||
&PackageInfo{Name: localbase(pkg), Exports: exports})
|
||||
}
|
||||
for left := range refs {
|
||||
if left == "rand" {
|
||||
@ -1175,91 +1185,14 @@ type scanCallback struct {
|
||||
exportsLoaded func(pkg *pkg, exports []stdlib.Symbol)
|
||||
}
|
||||
|
||||
func addExternalCandidates(ctx context.Context, pass *pass, refs references, filename string) error {
|
||||
func addExternalCandidates(ctx context.Context, pass *pass, refs References, filename string) error {
|
||||
ctx, done := event.Start(ctx, "imports.addExternalCandidates")
|
||||
defer done()
|
||||
|
||||
var mu sync.Mutex
|
||||
found := make(map[string][]pkgDistance)
|
||||
callback := &scanCallback{
|
||||
rootFound: func(gopathwalk.Root) bool {
|
||||
return true // We want everything.
|
||||
},
|
||||
dirFound: func(pkg *pkg) bool {
|
||||
return pkgIsCandidate(filename, refs, pkg)
|
||||
},
|
||||
packageNameLoaded: func(pkg *pkg) bool {
|
||||
if _, want := refs[pkg.packageName]; !want {
|
||||
return false
|
||||
}
|
||||
if pkg.dir == pass.srcDir && pass.f.Name.Name == pkg.packageName {
|
||||
// The candidate is in the same directory and has the
|
||||
// same package name. Don't try to import ourselves.
|
||||
return false
|
||||
}
|
||||
if !canUse(filename, pkg.dir) {
|
||||
return false
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
found[pkg.packageName] = append(found[pkg.packageName], pkgDistance{pkg, distance(pass.srcDir, pkg.dir)})
|
||||
return false // We'll do our own loading after we sort.
|
||||
},
|
||||
}
|
||||
resolver, err := pass.env.GetResolver()
|
||||
results, err := pass.source.ResolveReferences(ctx, filename, refs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = resolver.scan(ctx, callback); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Search for imports matching potential package references.
|
||||
type result struct {
|
||||
imp *ImportInfo
|
||||
pkg *packageInfo
|
||||
}
|
||||
results := make([]*result, len(refs))
|
||||
|
||||
g, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
searcher := symbolSearcher{
|
||||
logf: pass.env.logf,
|
||||
srcDir: pass.srcDir,
|
||||
xtest: strings.HasSuffix(pass.f.Name.Name, "_test"),
|
||||
loadExports: resolver.loadExports,
|
||||
}
|
||||
|
||||
i := 0
|
||||
for pkgName, symbols := range refs {
|
||||
index := i // claim an index in results
|
||||
i++
|
||||
pkgName := pkgName
|
||||
symbols := symbols
|
||||
|
||||
g.Go(func() error {
|
||||
found, err := searcher.search(ctx, found[pkgName], pkgName, symbols)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if found == nil {
|
||||
return nil // No matching package.
|
||||
}
|
||||
|
||||
imp := &ImportInfo{
|
||||
ImportPath: found.importPathShort,
|
||||
}
|
||||
pkg := &packageInfo{
|
||||
name: pkgName,
|
||||
exports: symbols,
|
||||
}
|
||||
results[index] = &result{imp, pkg}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, result := range results {
|
||||
if result == nil {
|
||||
@ -1267,7 +1200,7 @@ func addExternalCandidates(ctx context.Context, pass *pass, refs references, fil
|
||||
}
|
||||
// Don't offer completions that would shadow predeclared
|
||||
// names, such as github.com/coreos/etcd/error.
|
||||
if types.Universe.Lookup(result.pkg.name) != nil { // predeclared
|
||||
if types.Universe.Lookup(result.Package.Name) != nil { // predeclared
|
||||
// Ideally we would skip this candidate only
|
||||
// if the predeclared name is actually
|
||||
// referenced by the file, but that's a lot
|
||||
@ -1276,7 +1209,7 @@ func addExternalCandidates(ctx context.Context, pass *pass, refs references, fil
|
||||
// user before long.
|
||||
continue
|
||||
}
|
||||
pass.addCandidate(result.imp, result.pkg)
|
||||
pass.addCandidate(result.Import, result.Package)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -1801,7 +1734,7 @@ func (s *symbolSearcher) searchOne(ctx context.Context, c pkgDistance, symbols m
|
||||
// filename is the file being formatted.
|
||||
// pkgIdent is the package being searched for, like "client" (if
|
||||
// searching for "client.New")
|
||||
func pkgIsCandidate(filename string, refs references, pkg *pkg) bool {
|
||||
func pkgIsCandidate(filename string, refs References, pkg *pkg) bool {
|
||||
// Check "internal" and "vendor" visibility:
|
||||
if !canUse(filename, pkg.dir) {
|
||||
return false
|
||||
|
31
vendor/golang.org/x/tools/internal/imports/imports.go
generated
vendored
31
vendor/golang.org/x/tools/internal/imports/imports.go
generated
vendored
@ -47,7 +47,14 @@ type Options struct {
|
||||
// Process implements golang.org/x/tools/imports.Process with explicit context in opt.Env.
|
||||
func Process(filename string, src []byte, opt *Options) (formatted []byte, err error) {
|
||||
fileSet := token.NewFileSet()
|
||||
file, adjust, err := parse(fileSet, filename, src, opt)
|
||||
var parserMode parser.Mode
|
||||
if opt.Comments {
|
||||
parserMode |= parser.ParseComments
|
||||
}
|
||||
if opt.AllErrors {
|
||||
parserMode |= parser.AllErrors
|
||||
}
|
||||
file, adjust, err := parse(fileSet, filename, src, parserMode, opt.Fragment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -66,17 +73,19 @@ func Process(filename string, src []byte, opt *Options) (formatted []byte, err e
|
||||
//
|
||||
// Note that filename's directory influences which imports can be chosen,
|
||||
// so it is important that filename be accurate.
|
||||
func FixImports(ctx context.Context, filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) {
|
||||
func FixImports(ctx context.Context, filename string, src []byte, goroot string, logf func(string, ...any), source Source) (fixes []*ImportFix, err error) {
|
||||
ctx, done := event.Start(ctx, "imports.FixImports")
|
||||
defer done()
|
||||
|
||||
fileSet := token.NewFileSet()
|
||||
file, _, err := parse(fileSet, filename, src, opt)
|
||||
// TODO(rfindley): these default values for ParseComments and AllErrors were
|
||||
// extracted from gopls, but are they even needed?
|
||||
file, _, err := parse(fileSet, filename, src, parser.ParseComments|parser.AllErrors, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return getFixes(ctx, fileSet, file, filename, opt.Env)
|
||||
return getFixesWithSource(ctx, fileSet, file, filename, goroot, logf, source)
|
||||
}
|
||||
|
||||
// ApplyFixes applies all of the fixes to the file and formats it. extraMode
|
||||
@ -114,7 +123,7 @@ func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, e
|
||||
// formatted file, and returns the postpocessed result.
|
||||
func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) {
|
||||
mergeImports(file)
|
||||
sortImports(opt.LocalPrefix, fset.File(file.Pos()), file)
|
||||
sortImports(opt.LocalPrefix, fset.File(file.FileStart), file)
|
||||
var spacesBefore []string // import paths we need spaces before
|
||||
for _, impSection := range astutil.Imports(fset, file) {
|
||||
// Within each block of contiguous imports, see if any
|
||||
@ -164,13 +173,9 @@ func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(ori
|
||||
|
||||
// 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) {
|
||||
var parserMode parser.Mode // legacy ast.Object resolution is required here
|
||||
if opt.Comments {
|
||||
parserMode |= parser.ParseComments
|
||||
}
|
||||
if opt.AllErrors {
|
||||
parserMode |= parser.AllErrors
|
||||
func parse(fset *token.FileSet, filename string, src []byte, parserMode parser.Mode, fragment bool) (*ast.File, func(orig, src []byte) []byte, error) {
|
||||
if parserMode&parser.SkipObjectResolution != 0 {
|
||||
panic("legacy ast.Object resolution is required")
|
||||
}
|
||||
|
||||
// Try as whole source file.
|
||||
@ -181,7 +186,7 @@ func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast
|
||||
// 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'") {
|
||||
if !fragment || !strings.Contains(err.Error(), "expected 'package'") {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
63
vendor/golang.org/x/tools/internal/imports/source.go
generated
vendored
Normal file
63
vendor/golang.org/x/tools/internal/imports/source.go
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
// Copyright 2024 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package imports
|
||||
|
||||
import "context"
|
||||
|
||||
// These types document the APIs below.
|
||||
//
|
||||
// TODO(rfindley): consider making these defined types rather than aliases.
|
||||
type (
|
||||
ImportPath = string
|
||||
PackageName = string
|
||||
Symbol = string
|
||||
|
||||
// References is set of References found in a Go file. The first map key is the
|
||||
// left hand side of a selector expression, the second key is the right hand
|
||||
// side, and the value should always be true.
|
||||
References = map[PackageName]map[Symbol]bool
|
||||
)
|
||||
|
||||
// A Result satisfies a missing import.
|
||||
//
|
||||
// The Import field describes the missing import spec, and the Package field
|
||||
// summarizes the package exports.
|
||||
type Result struct {
|
||||
Import *ImportInfo
|
||||
Package *PackageInfo
|
||||
}
|
||||
|
||||
// An ImportInfo represents a single import statement.
|
||||
type ImportInfo struct {
|
||||
ImportPath string // import path, e.g. "crypto/rand".
|
||||
Name string // import name, e.g. "crand", or "" if none.
|
||||
}
|
||||
|
||||
// A PackageInfo represents what's known about a package.
|
||||
type PackageInfo struct {
|
||||
Name string // package name in the package declaration, if known
|
||||
Exports map[string]bool // set of names of known package level sortSymbols
|
||||
}
|
||||
|
||||
// A Source provides imports to satisfy unresolved references in the file being
|
||||
// fixed.
|
||||
type Source interface {
|
||||
// LoadPackageNames queries PackageName information for the requested import
|
||||
// paths, when operating from the provided srcDir.
|
||||
//
|
||||
// TODO(rfindley): try to refactor to remove this operation.
|
||||
LoadPackageNames(ctx context.Context, srcDir string, paths []ImportPath) (map[ImportPath]PackageName, error)
|
||||
|
||||
// ResolveReferences asks the Source for the best package name to satisfy
|
||||
// each of the missing references, in the context of fixing the given
|
||||
// filename.
|
||||
//
|
||||
// Returns a map from package name to a [Result] for that package name that
|
||||
// provides the required symbols. Keys may be omitted in the map if no
|
||||
// candidates satisfy all missing references for that package name. It is up
|
||||
// to each data source to select the best result for each entry in the
|
||||
// missing map.
|
||||
ResolveReferences(ctx context.Context, filename string, missing References) (map[PackageName]*Result, error)
|
||||
}
|
125
vendor/golang.org/x/tools/internal/imports/source_env.go
generated
vendored
Normal file
125
vendor/golang.org/x/tools/internal/imports/source_env.go
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
// Copyright 2024 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package imports
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"golang.org/x/tools/internal/gopathwalk"
|
||||
)
|
||||
|
||||
// ProcessEnvSource implements the [Source] interface using the legacy
|
||||
// [ProcessEnv] abstraction.
|
||||
type ProcessEnvSource struct {
|
||||
env *ProcessEnv
|
||||
srcDir string
|
||||
filename string
|
||||
pkgName string
|
||||
}
|
||||
|
||||
// NewProcessEnvSource returns a [ProcessEnvSource] wrapping the given
|
||||
// env, to be used for fixing imports in the file with name filename in package
|
||||
// named pkgName.
|
||||
func NewProcessEnvSource(env *ProcessEnv, filename, pkgName string) (*ProcessEnvSource, error) {
|
||||
abs, err := filepath.Abs(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
srcDir := filepath.Dir(abs)
|
||||
return &ProcessEnvSource{
|
||||
env: env,
|
||||
srcDir: srcDir,
|
||||
filename: filename,
|
||||
pkgName: pkgName,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *ProcessEnvSource) LoadPackageNames(ctx context.Context, srcDir string, unknown []string) (map[string]string, error) {
|
||||
r, err := s.env.GetResolver()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.loadPackageNames(unknown, srcDir)
|
||||
}
|
||||
|
||||
func (s *ProcessEnvSource) ResolveReferences(ctx context.Context, filename string, refs map[string]map[string]bool) (map[string]*Result, error) {
|
||||
var mu sync.Mutex
|
||||
found := make(map[string][]pkgDistance)
|
||||
callback := &scanCallback{
|
||||
rootFound: func(gopathwalk.Root) bool {
|
||||
return true // We want everything.
|
||||
},
|
||||
dirFound: func(pkg *pkg) bool {
|
||||
return pkgIsCandidate(filename, refs, pkg)
|
||||
},
|
||||
packageNameLoaded: func(pkg *pkg) bool {
|
||||
if _, want := refs[pkg.packageName]; !want {
|
||||
return false
|
||||
}
|
||||
if pkg.dir == s.srcDir && s.pkgName == pkg.packageName {
|
||||
// The candidate is in the same directory and has the
|
||||
// same package name. Don't try to import ourselves.
|
||||
return false
|
||||
}
|
||||
if !canUse(filename, pkg.dir) {
|
||||
return false
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
found[pkg.packageName] = append(found[pkg.packageName], pkgDistance{pkg, distance(s.srcDir, pkg.dir)})
|
||||
return false // We'll do our own loading after we sort.
|
||||
},
|
||||
}
|
||||
resolver, err := s.env.GetResolver()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := resolver.scan(ctx, callback); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
g, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
searcher := symbolSearcher{
|
||||
logf: s.env.logf,
|
||||
srcDir: s.srcDir,
|
||||
xtest: strings.HasSuffix(s.pkgName, "_test"),
|
||||
loadExports: resolver.loadExports,
|
||||
}
|
||||
|
||||
var resultMu sync.Mutex
|
||||
results := make(map[string]*Result, len(refs))
|
||||
for pkgName, symbols := range refs {
|
||||
g.Go(func() error {
|
||||
found, err := searcher.search(ctx, found[pkgName], pkgName, symbols)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if found == nil {
|
||||
return nil // No matching package.
|
||||
}
|
||||
|
||||
imp := &ImportInfo{
|
||||
ImportPath: found.importPathShort,
|
||||
}
|
||||
pkg := &PackageInfo{
|
||||
Name: pkgName,
|
||||
Exports: symbols,
|
||||
}
|
||||
resultMu.Lock()
|
||||
results[pkgName] = &Result{Import: imp, Package: pkg}
|
||||
resultMu.Unlock()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if err := g.Wait(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return results, nil
|
||||
}
|
18
vendor/modules.txt
vendored
18
vendor/modules.txt
vendored
@ -1,8 +1,8 @@
|
||||
# github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792
|
||||
## explicit; go 1.13
|
||||
github.com/ManyakRus/logrus
|
||||
# github.com/ManyakRus/starter v1.0.66
|
||||
## explicit; go 1.22.0
|
||||
# github.com/ManyakRus/starter v1.0.84
|
||||
## explicit; go 1.22.1
|
||||
github.com/ManyakRus/starter/config_main
|
||||
github.com/ManyakRus/starter/constants
|
||||
github.com/ManyakRus/starter/contextmain
|
||||
@ -81,26 +81,26 @@ github.com/otiai10/copy
|
||||
# github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e
|
||||
## explicit
|
||||
github.com/serenize/snaker
|
||||
# golang.org/x/crypto v0.28.0
|
||||
# golang.org/x/crypto v0.29.0
|
||||
## explicit; go 1.20
|
||||
golang.org/x/crypto/pbkdf2
|
||||
# golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
|
||||
# golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
|
||||
## explicit; go 1.22.0
|
||||
golang.org/x/exp/constraints
|
||||
# golang.org/x/mod v0.21.0
|
||||
# golang.org/x/mod v0.22.0
|
||||
## explicit; go 1.22.0
|
||||
golang.org/x/mod/internal/lazyregexp
|
||||
golang.org/x/mod/module
|
||||
golang.org/x/mod/semver
|
||||
# golang.org/x/sync v0.8.0
|
||||
# golang.org/x/sync v0.9.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sync/errgroup
|
||||
golang.org/x/sync/semaphore
|
||||
# golang.org/x/sys v0.26.0
|
||||
# golang.org/x/sys v0.27.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
# golang.org/x/text v0.19.0
|
||||
# golang.org/x/text v0.20.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/text/cases
|
||||
golang.org/x/text/internal
|
||||
@ -115,7 +115,7 @@ golang.org/x/text/transform
|
||||
golang.org/x/text/unicode/bidi
|
||||
golang.org/x/text/unicode/norm
|
||||
golang.org/x/text/width
|
||||
# golang.org/x/tools v0.26.0
|
||||
# golang.org/x/tools v0.27.0
|
||||
## explicit; go 1.22.0
|
||||
golang.org/x/tools/go/ast/astutil
|
||||
golang.org/x/tools/imports
|
||||
|
Loading…
Reference in New Issue
Block a user