fix #479: update go-critic to fix deps
This update should fix go get issues because of deps. go-critic: $ git cherry -v c3db6069acc5 + fe28ac328f474c02e2383ca2bf44a606929a7048 checkers: add integration tests with cgo for dupImports (#846) + 48a15b03b630252319474ba5ddc8455d2aebf34f checkers: fix fold-ranges for floats in boolExprSimplify (#849) + 7bf73388643eb226addf2d5ed8a2c104be244b2e checkers: fix "Output:" false positive in commentedOutCode (#852) + f6f702b31734df26415c2bd135f272d1a34d2973 checkers: extend yodaStyleExpr supported ops list (#856) + 07bf84df361735ad1d90f84e79eb60c8386325c7 fix dependencies (#857) + 1df30086654074503eab008bdde4f3ce1921128d checkers: fix collection URL (#860) x/tools: $ git cherry -v 685fecacd0a0 521d6ed310dd | fgrep -v internal/lsp + fe54fb35175bb1c0c175e2335e23d7fa90ca987a apidiff: represent a Report as a list of Changes + 15bbd99efc6f20619676dec93f914d12e5139e83 all: run go mod tidy + bb3b3ca95aec36bfc4a5cb10b58022e64aca735b go/packages: add some documentation for extractPackage + 4bf14f7f0668366a4275c6ef5e99bd8e807da1d3 internal/span: fix off-by-one in ToUTF16Column + cb2dda6eabdf9160e66ca7293897f984154a7f8b go/packages: deduplicate file parsing + 9e44c1c403071e0c2831952513e7b948587d94af go/internal/gccgoimporter: update package to match std lib version + 36563e24a2627da92566d43aa1c7a2dd895fc60d cmd/vet: verify potentially-recursive Stringers are actually Stringers + 31fd60d6bfdcfb2861856aa5b333bb135f6bbfd8 x/tools/go/packages/packagestest: fix GOPROXY file URLs for Windows + 2d660fb8a000e1c288dc2f2150401b364922ebe9 go/packages/packagestest: fix GOPROXY file URLs for Windows + 7af746645d5165109de0b5cb499980c22812dfc2 internal/span: fix another off-by-one in ToUTF16Column + 9d4d845e86f14303813298ede731a971dd65b593 cmd/goimports: add -format-only flag + 83df196e5764ed2415c28c1f39ba6cb3db747da0 internal/span: add a filename only print for spans + 5cec639030af3a6ada2732d9bfa1d3731ed55106 go/analysis: proposed fact enumeration API + 9cb3dcf692a103de0fd68c26f4f04183e0933f7c internal/span: update the offset if the end offset should be valid but is not + 2d16b83fe98cd1bed9e2ce9fdc86bd438d14aab7 go/vcs: ignore "mod" VCS type + 95299016986435f846545c27f956768ad3c3cb2f lostcancel: do not analyze cancel variable which defined outside current function scope + 8a42e17289ea392d63892321ce1f40bd07efcc9f compilebench: clean up different benchmark types + eeb76a0c47a3b97e99f330dc14174ef14777d2ba compilebench: factor running build tool commands + 60140f09094406e46618ef436a26dd8394983503 compilebench: add a linker benchmark + e31d36578abb3d202c4007c3747bf8ebb7c51011 compilebench: handle missing MemStats more gracefully + d996b19ee77cd9c8df974510f23b0696cedf1ca1 go/analysis/analysistest: fix word usage + 73554e0f78058c37e5421bc48273a72400172221 go/analysis/passes: fix bugs discovered in std + 35884eef200b5fc81c9044f644a8d9d911262488 cmd/vet: print help to stdout only + 45e43b2cb4facd370abb846ebf35575161849f3b go/packages/packagestest: fix MustCopyFileTree so that file fragments are always slash form + d81a07b7e58487eed036bf115fa834653590d6cd go/analysis/passes/bools: eliminate quadratic runtime, output + 2a413a02cc735933997fa1b467a7b27bc1b82567 godoc/static: let client use vet check returned by /compile endpoint + 4789ca9922f080dd3a8fc3c74df1c1306db2bb0b go/analysis/internal/analysisflags: call gob.Register on deleted analyzers + d1a3278ee74994e9aa609e9e711c616bba677d5d godoc/util: serve SVG files raw + 1da8801a9502f29f3f03edfc3149b947e6e1913c godoc: declare small victory over the punched card tyranny + 757ca719ca9689950c69081c10c5300fbb8e35db imports: rename to internal/imports + 0133cac3176f225883c5d817146de8633ed07ebc cmd/goimports: reuse cached state + 26647e34d3c04fd3eaef6fb824493b00af7b1b26 imports: allow nil Options in Process
This commit is contained in:
parent
c92a7a30ae
commit
7274db714c
4
go.mod
4
go.mod
@ -5,7 +5,7 @@ require (
|
||||
github.com/OpenPeeDeeP/depguard v0.0.0-20180806142446-a69c782687b2
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||
github.com/fatih/color v1.6.0
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-c3db6069acc5
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540
|
||||
github.com/go-lintpack/lintpack v0.5.2
|
||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
@ -54,7 +54,7 @@ require (
|
||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
|
||||
golang.org/x/net v0.0.0-20190313220215-9f648a60d977 // indirect
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect
|
||||
golang.org/x/tools v0.0.0-20190420000508-685fecacd0a0
|
||||
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
|
||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.1
|
||||
|
41
go.sum
41
go.sum
@ -2,7 +2,6 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/OpenPeeDeeP/depguard v0.0.0-20180806142446-a69c782687b2 h1:HTOmFEEYrWi4MW5ZKUx6xfeyM10Sx3kQF65xiQJMPYA=
|
||||
github.com/OpenPeeDeeP/depguard v0.0.0-20180806142446-a69c782687b2/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o=
|
||||
github.com/Quasilyte/go-consistent v0.0.0-20181230194409-8f8379e70f99/go.mod h1:ds1OLa3HF2x4OGKCx0pNTVL1s9Ii/2mT0Bg/8PtW6AM=
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@ -11,29 +10,37 @@ github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU=
|
||||
github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-c3db6069acc5 h1:+7jr1oKB2or53kzZk2gwPbTa+Bo/rjSmdSIIlKmcSos=
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-c3db6069acc5/go.mod h1:Jc75BZJv2dNy7opKH6bF29VveDQHfGZ6Asn/3phBesg=
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540 h1:7CU1IXBpPvxpQ/NqJrpuMXMHAw+FB2vfqtRF8tgW9fw=
|
||||
github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA=
|
||||
github.com/go-lintpack/lintpack v0.5.2 h1:DI5mA3+eKdWeJ40nU4d6Wc26qmdG8RCi/btYq0TuRN0=
|
||||
github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM=
|
||||
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
|
||||
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
||||
github.com/go-toolsmith/astcast v0.0.0-20181028201508-b7a89ed70af1 h1:h+1eMw+tZAlgTVclcVN0/rdPaBI/RUzG0peblT6df+Q=
|
||||
github.com/go-toolsmith/astcast v0.0.0-20181028201508-b7a89ed70af1/go.mod h1:TEo3Ghaj7PsZawQHxT/oBvo4HK/sl1RcuUHDKTTju+o=
|
||||
github.com/go-toolsmith/astcopy v0.0.0-20180903214859-79b422d080c4 h1:wVs9OMjICHbAryp9hcIuWqUOi+NqEbUSZy9zMe3W//I=
|
||||
github.com/go-toolsmith/astcopy v0.0.0-20180903214859-79b422d080c4/go.mod h1:c9CPdq2AzM8oPomdlPniEfPAC6g1s7NqZzODt8y6ib8=
|
||||
github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g=
|
||||
github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4=
|
||||
github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8=
|
||||
github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ=
|
||||
github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6 h1:aTBUNRTatDDU24gbOEKEoLiDwxtc98ga6K/iMTm6fvs=
|
||||
github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086 h1:EIMuvbE9fbtQtimdLe5yeXjuC5CeKbQt8zH6GwtIrhM=
|
||||
github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg=
|
||||
github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k=
|
||||
github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw=
|
||||
github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU=
|
||||
github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30 h1:zRJPftZJNLPDiOtvYbFRwjSbaJAcVOf80TeEmWGe2kQ=
|
||||
github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk=
|
||||
github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg=
|
||||
github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI=
|
||||
github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8 h1:vVouagbdmqTVlCIAxpyYsNNTbkKZ3V66VpKOLU/s6W4=
|
||||
github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks=
|
||||
github.com/go-toolsmith/strparse v0.0.0-20180903215201-830b6daa1241 h1:ZRDeQioMGTBLeJxcPxXfFifEUgYxzR7fXw7w2WR+1bo=
|
||||
github.com/go-toolsmith/strparse v0.0.0-20180903215201-830b6daa1241/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
||||
github.com/go-toolsmith/typep v0.0.0-20181030061450-d63dc7650676 h1:6Qrsp0+25KEkaS2bB26UE0giFgRrIc8mYXboDL5OVMA=
|
||||
github.com/go-toolsmith/typep v0.0.0-20181030061450-d63dc7650676/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU=
|
||||
github.com/go-toolsmith/pkgload v1.0.0 h1:4DFWWMXVfbcN5So1sBNW9+yeiMqLFGl1wFLTL5R0Tgg=
|
||||
github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc=
|
||||
github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
|
||||
github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
||||
github.com/go-toolsmith/typep v1.0.0 h1:zKymWyA1TRYvqYrYDrfEMZULyrhcnGY3x7LDKU2XQaA=
|
||||
github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU=
|
||||
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
||||
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
|
||||
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
||||
@ -76,7 +83,6 @@ github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSW
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 h1:JVnpOZS+qxli+rgVl98ILOXVNbW+kb5wcxeGx8ShUIw=
|
||||
github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE=
|
||||
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno=
|
||||
@ -121,13 +127,13 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
|
||||
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.1.0 h1:cmiOvKzEunMsAxyhXSzpL5Q1CRKpVv0KQsnAIcSEVYM=
|
||||
github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI=
|
||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
|
||||
github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7 h1:80VN+vGkqM773Br/uNNTSheo3KatTgV8IpjIKjvVLng=
|
||||
@ -176,6 +182,8 @@ golang.org/x/net v0.0.0-20190313220215-9f648a60d977 h1:actzWV6iWn3GLqN8dZjzsB+CL
|
||||
golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -187,15 +195,14 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181024171208-a2dc47679d30/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181205014116-22934f0fdb62/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190121143147-24cd39ecf745/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190420000508-685fecacd0a0 h1:pa1CyBALPFjblgkNQp7T7gEcFcG/GOG5Ck8IcnSVWGs=
|
||||
golang.org/x/tools v0.0.0-20190420000508-685fecacd0a0/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd h1:7E3PabyysDSEjnaANKBgums/hyvMI/HoHQ50qZEzTrg=
|
||||
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
4
vendor/github.com/go-critic/go-critic/checkers/boolExprSimplify_checker.go
generated
vendored
4
vendor/github.com/go-critic/go-critic/checkers/boolExprSimplify_checker.go
generated
vendored
@ -235,6 +235,10 @@ func (c *boolExprSimplifyChecker) removeIncDec(cur *astutil.Cursor) bool {
|
||||
}
|
||||
|
||||
func (c *boolExprSimplifyChecker) foldRanges(cur *astutil.Cursor) bool {
|
||||
if c.hasFloats { // See #848
|
||||
return false
|
||||
}
|
||||
|
||||
e, ok := cur.Node().(*ast.BinaryExpr)
|
||||
if !ok {
|
||||
return false
|
||||
|
2
vendor/github.com/go-critic/go-critic/checkers/checkers.go
generated
vendored
2
vendor/github.com/go-critic/go-critic/checkers/checkers.go
generated
vendored
@ -6,5 +6,5 @@ import (
|
||||
)
|
||||
|
||||
var collection = &lintpack.CheckerCollection{
|
||||
URL: "https://github.com/go-critic/checkers",
|
||||
URL: "https://github.com/go-critic/go-critic/checkers",
|
||||
}
|
||||
|
24
vendor/github.com/go-critic/go-critic/checkers/commentedOutCode_checker.go
generated
vendored
24
vendor/github.com/go-critic/go-critic/checkers/commentedOutCode_checker.go
generated
vendored
@ -33,10 +33,16 @@ foo(1, 2)`
|
||||
type commentedOutCodeChecker struct {
|
||||
astwalk.WalkHandler
|
||||
ctx *lintpack.CheckerContext
|
||||
fn *ast.FuncDecl
|
||||
|
||||
notQuiteFuncCall *regexp.Regexp
|
||||
}
|
||||
|
||||
func (c *commentedOutCodeChecker) EnterFunc(fn *ast.FuncDecl) bool {
|
||||
c.fn = fn // Need to store current function inside checker context
|
||||
return fn.Body != nil
|
||||
}
|
||||
|
||||
func (c *commentedOutCodeChecker) VisitLocalComment(cg *ast.CommentGroup) {
|
||||
s := cg.Text() // Collect text once
|
||||
|
||||
@ -93,7 +99,12 @@ func (c *commentedOutCodeChecker) VisitLocalComment(cg *ast.CommentGroup) {
|
||||
return
|
||||
}
|
||||
|
||||
// Add parentheses to make block statement from
|
||||
// Some attempts to avoid false positives.
|
||||
if c.skipBlock(s) {
|
||||
return
|
||||
}
|
||||
|
||||
// Add braces to make block statement from
|
||||
// multiple statements.
|
||||
stmt = strparse.Stmt(fmt.Sprintf("{ %s }", s))
|
||||
|
||||
@ -102,6 +113,17 @@ func (c *commentedOutCodeChecker) VisitLocalComment(cg *ast.CommentGroup) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *commentedOutCodeChecker) skipBlock(s string) bool {
|
||||
lines := strings.Split(s, "\n") // There is at least 1 line, that's invariant
|
||||
|
||||
// Special example test block.
|
||||
if isExampleTestFunc(c.fn) && strings.Contains(lines[0], "Output:") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *commentedOutCodeChecker) isPermittedStmt(stmt ast.Stmt) bool {
|
||||
switch stmt := stmt.(type) {
|
||||
case *ast.ExprStmt:
|
||||
|
5
vendor/github.com/go-critic/go-critic/checkers/utils.go
generated
vendored
5
vendor/github.com/go-critic/go-critic/checkers/utils.go
generated
vendored
@ -241,6 +241,11 @@ func isStdlibPkg(pkg *types.Package) bool {
|
||||
return pkg != nil && goStdlib[pkg.Path()]
|
||||
}
|
||||
|
||||
// isExampleTestFunc reports whether FuncDecl looks like a testable example function.
|
||||
func isExampleTestFunc(fn *ast.FuncDecl) bool {
|
||||
return len(fn.Type.Params.List) == 0 && strings.HasPrefix(fn.Name.String(), "Example")
|
||||
}
|
||||
|
||||
// isUnitTestFunc reports whether FuncDecl declares testing function.
|
||||
func isUnitTestFunc(ctx *lintpack.CheckerContext, fn *ast.FuncDecl) bool {
|
||||
if !strings.HasPrefix(fn.Name.Name, "Test") {
|
||||
|
19
vendor/github.com/go-critic/go-critic/checkers/yodaStyleExpr_checker.go
generated
vendored
19
vendor/github.com/go-critic/go-critic/checkers/yodaStyleExpr_checker.go
generated
vendored
@ -33,7 +33,8 @@ func (c *yodaStyleExprChecker) VisitLocalExpr(expr ast.Expr) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if binexpr.Op == token.EQL || binexpr.Op == token.NEQ {
|
||||
switch binexpr.Op {
|
||||
case token.EQL, token.NEQ, token.LSS, token.LEQ, token.GEQ, token.GTR:
|
||||
if c.isConstExpr(binexpr.X) && !c.isConstExpr(binexpr.Y) {
|
||||
c.warn(binexpr)
|
||||
}
|
||||
@ -44,8 +45,22 @@ func (c *yodaStyleExprChecker) isConstExpr(expr ast.Expr) bool {
|
||||
return qualifiedName(expr) == "nil" || astp.IsBasicLit(expr)
|
||||
}
|
||||
|
||||
func (c *yodaStyleExprChecker) invert(expr *ast.BinaryExpr) {
|
||||
expr.X, expr.Y = expr.Y, expr.X
|
||||
switch expr.Op {
|
||||
case token.LSS:
|
||||
expr.Op = token.GEQ
|
||||
case token.LEQ:
|
||||
expr.Op = token.GTR
|
||||
case token.GEQ:
|
||||
expr.Op = token.LSS
|
||||
case token.GTR:
|
||||
expr.Op = token.LEQ
|
||||
}
|
||||
}
|
||||
|
||||
func (c *yodaStyleExprChecker) warn(expr *ast.BinaryExpr) {
|
||||
e := astcopy.BinaryExpr(expr)
|
||||
e.X, e.Y = e.Y, e.X
|
||||
c.invert(e)
|
||||
c.ctx.Warn(expr, "consider to change order in expression to %s", e)
|
||||
}
|
||||
|
9
vendor/github.com/go-toolsmith/astcast/.travis.yml
generated
vendored
Normal file
9
vendor/github.com/go-toolsmith/astcast/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.x
|
||||
install:
|
||||
- # Prevent default install action "go get -t -v ./...".
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go tool vet .
|
||||
- go test -v -race ./...
|
6
vendor/github.com/go-toolsmith/astcast/go.mod
generated
vendored
Normal file
6
vendor/github.com/go-toolsmith/astcast/go.mod
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
module github.com/go-toolsmith/astcast
|
||||
|
||||
require (
|
||||
github.com/go-toolsmith/astequal v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0
|
||||
)
|
4
vendor/github.com/go-toolsmith/astcast/go.sum
generated
vendored
Normal file
4
vendor/github.com/go-toolsmith/astcast/go.sum
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
|
||||
github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
5
vendor/github.com/go-toolsmith/astcopy/go.mod
generated
vendored
5
vendor/github.com/go-toolsmith/astcopy/go.mod
generated
vendored
@ -1 +1,6 @@
|
||||
module github.com/go-toolsmith/astcopy
|
||||
|
||||
require (
|
||||
github.com/go-toolsmith/astequal v1.0.0
|
||||
github.com/go-toolsmith/strparse v1.0.0
|
||||
)
|
||||
|
4
vendor/github.com/go-toolsmith/astcopy/go.sum
generated
vendored
Normal file
4
vendor/github.com/go-toolsmith/astcopy/go.sum
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
|
||||
github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
9
vendor/github.com/go-toolsmith/astfmt/.travis.yml
generated
vendored
Normal file
9
vendor/github.com/go-toolsmith/astfmt/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.x
|
||||
install:
|
||||
- # Prevent default install action "go get -t -v ./...".
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go tool vet .
|
||||
- go test -v -race ./...
|
5
vendor/github.com/go-toolsmith/astfmt/go.mod
generated
vendored
5
vendor/github.com/go-toolsmith/astfmt/go.mod
generated
vendored
@ -1 +1,6 @@
|
||||
module github.com/go-toolsmith/astfmt
|
||||
|
||||
require (
|
||||
github.com/go-toolsmith/astequal v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0
|
||||
)
|
||||
|
4
vendor/github.com/go-toolsmith/astfmt/go.sum
generated
vendored
Normal file
4
vendor/github.com/go-toolsmith/astfmt/go.sum
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
|
||||
github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
5
vendor/github.com/go-toolsmith/astp/go.mod
generated
vendored
5
vendor/github.com/go-toolsmith/astp/go.mod
generated
vendored
@ -1 +1,6 @@
|
||||
module github.com/go-toolsmith/astp
|
||||
|
||||
require (
|
||||
github.com/go-toolsmith/astequal v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0
|
||||
)
|
||||
|
4
vendor/github.com/go-toolsmith/astp/go.sum
generated
vendored
Normal file
4
vendor/github.com/go-toolsmith/astp/go.sum
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
|
||||
github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
|
9
vendor/github.com/go-toolsmith/typep/.travis.yml
generated
vendored
Normal file
9
vendor/github.com/go-toolsmith/typep/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.x
|
||||
install:
|
||||
- # Prevent default install action "go get -t -v ./...".
|
||||
script:
|
||||
- go get -t -v ./...
|
||||
- go tool vet .
|
||||
- go test -v -race ./...
|
1
vendor/github.com/go-toolsmith/typep/go.mod
generated
vendored
Normal file
1
vendor/github.com/go-toolsmith/typep/go.mod
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module github.com/go-toolsmith/typep
|
22
vendor/golang.org/x/tools/go/analysis/analysis.go
generated
vendored
22
vendor/golang.org/x/tools/go/analysis/analysis.go
generated
vendored
@ -128,10 +128,32 @@ type Pass struct {
|
||||
// See comments for ExportObjectFact.
|
||||
ExportPackageFact func(fact Fact)
|
||||
|
||||
// AllPackageFacts returns a new slice containing all package facts in unspecified order.
|
||||
// WARNING: This is an experimental API and may change in the future.
|
||||
AllPackageFacts func() []PackageFact
|
||||
|
||||
// AllObjectFacts returns a new slice containing all object facts in unspecified order.
|
||||
// WARNING: This is an experimental API and may change in the future.
|
||||
AllObjectFacts func() []ObjectFact
|
||||
|
||||
/* Further fields may be added in future. */
|
||||
// For example, suggested or applied refactorings.
|
||||
}
|
||||
|
||||
// PackageFact is a package together with an associated fact.
|
||||
// WARNING: This is an experimental API and may change in the future.
|
||||
type PackageFact struct {
|
||||
Package *types.Package
|
||||
Fact Fact
|
||||
}
|
||||
|
||||
// ObjectFact is an object together with an associated fact.
|
||||
// WARNING: This is an experimental API and may change in the future.
|
||||
type ObjectFact struct {
|
||||
Object types.Object
|
||||
Fact Fact
|
||||
}
|
||||
|
||||
// Reportf is a helper function that reports a Diagnostic using the
|
||||
// specified position and formatted error message.
|
||||
func (pass *Pass) Reportf(pos token.Pos, format string, args ...interface{}) {
|
||||
|
36
vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
generated
vendored
36
vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
generated
vendored
@ -130,7 +130,7 @@ var (
|
||||
asmPlusBuild = re(`//\s+\+build\s+([^\n]+)`)
|
||||
asmTEXT = re(`\bTEXT\b(.*)·([^\(]+)\(SB\)(?:\s*,\s*([0-9A-Z|+()]+))?(?:\s*,\s*\$(-?[0-9]+)(?:-([0-9]+))?)?`)
|
||||
asmDATA = re(`\b(DATA|GLOBL)\b`)
|
||||
asmNamedFP = re(`([a-zA-Z0-9_\xFF-\x{10FFFF}]+)(?:\+([0-9]+))\(FP\)`)
|
||||
asmNamedFP = re(`\$?([a-zA-Z0-9_\xFF-\x{10FFFF}]+)(?:\+([0-9]+))\(FP\)`)
|
||||
asmUnnamedFP = re(`[^+\-0-9](([0-9]+)\(FP\))`)
|
||||
asmSP = re(`[^+\-0-9](([0-9]+)\(([A-Z0-9]+)\))`)
|
||||
asmOpcode = re(`^\s*(?:[A-Z0-9a-z_]+:)?\s*([A-Z]+)\s*([^,]*)(?:,\s*(.*))?`)
|
||||
@ -184,6 +184,7 @@ Files:
|
||||
fnName string
|
||||
localSize, argSize int
|
||||
wroteSP bool
|
||||
noframe bool
|
||||
haveRetArg bool
|
||||
retLine []int
|
||||
)
|
||||
@ -231,6 +232,11 @@ Files:
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore comments and commented-out code.
|
||||
if i := strings.Index(line, "//"); i >= 0 {
|
||||
line = line[:i]
|
||||
}
|
||||
|
||||
if m := asmTEXT.FindStringSubmatch(line); m != nil {
|
||||
flushRet()
|
||||
if arch == "" {
|
||||
@ -254,7 +260,7 @@ Files:
|
||||
// identifiers to represent the directory separator.
|
||||
pkgPath = strings.Replace(pkgPath, "∕", "/", -1)
|
||||
if pkgPath != pass.Pkg.Path() {
|
||||
log.Printf("%s:%d: [%s] cannot check cross-package assembly function: %s is in package %s", fname, lineno, arch, fnName, pkgPath)
|
||||
// log.Printf("%s:%d: [%s] cannot check cross-package assembly function: %s is in package %s", fname, lineno, arch, fnName, pkgPath)
|
||||
fn = nil
|
||||
fnName = ""
|
||||
continue
|
||||
@ -275,7 +281,8 @@ Files:
|
||||
localSize += archDef.intSize
|
||||
}
|
||||
argSize, _ = strconv.Atoi(m[5])
|
||||
if fn == nil && !strings.Contains(fnName, "<>") {
|
||||
noframe = strings.Contains(flag, "NOFRAME")
|
||||
if fn == nil && !strings.Contains(fnName, "<>") && !noframe {
|
||||
badf("function %s missing Go declaration", fnName)
|
||||
}
|
||||
wroteSP = false
|
||||
@ -305,13 +312,18 @@ Files:
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.Contains(line, ", "+archDef.stack) || strings.Contains(line, ",\t"+archDef.stack) {
|
||||
if strings.Contains(line, ", "+archDef.stack) || strings.Contains(line, ",\t"+archDef.stack) || strings.Contains(line, "NOP "+archDef.stack) || strings.Contains(line, "NOP\t"+archDef.stack) {
|
||||
wroteSP = true
|
||||
continue
|
||||
}
|
||||
|
||||
if arch == "wasm" && strings.Contains(line, "CallImport") {
|
||||
// CallImport is a call out to magic that can write the result.
|
||||
haveRetArg = true
|
||||
}
|
||||
|
||||
for _, m := range asmSP.FindAllStringSubmatch(line, -1) {
|
||||
if m[3] != archDef.stack || wroteSP {
|
||||
if m[3] != archDef.stack || wroteSP || noframe {
|
||||
continue
|
||||
}
|
||||
off := 0
|
||||
@ -371,7 +383,7 @@ Files:
|
||||
}
|
||||
continue
|
||||
}
|
||||
asmCheckVar(badf, fn, line, m[0], off, v)
|
||||
asmCheckVar(badf, fn, line, m[0], off, v, archDef)
|
||||
}
|
||||
}
|
||||
flushRet()
|
||||
@ -589,7 +601,7 @@ func asmParseDecl(pass *analysis.Pass, decl *ast.FuncDecl) map[string]*asmFunc {
|
||||
}
|
||||
|
||||
// asmCheckVar checks a single variable reference.
|
||||
func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr string, off int, v *asmVar) {
|
||||
func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr string, off int, v *asmVar, archDef *asmArch) {
|
||||
m := asmOpcode.FindStringSubmatch(line)
|
||||
if m == nil {
|
||||
if !strings.HasPrefix(strings.TrimSpace(line), "//") {
|
||||
@ -598,6 +610,8 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
||||
return
|
||||
}
|
||||
|
||||
addr := strings.HasPrefix(expr, "$")
|
||||
|
||||
// Determine operand sizes from instruction.
|
||||
// Typically the suffix suffices, but there are exceptions.
|
||||
var src, dst, kind asmKind
|
||||
@ -617,10 +631,13 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
||||
// They just take the address of it.
|
||||
case "386.LEAL":
|
||||
dst = 4
|
||||
addr = true
|
||||
case "amd64.LEAQ":
|
||||
dst = 8
|
||||
addr = true
|
||||
case "amd64p32.LEAL":
|
||||
dst = 4
|
||||
addr = true
|
||||
default:
|
||||
switch fn.arch.name {
|
||||
case "386", "amd64":
|
||||
@ -725,6 +742,11 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
||||
vs = v.inner[0].size
|
||||
vt = v.inner[0].typ
|
||||
}
|
||||
if addr {
|
||||
vk = asmKind(archDef.ptrSize)
|
||||
vs = archDef.ptrSize
|
||||
vt = "address"
|
||||
}
|
||||
|
||||
if off != v.off {
|
||||
var inner bytes.Buffer
|
||||
|
21
vendor/golang.org/x/tools/go/analysis/passes/bools/bools.go
generated
vendored
21
vendor/golang.org/x/tools/go/analysis/passes/bools/bools.go
generated
vendored
@ -30,8 +30,13 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
||||
nodeFilter := []ast.Node{
|
||||
(*ast.BinaryExpr)(nil),
|
||||
}
|
||||
seen := make(map[*ast.BinaryExpr]bool)
|
||||
inspect.Preorder(nodeFilter, func(n ast.Node) {
|
||||
e := n.(*ast.BinaryExpr)
|
||||
if seen[e] {
|
||||
// Already processed as a subexpression of an earlier node.
|
||||
return
|
||||
}
|
||||
|
||||
var op boolOp
|
||||
switch e.Op {
|
||||
@ -43,10 +48,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO(adonovan): this reports n(n-1)/2 errors for an
|
||||
// expression e||...||e of depth n. Fix.
|
||||
// See https://golang.org/issue/28086.
|
||||
comm := op.commutativeSets(pass.TypesInfo, e)
|
||||
comm := op.commutativeSets(pass.TypesInfo, e, seen)
|
||||
for _, exprs := range comm {
|
||||
op.checkRedundant(pass, exprs)
|
||||
op.checkSuspect(pass, exprs)
|
||||
@ -70,8 +72,9 @@ var (
|
||||
// expressions in e that are connected by op.
|
||||
// For example, given 'a || b || f() || c || d' with the or op,
|
||||
// commutativeSets returns {{b, a}, {d, c}}.
|
||||
func (op boolOp) commutativeSets(info *types.Info, e *ast.BinaryExpr) [][]ast.Expr {
|
||||
exprs := op.split(e)
|
||||
// commutativeSets adds any expanded BinaryExprs to seen.
|
||||
func (op boolOp) commutativeSets(info *types.Info, e *ast.BinaryExpr, seen map[*ast.BinaryExpr]bool) [][]ast.Expr {
|
||||
exprs := op.split(e, seen)
|
||||
|
||||
// Partition the slice of expressions into commutative sets.
|
||||
i := 0
|
||||
@ -188,11 +191,13 @@ func hasSideEffects(info *types.Info, e ast.Expr) bool {
|
||||
// split returns a slice of all subexpressions in e that are connected by op.
|
||||
// For example, given 'a || (b || c) || d' with the or op,
|
||||
// split returns []{d, c, b, a}.
|
||||
func (op boolOp) split(e ast.Expr) (exprs []ast.Expr) {
|
||||
// seen[e] is already true; any newly processed exprs are added to seen.
|
||||
func (op boolOp) split(e ast.Expr, seen map[*ast.BinaryExpr]bool) (exprs []ast.Expr) {
|
||||
for {
|
||||
e = unparen(e)
|
||||
if b, ok := e.(*ast.BinaryExpr); ok && b.Op == op.tok {
|
||||
exprs = append(exprs, op.split(b.Y)...)
|
||||
seen[b] = true
|
||||
exprs = append(exprs, op.split(b.Y, seen)...)
|
||||
e = b.X
|
||||
} else {
|
||||
exprs = append(exprs, e)
|
||||
|
15
vendor/golang.org/x/tools/go/analysis/passes/lostcancel/lostcancel.go
generated
vendored
15
vendor/golang.org/x/tools/go/analysis/passes/lostcancel/lostcancel.go
generated
vendored
@ -45,6 +45,8 @@ var contextPackage = "context"
|
||||
// control-flow path from the call to a return statement and that path
|
||||
// does not "use" the cancel function. Any reference to the variable
|
||||
// counts as a use, even within a nested function literal.
|
||||
// If the variable's scope is larger than the function
|
||||
// containing the assignment, we assume that other uses exist.
|
||||
//
|
||||
// checkLostCancel analyzes a single named or literal function.
|
||||
func run(pass *analysis.Pass) (interface{}, error) {
|
||||
@ -66,6 +68,15 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
||||
}
|
||||
|
||||
func runFunc(pass *analysis.Pass, node ast.Node) {
|
||||
// Find scope of function node
|
||||
var funcScope *types.Scope
|
||||
switch v := node.(type) {
|
||||
case *ast.FuncLit:
|
||||
funcScope = pass.TypesInfo.Scopes[v.Type]
|
||||
case *ast.FuncDecl:
|
||||
funcScope = pass.TypesInfo.Scopes[v.Type]
|
||||
}
|
||||
|
||||
// Maps each cancel variable to its defining ValueSpec/AssignStmt.
|
||||
cancelvars := make(map[*types.Var]ast.Node)
|
||||
|
||||
@ -114,7 +125,11 @@ func runFunc(pass *analysis.Pass, node ast.Node) {
|
||||
"the cancel function returned by context.%s should be called, not discarded, to avoid a context leak",
|
||||
n.(*ast.SelectorExpr).Sel.Name)
|
||||
} else if v, ok := pass.TypesInfo.Uses[id].(*types.Var); ok {
|
||||
// If the cancel variable is defined outside function scope,
|
||||
// do not analyze it.
|
||||
if funcScope.Contains(v.Pos()) {
|
||||
cancelvars[v] = stmt
|
||||
}
|
||||
} else if v, ok := pass.TypesInfo.Defs[id].(*types.Var); ok {
|
||||
cancelvars[v] = stmt
|
||||
}
|
||||
|
16
vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
16
vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
@ -856,20 +856,28 @@ func recursiveStringer(pass *analysis.Pass, e ast.Expr) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Is it the receiver r, or &r?
|
||||
recv := stringMethod.Type().(*types.Signature).Recv()
|
||||
if recv == nil {
|
||||
sig := stringMethod.Type().(*types.Signature)
|
||||
if !isStringer(sig) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Is it the receiver r, or &r?
|
||||
if u, ok := e.(*ast.UnaryExpr); ok && u.Op == token.AND {
|
||||
e = u.X // strip off & from &r
|
||||
}
|
||||
if id, ok := e.(*ast.Ident); ok {
|
||||
return pass.TypesInfo.Uses[id] == recv
|
||||
return pass.TypesInfo.Uses[id] == sig.Recv()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// isStringer reports whether the method signature matches the String() definition in fmt.Stringer.
|
||||
func isStringer(sig *types.Signature) bool {
|
||||
return sig.Params().Len() == 0 &&
|
||||
sig.Results().Len() == 1 &&
|
||||
sig.Results().At(0).Type() == types.Typ[types.String]
|
||||
}
|
||||
|
||||
// isFunctionValue reports whether the expression is a function as opposed to a function call.
|
||||
// It is almost always a mistake to print a function value.
|
||||
func isFunctionValue(pass *analysis.Pass, e ast.Expr) bool {
|
||||
|
7
vendor/golang.org/x/tools/go/analysis/passes/stdmethods/stdmethods.go
generated
vendored
7
vendor/golang.org/x/tools/go/analysis/passes/stdmethods/stdmethods.go
generated
vendored
@ -116,6 +116,13 @@ func canonicalMethod(pass *analysis.Pass, id *ast.Ident) {
|
||||
args := sign.Params()
|
||||
results := sign.Results()
|
||||
|
||||
// Special case: WriteTo with more than one argument,
|
||||
// not trying at all to implement io.WriterTo,
|
||||
// comes up often enough to skip.
|
||||
if id.Name == "WriteTo" && args.Len() > 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// Do the =s (if any) all match?
|
||||
if !matchParams(pass, expect.args, args, "=") || !matchParams(pass, expect.results, results, "=") {
|
||||
return
|
||||
|
7
vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
generated
vendored
7
vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
generated
vendored
@ -56,6 +56,13 @@ var checkTagSpaces = map[string]bool{"json": true, "xml": true, "asn1": true}
|
||||
|
||||
// checkCanonicalFieldTag checks a single struct field tag.
|
||||
func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, seen *map[[2]string]token.Pos) {
|
||||
switch pass.Pkg.Path() {
|
||||
case "encoding/json", "encoding/xml":
|
||||
// These packages know how to use their own APIs.
|
||||
// Sometimes they are testing what happens to incorrect programs.
|
||||
return
|
||||
}
|
||||
|
||||
for _, key := range checkTagDups {
|
||||
checkTagDuplicates(pass, tag, key, field, field, seen)
|
||||
}
|
||||
|
7
vendor/golang.org/x/tools/go/analysis/passes/unmarshal/unmarshal.go
generated
vendored
7
vendor/golang.org/x/tools/go/analysis/passes/unmarshal/unmarshal.go
generated
vendored
@ -29,6 +29,13 @@ var Analyzer = &analysis.Analyzer{
|
||||
}
|
||||
|
||||
func run(pass *analysis.Pass) (interface{}, error) {
|
||||
switch pass.Pkg.Path() {
|
||||
case "encoding/gob", "encoding/json", "encoding/xml":
|
||||
// These packages know how to use their own APIs.
|
||||
// Sometimes they are testing what happens to incorrect programs.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
|
||||
|
||||
nodeFilter := []ast.Node{
|
||||
|
7
vendor/golang.org/x/tools/go/packages/golist_overlay.go
generated
vendored
7
vendor/golang.org/x/tools/go/packages/golist_overlay.go
generated
vendored
@ -105,6 +105,10 @@ func extractImports(filename string, contents []byte) ([]string, error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// extractPackage attempts to extract a package defined in an overlay.
|
||||
//
|
||||
// If the package has errors and has no Name, GoFiles, or Imports,
|
||||
// then it's possible that it doesn't yet exist on disk.
|
||||
func extractPackage(pkg *Package, filename string, contents []byte) bool {
|
||||
// TODO(rstambler): Check the message of the actual error?
|
||||
// It differs between $GOPATH and module mode.
|
||||
@ -124,10 +128,11 @@ func extractPackage(pkg *Package, filename string, contents []byte) bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
// TODO(rstambler): This doesn't work for main packages.
|
||||
if filepath.Base(pkg.PkgPath) != f.Name.Name {
|
||||
return false
|
||||
}
|
||||
pkg.Name = f.Name.Name
|
||||
pkg.Errors = []Error{}
|
||||
pkg.Errors = nil
|
||||
return true
|
||||
}
|
||||
|
73
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
73
vendor/golang.org/x/tools/go/packages/packages.go
generated
vendored
@ -419,6 +419,8 @@ type loader struct {
|
||||
pkgs map[string]*loaderPackage
|
||||
Config
|
||||
sizes types.Sizes
|
||||
parseCache map[string]*parseValue
|
||||
parseCacheMu sync.Mutex
|
||||
exportMu sync.Mutex // enforces mutual exclusion of exportdata operations
|
||||
|
||||
// TODO(matloob): Add an implied mode here and use that instead of mode.
|
||||
@ -428,8 +430,16 @@ type loader struct {
|
||||
// where we need certain modes right.
|
||||
}
|
||||
|
||||
type parseValue struct {
|
||||
f *ast.File
|
||||
err error
|
||||
ready chan struct{}
|
||||
}
|
||||
|
||||
func newLoader(cfg *Config) *loader {
|
||||
ld := &loader{}
|
||||
ld := &loader{
|
||||
parseCache: map[string]*parseValue{},
|
||||
}
|
||||
if cfg != nil {
|
||||
ld.Config = *cfg
|
||||
}
|
||||
@ -457,12 +467,8 @@ func newLoader(cfg *Config) *loader {
|
||||
// because we load source if export data is missing.
|
||||
if ld.ParseFile == nil {
|
||||
ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
|
||||
var isrc interface{}
|
||||
if src != nil {
|
||||
isrc = src
|
||||
}
|
||||
const mode = parser.AllErrors | parser.ParseComments
|
||||
return parser.ParseFile(fset, filename, isrc, mode)
|
||||
return parser.ParseFile(fset, filename, src, mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -864,6 +870,42 @@ func (f importerFunc) Import(path string) (*types.Package, error) { return f(pat
|
||||
// the number of parallel I/O calls per process.
|
||||
var ioLimit = make(chan bool, 20)
|
||||
|
||||
func (ld *loader) parseFile(filename string) (*ast.File, error) {
|
||||
ld.parseCacheMu.Lock()
|
||||
v, ok := ld.parseCache[filename]
|
||||
if ok {
|
||||
// cache hit
|
||||
ld.parseCacheMu.Unlock()
|
||||
<-v.ready
|
||||
} else {
|
||||
// cache miss
|
||||
v = &parseValue{ready: make(chan struct{})}
|
||||
ld.parseCache[filename] = v
|
||||
ld.parseCacheMu.Unlock()
|
||||
|
||||
var src []byte
|
||||
for f, contents := range ld.Config.Overlay {
|
||||
if sameFile(f, filename) {
|
||||
src = contents
|
||||
}
|
||||
}
|
||||
var err error
|
||||
if src == nil {
|
||||
ioLimit <- true // wait
|
||||
src, err = ioutil.ReadFile(filename)
|
||||
<-ioLimit // signal
|
||||
}
|
||||
if err != nil {
|
||||
v.err = err
|
||||
} else {
|
||||
v.f, v.err = ld.ParseFile(ld.Fset, filename, src)
|
||||
}
|
||||
|
||||
close(v.ready)
|
||||
}
|
||||
return v.f, v.err
|
||||
}
|
||||
|
||||
// parseFiles reads and parses the Go source files and returns the ASTs
|
||||
// of the ones that could be at least partially parsed, along with a
|
||||
// list of I/O and parse errors encountered.
|
||||
@ -884,24 +926,7 @@ func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(i int, filename string) {
|
||||
ioLimit <- true // wait
|
||||
// ParseFile may return both an AST and an error.
|
||||
var src []byte
|
||||
for f, contents := range ld.Config.Overlay {
|
||||
if sameFile(f, filename) {
|
||||
src = contents
|
||||
}
|
||||
}
|
||||
var err error
|
||||
if src == nil {
|
||||
src, err = ioutil.ReadFile(filename)
|
||||
}
|
||||
if err != nil {
|
||||
parsed[i], errors[i] = nil, err
|
||||
} else {
|
||||
parsed[i], errors[i] = ld.ParseFile(ld.Fset, filename, src)
|
||||
}
|
||||
<-ioLimit // signal
|
||||
parsed[i], errors[i] = ld.parseFile(filename)
|
||||
wg.Done()
|
||||
}(i, file)
|
||||
}
|
||||
|
62
vendor/golang.org/x/tools/imports/forward.go
generated
vendored
Normal file
62
vendor/golang.org/x/tools/imports/forward.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
// Package imports implements a Go pretty-printer (like package "go/format")
|
||||
// that also adds or removes import statements as necessary.
|
||||
package imports // import "golang.org/x/tools/imports"
|
||||
|
||||
import (
|
||||
"go/build"
|
||||
|
||||
intimp "golang.org/x/tools/internal/imports"
|
||||
)
|
||||
|
||||
// Options specifies options for processing files.
|
||||
type Options struct {
|
||||
Fragment bool // Accept fragment of a source file (no package statement)
|
||||
AllErrors bool // Report all errors (not just the first 10 on different lines)
|
||||
|
||||
Comments bool // Print comments (true if nil *Options provided)
|
||||
TabIndent bool // Use tabs for indent (true if nil *Options provided)
|
||||
TabWidth int // Tab width (8 if nil *Options provided)
|
||||
|
||||
FormatOnly bool // Disable the insertion and deletion of imports
|
||||
}
|
||||
|
||||
// Debug controls verbose logging.
|
||||
var Debug = false
|
||||
|
||||
// LocalPrefix is a comma-separated string of import path prefixes, which, if
|
||||
// set, instructs Process to sort the import paths with the given prefixes
|
||||
// into another group after 3rd-party packages.
|
||||
var LocalPrefix string
|
||||
|
||||
// Process formats and adjusts imports for the provided file.
|
||||
// If opt is nil the defaults are used.
|
||||
//
|
||||
// Note that filename's directory influences which imports can be chosen,
|
||||
// so it is important that filename be accurate.
|
||||
// To process data ``as if'' it were in filename, pass the data as a non-nil src.
|
||||
func Process(filename string, src []byte, opt *Options) ([]byte, error) {
|
||||
if opt == nil {
|
||||
opt = &Options{Comments: true, TabIndent: true, TabWidth: 8}
|
||||
}
|
||||
intopt := &intimp.Options{
|
||||
Env: &intimp.ProcessEnv{
|
||||
GOPATH: build.Default.GOPATH,
|
||||
GOROOT: build.Default.GOROOT,
|
||||
Debug: Debug,
|
||||
LocalPrefix: LocalPrefix,
|
||||
},
|
||||
AllErrors: opt.AllErrors,
|
||||
Comments: opt.Comments,
|
||||
FormatOnly: opt.FormatOnly,
|
||||
Fragment: opt.Fragment,
|
||||
TabIndent: opt.TabIndent,
|
||||
TabWidth: opt.TabWidth,
|
||||
}
|
||||
return intimp.Process(filename, src, intopt)
|
||||
}
|
||||
|
||||
// VendorlessPath returns the devendorized version of the import path ipath.
|
||||
// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b".
|
||||
func VendorlessPath(ipath string) string {
|
||||
return intimp.VendorlessPath(ipath)
|
||||
}
|
@ -31,39 +31,27 @@ import (
|
||||
"golang.org/x/tools/internal/gopathwalk"
|
||||
)
|
||||
|
||||
// Debug controls verbose logging.
|
||||
var Debug = false
|
||||
|
||||
// LocalPrefix is a comma-separated string of import path prefixes, which, if
|
||||
// set, instructs Process to sort the import paths with the given prefixes
|
||||
// into another group after 3rd-party packages.
|
||||
var LocalPrefix string
|
||||
|
||||
func localPrefixes() []string {
|
||||
if LocalPrefix != "" {
|
||||
return strings.Split(LocalPrefix, ",")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// importToGroup is a list of functions which map from an import path to
|
||||
// a group number.
|
||||
var importToGroup = []func(importPath string) (num int, ok bool){
|
||||
func(importPath string) (num int, ok bool) {
|
||||
for _, p := range localPrefixes() {
|
||||
var importToGroup = []func(env *ProcessEnv, importPath string) (num int, ok bool){
|
||||
func(env *ProcessEnv, importPath string) (num int, ok bool) {
|
||||
if env.LocalPrefix == "" {
|
||||
return
|
||||
}
|
||||
for _, p := range strings.Split(env.LocalPrefix, ",") {
|
||||
if strings.HasPrefix(importPath, p) || strings.TrimSuffix(p, "/") == importPath {
|
||||
return 3, true
|
||||
}
|
||||
}
|
||||
return
|
||||
},
|
||||
func(importPath string) (num int, ok bool) {
|
||||
func(_ *ProcessEnv, importPath string) (num int, ok bool) {
|
||||
if strings.HasPrefix(importPath, "appengine") {
|
||||
return 2, true
|
||||
}
|
||||
return
|
||||
},
|
||||
func(importPath string) (num int, ok bool) {
|
||||
func(_ *ProcessEnv, importPath string) (num int, ok bool) {
|
||||
if strings.Contains(importPath, ".") {
|
||||
return 1, true
|
||||
}
|
||||
@ -71,9 +59,9 @@ var importToGroup = []func(importPath string) (num int, ok bool){
|
||||
},
|
||||
}
|
||||
|
||||
func importGroup(importPath string) int {
|
||||
func importGroup(env *ProcessEnv, importPath string) int {
|
||||
for _, fn := range importToGroup {
|
||||
if n, ok := fn(importPath); ok {
|
||||
if n, ok := fn(env, importPath); ok {
|
||||
return n
|
||||
}
|
||||
}
|
||||
@ -241,7 +229,7 @@ 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.
|
||||
fixEnv *fixEnv // the environment to use for go commands, etc.
|
||||
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.
|
||||
|
||||
@ -266,7 +254,7 @@ func (p *pass) loadPackageNames(imports []*importInfo) error {
|
||||
unknown = append(unknown, imp.importPath)
|
||||
}
|
||||
|
||||
names, err := p.fixEnv.getResolver().loadPackageNames(unknown, p.srcDir)
|
||||
names, err := p.env.getResolver().loadPackageNames(unknown, p.srcDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -324,7 +312,7 @@ func (p *pass) load() bool {
|
||||
if p.loadRealPackageNames {
|
||||
err := p.loadPackageNames(append(imports, p.candidates...))
|
||||
if err != nil {
|
||||
if Debug {
|
||||
if p.env.Debug {
|
||||
log.Printf("loading package names: %v", err)
|
||||
}
|
||||
return false
|
||||
@ -448,13 +436,13 @@ func (p *pass) addCandidate(imp *importInfo, pkg *packageInfo) {
|
||||
// easily be extended by adding a file with an init function.
|
||||
var fixImports = fixImportsDefault
|
||||
|
||||
func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *fixEnv) error {
|
||||
func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error {
|
||||
abs, err := filepath.Abs(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
srcDir := filepath.Dir(abs)
|
||||
if Debug {
|
||||
if env.Debug {
|
||||
log.Printf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir)
|
||||
}
|
||||
|
||||
@ -486,7 +474,7 @@ func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *f
|
||||
// Third pass: get real package names where we had previously used
|
||||
// the naive algorithm. This is the first step that will use the
|
||||
// environment, so we provide it here for the first time.
|
||||
p = &pass{fset: fset, f: f, srcDir: srcDir, fixEnv: env}
|
||||
p = &pass{fset: fset, f: f, srcDir: srcDir, env: env}
|
||||
p.loadRealPackageNames = true
|
||||
p.otherFiles = otherFiles
|
||||
if p.load() {
|
||||
@ -510,9 +498,12 @@ func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *f
|
||||
return nil
|
||||
}
|
||||
|
||||
// fixEnv contains environment variables and settings that affect the use of
|
||||
// ProcessEnv contains environment variables and settings that affect the use of
|
||||
// the go command, the go/build package, etc.
|
||||
type fixEnv struct {
|
||||
type ProcessEnv struct {
|
||||
LocalPrefix string
|
||||
Debug bool
|
||||
|
||||
// If non-empty, these will be used instead of the
|
||||
// process-wide values.
|
||||
GOPATH, GOROOT, GO111MODULE, GOPROXY, GOFLAGS string
|
||||
@ -524,7 +515,7 @@ type fixEnv struct {
|
||||
resolver resolver
|
||||
}
|
||||
|
||||
func (e *fixEnv) env() []string {
|
||||
func (e *ProcessEnv) env() []string {
|
||||
env := os.Environ()
|
||||
add := func(k, v string) {
|
||||
if v != "" {
|
||||
@ -542,7 +533,7 @@ func (e *fixEnv) env() []string {
|
||||
return env
|
||||
}
|
||||
|
||||
func (e *fixEnv) getResolver() resolver {
|
||||
func (e *ProcessEnv) getResolver() resolver {
|
||||
if e.resolver != nil {
|
||||
return e.resolver
|
||||
}
|
||||
@ -557,7 +548,7 @@ func (e *fixEnv) getResolver() resolver {
|
||||
return &moduleResolver{env: e}
|
||||
}
|
||||
|
||||
func (e *fixEnv) newPackagesConfig(mode packages.LoadMode) *packages.Config {
|
||||
func (e *ProcessEnv) newPackagesConfig(mode packages.LoadMode) *packages.Config {
|
||||
return &packages.Config{
|
||||
Mode: mode,
|
||||
Dir: e.WorkingDir,
|
||||
@ -565,14 +556,14 @@ func (e *fixEnv) newPackagesConfig(mode packages.LoadMode) *packages.Config {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *fixEnv) buildContext() *build.Context {
|
||||
func (e *ProcessEnv) buildContext() *build.Context {
|
||||
ctx := build.Default
|
||||
ctx.GOROOT = e.GOROOT
|
||||
ctx.GOPATH = e.GOPATH
|
||||
return &ctx
|
||||
}
|
||||
|
||||
func (e *fixEnv) invokeGo(args ...string) (*bytes.Buffer, error) {
|
||||
func (e *ProcessEnv) invokeGo(args ...string) (*bytes.Buffer, error) {
|
||||
cmd := exec.Command("go", args...)
|
||||
stdout := &bytes.Buffer{}
|
||||
stderr := &bytes.Buffer{}
|
||||
@ -581,7 +572,7 @@ func (e *fixEnv) invokeGo(args ...string) (*bytes.Buffer, error) {
|
||||
cmd.Env = e.env()
|
||||
cmd.Dir = e.WorkingDir
|
||||
|
||||
if Debug {
|
||||
if e.Debug {
|
||||
defer func(start time.Time) { log.Printf("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now())
|
||||
}
|
||||
if err := cmd.Run(); err != nil {
|
||||
@ -632,7 +623,7 @@ type resolver interface {
|
||||
|
||||
// gopathResolver implements resolver for GOPATH and module workspaces using go/packages.
|
||||
type goPackagesResolver struct {
|
||||
env *fixEnv
|
||||
env *ProcessEnv
|
||||
}
|
||||
|
||||
func (r *goPackagesResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) {
|
||||
@ -680,7 +671,7 @@ func (r *goPackagesResolver) scan(refs references) ([]*pkg, error) {
|
||||
}
|
||||
|
||||
func addExternalCandidates(pass *pass, refs references, filename string) error {
|
||||
dirScan, err := pass.fixEnv.getResolver().scan(refs)
|
||||
dirScan, err := pass.env.getResolver().scan(refs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -707,7 +698,7 @@ func addExternalCandidates(pass *pass, refs references, filename string) error {
|
||||
go func(pkgName string, symbols map[string]bool) {
|
||||
defer wg.Done()
|
||||
|
||||
found, err := findImport(ctx, pass.fixEnv, dirScan, pkgName, symbols, filename)
|
||||
found, err := findImport(ctx, pass.env, dirScan, pkgName, symbols, filename)
|
||||
|
||||
if err != nil {
|
||||
firstErrOnce.Do(func() {
|
||||
@ -778,7 +769,7 @@ func importPathToAssumedName(importPath string) string {
|
||||
|
||||
// gopathResolver implements resolver for GOPATH workspaces.
|
||||
type gopathResolver struct {
|
||||
env *fixEnv
|
||||
env *ProcessEnv
|
||||
}
|
||||
|
||||
func (r *gopathResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) {
|
||||
@ -791,7 +782,7 @@ func (r *gopathResolver) loadPackageNames(importPaths []string, srcDir string) (
|
||||
|
||||
// importPathToNameGoPath finds out the actual package name, as declared in its .go files.
|
||||
// If there's a problem, it returns "".
|
||||
func importPathToName(env *fixEnv, importPath, srcDir string) (packageName string) {
|
||||
func importPathToName(env *ProcessEnv, importPath, srcDir string) (packageName string) {
|
||||
// Fast path for standard library without going to disk.
|
||||
if _, ok := stdlib[importPath]; ok {
|
||||
return path.Base(importPath) // stdlib packages always match their paths.
|
||||
@ -927,7 +918,7 @@ func (r *gopathResolver) scan(_ references) ([]*pkg, error) {
|
||||
dir: dir,
|
||||
})
|
||||
}
|
||||
gopathwalk.Walk(gopathwalk.SrcDirsRoots(r.env.buildContext()), add, gopathwalk.Options{Debug: Debug, ModulesEnabled: false})
|
||||
gopathwalk.Walk(gopathwalk.SrcDirsRoots(r.env.buildContext()), add, gopathwalk.Options{Debug: r.env.Debug, ModulesEnabled: false})
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@ -946,8 +937,8 @@ func VendorlessPath(ipath string) string {
|
||||
|
||||
// loadExports returns the set of exported symbols in the package at dir.
|
||||
// It returns nil on error or if the package name in dir does not match expectPackage.
|
||||
func loadExports(ctx context.Context, env *fixEnv, expectPackage string, pkg *pkg) (map[string]bool, error) {
|
||||
if Debug {
|
||||
func loadExports(ctx context.Context, env *ProcessEnv, expectPackage string, pkg *pkg) (map[string]bool, error) {
|
||||
if env.Debug {
|
||||
log.Printf("loading exports in dir %s (seeking package %s)", pkg.dir, expectPackage)
|
||||
}
|
||||
if pkg.goPackage != nil {
|
||||
@ -1020,7 +1011,7 @@ func loadExports(ctx context.Context, env *fixEnv, expectPackage string, pkg *pk
|
||||
}
|
||||
}
|
||||
|
||||
if Debug {
|
||||
if env.Debug {
|
||||
exportList := make([]string, 0, len(exports))
|
||||
for k := range exports {
|
||||
exportList = append(exportList, k)
|
||||
@ -1033,7 +1024,7 @@ func loadExports(ctx context.Context, env *fixEnv, expectPackage string, pkg *pk
|
||||
|
||||
// findImport searches for a package with the given symbols.
|
||||
// If no package is found, findImport returns ("", false, nil)
|
||||
func findImport(ctx context.Context, env *fixEnv, dirScan []*pkg, pkgName string, symbols map[string]bool, filename string) (*pkg, error) {
|
||||
func findImport(ctx context.Context, env *ProcessEnv, dirScan []*pkg, pkgName string, symbols map[string]bool, filename string) (*pkg, error) {
|
||||
pkgDir, err := filepath.Abs(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -1056,7 +1047,7 @@ func findImport(ctx context.Context, env *fixEnv, dirScan []*pkg, pkgName string
|
||||
// ones. Note that this sorts by the de-vendored name, so
|
||||
// there's no "penalty" for vendoring.
|
||||
sort.Sort(byDistanceOrImportPathShortLength(candidates))
|
||||
if Debug {
|
||||
if env.Debug {
|
||||
for i, c := range candidates {
|
||||
log.Printf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir)
|
||||
}
|
||||
@ -1097,7 +1088,7 @@ func findImport(ctx context.Context, env *fixEnv, dirScan []*pkg, pkgName string
|
||||
|
||||
exports, err := loadExports(ctx, env, pkgName, c.pkg)
|
||||
if err != nil {
|
||||
if Debug {
|
||||
if env.Debug {
|
||||
log.Printf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err)
|
||||
}
|
||||
resc <- nil
|
@ -6,14 +6,13 @@
|
||||
|
||||
// Package imports implements a Go pretty-printer (like package "go/format")
|
||||
// that also adds or removes import statements as necessary.
|
||||
package imports // import "golang.org/x/tools/imports"
|
||||
package imports
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/build"
|
||||
"go/format"
|
||||
"go/parser"
|
||||
"go/printer"
|
||||
@ -27,8 +26,10 @@ import (
|
||||
"golang.org/x/tools/go/ast/astutil"
|
||||
)
|
||||
|
||||
// Options specifies options for processing files.
|
||||
// Options is golang.org/x/tools/imports.Options with extra internal-only options.
|
||||
type Options struct {
|
||||
Env *ProcessEnv // The environment to use. Note: this contains the cached module and filesystem state.
|
||||
|
||||
Fragment bool // Accept fragment of a source file (no package statement)
|
||||
AllErrors bool // Report all errors (not just the first 10 on different lines)
|
||||
|
||||
@ -39,21 +40,8 @@ type Options struct {
|
||||
FormatOnly bool // Disable the insertion and deletion of imports
|
||||
}
|
||||
|
||||
// Process formats and adjusts imports for the provided file.
|
||||
// If opt is nil the defaults are used.
|
||||
//
|
||||
// Note that filename's directory influences which imports can be chosen,
|
||||
// so it is important that filename be accurate.
|
||||
// To process data ``as if'' it were in filename, pass the data as a non-nil src.
|
||||
// Process implements golang.org/x/tools/imports.Process with explicit context in env.
|
||||
func Process(filename string, src []byte, opt *Options) ([]byte, error) {
|
||||
env := &fixEnv{GOPATH: build.Default.GOPATH, GOROOT: build.Default.GOROOT}
|
||||
return process(filename, src, opt, env)
|
||||
}
|
||||
|
||||
func process(filename string, src []byte, opt *Options, env *fixEnv) ([]byte, error) {
|
||||
if opt == nil {
|
||||
opt = &Options{Comments: true, TabIndent: true, TabWidth: 8}
|
||||
}
|
||||
if src == nil {
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
@ -69,12 +57,12 @@ func process(filename string, src []byte, opt *Options, env *fixEnv) ([]byte, er
|
||||
}
|
||||
|
||||
if !opt.FormatOnly {
|
||||
if err := fixImports(fileSet, file, filename, env); err != nil {
|
||||
if err := fixImports(fileSet, file, filename, opt.Env); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
sortImports(fileSet, file)
|
||||
sortImports(opt.Env, fileSet, file)
|
||||
imps := astutil.Imports(fileSet, file)
|
||||
var spacesBefore []string // import paths we need spaces before
|
||||
for _, impSection := range imps {
|
||||
@ -85,7 +73,7 @@ func process(filename string, src []byte, opt *Options, env *fixEnv) ([]byte, er
|
||||
lastGroup := -1
|
||||
for _, importSpec := range impSection {
|
||||
importPath, _ := strconv.Unquote(importSpec.Path.Value)
|
||||
groupNum := importGroup(importPath)
|
||||
groupNum := importGroup(opt.Env, importPath)
|
||||
if groupNum != lastGroup && lastGroup != -1 {
|
||||
spacesBefore = append(spacesBefore, importPath)
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
// standard library. The file is intended to be built as part of the imports
|
||||
// package, so that the package may be used in environments where a GOROOT is
|
||||
// not available (such as App Engine).
|
||||
package main
|
||||
package imports
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -3,7 +3,7 @@
|
||||
// mkstdlib generates the zstdlib.go file, containing the Go standard
|
||||
// library API symbols. It's baked into the binary to avoid scanning
|
||||
// GOPATH in the common case.
|
||||
package main
|
||||
package imports
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -22,7 +22,7 @@ import (
|
||||
// moduleResolver implements resolver for modules using the go command as little
|
||||
// as feasible.
|
||||
type moduleResolver struct {
|
||||
env *fixEnv
|
||||
env *ProcessEnv
|
||||
|
||||
initialized bool
|
||||
main *moduleJSON
|
||||
@ -62,7 +62,7 @@ func (r *moduleResolver) init() error {
|
||||
return err
|
||||
}
|
||||
if mod.Dir == "" {
|
||||
if Debug {
|
||||
if r.env.Debug {
|
||||
log.Printf("module %v has not been downloaded and will be ignored", mod.Path)
|
||||
}
|
||||
// Can't do anything with a module that's not downloaded.
|
||||
@ -253,7 +253,7 @@ func (r *moduleResolver) scan(_ references) ([]*pkg, error) {
|
||||
matches := modCacheRegexp.FindStringSubmatch(subdir)
|
||||
modPath, err := module.DecodePath(filepath.ToSlash(matches[1]))
|
||||
if err != nil {
|
||||
if Debug {
|
||||
if r.env.Debug {
|
||||
log.Printf("decoding module cache path %q: %v", subdir, err)
|
||||
}
|
||||
return
|
||||
@ -303,7 +303,7 @@ func (r *moduleResolver) scan(_ references) ([]*pkg, error) {
|
||||
importPathShort: VendorlessPath(importPath),
|
||||
dir: dir,
|
||||
})
|
||||
}, gopathwalk.Options{Debug: Debug, ModulesEnabled: true})
|
||||
}, gopathwalk.Options{Debug: r.env.Debug, ModulesEnabled: true})
|
||||
return result, nil
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
// sortImports sorts runs of consecutive import lines in import blocks in f.
|
||||
// It also removes duplicate imports when it is possible to do so without data loss.
|
||||
func sortImports(fset *token.FileSet, f *ast.File) {
|
||||
func sortImports(env *ProcessEnv, fset *token.FileSet, f *ast.File) {
|
||||
for i, d := range f.Decls {
|
||||
d, ok := d.(*ast.GenDecl)
|
||||
if !ok || d.Tok != token.IMPORT {
|
||||
@ -40,11 +40,11 @@ func sortImports(fset *token.FileSet, f *ast.File) {
|
||||
for j, s := range d.Specs {
|
||||
if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line {
|
||||
// j begins a new run. End this one.
|
||||
specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...)
|
||||
specs = append(specs, sortSpecs(env, fset, f, d.Specs[i:j])...)
|
||||
i = j
|
||||
}
|
||||
}
|
||||
specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...)
|
||||
specs = append(specs, sortSpecs(env, fset, f, d.Specs[i:])...)
|
||||
d.Specs = specs
|
||||
|
||||
// Deduping can leave a blank line before the rparen; clean that up.
|
||||
@ -95,7 +95,7 @@ type posSpan struct {
|
||||
End token.Pos
|
||||
}
|
||||
|
||||
func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
|
||||
func sortSpecs(env *ProcessEnv, fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
|
||||
// Can't short-circuit here even if specs are already sorted,
|
||||
// since they might yet need deduplication.
|
||||
// A lone import, however, may be safely ignored.
|
||||
@ -144,7 +144,7 @@ func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
|
||||
// Reassign the import paths to have the same position sequence.
|
||||
// Reassign each comment to abut the end of its spec.
|
||||
// Sort the comments by new position.
|
||||
sort.Sort(byImportSpec(specs))
|
||||
sort.Sort(byImportSpec{env, specs})
|
||||
|
||||
// Dedup. Thanks to our sorting, we can just consider
|
||||
// adjacent pairs of imports.
|
||||
@ -197,16 +197,19 @@ func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
|
||||
return specs
|
||||
}
|
||||
|
||||
type byImportSpec []ast.Spec // slice of *ast.ImportSpec
|
||||
type byImportSpec struct {
|
||||
env *ProcessEnv
|
||||
specs []ast.Spec // slice of *ast.ImportSpec
|
||||
}
|
||||
|
||||
func (x byImportSpec) Len() int { return len(x) }
|
||||
func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||
func (x byImportSpec) Len() int { return len(x.specs) }
|
||||
func (x byImportSpec) Swap(i, j int) { x.specs[i], x.specs[j] = x.specs[j], x.specs[i] }
|
||||
func (x byImportSpec) Less(i, j int) bool {
|
||||
ipath := importPath(x[i])
|
||||
jpath := importPath(x[j])
|
||||
ipath := importPath(x.specs[i])
|
||||
jpath := importPath(x.specs[j])
|
||||
|
||||
igroup := importGroup(ipath)
|
||||
jgroup := importGroup(jpath)
|
||||
igroup := importGroup(x.env, ipath)
|
||||
jgroup := importGroup(x.env, jpath)
|
||||
if igroup != jgroup {
|
||||
return igroup < jgroup
|
||||
}
|
||||
@ -214,13 +217,13 @@ func (x byImportSpec) Less(i, j int) bool {
|
||||
if ipath != jpath {
|
||||
return ipath < jpath
|
||||
}
|
||||
iname := importName(x[i])
|
||||
jname := importName(x[j])
|
||||
iname := importName(x.specs[i])
|
||||
jname := importName(x.specs[j])
|
||||
|
||||
if iname != jname {
|
||||
return iname < jname
|
||||
}
|
||||
return importComment(x[i]) < importComment(x[j])
|
||||
return importComment(x.specs[i]) < importComment(x.specs[j])
|
||||
}
|
||||
|
||||
type byCommentPos []*ast.CommentGroup
|
21
vendor/modules.txt
vendored
21
vendor/modules.txt
vendored
@ -10,7 +10,7 @@ github.com/davecgh/go-spew/spew
|
||||
github.com/fatih/color
|
||||
# github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/fsnotify/fsnotify
|
||||
# github.com/go-critic/go-critic v0.0.0-20181204210945-c3db6069acc5
|
||||
# github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540
|
||||
github.com/go-critic/go-critic/checkers
|
||||
github.com/go-critic/go-critic/checkers/internal/lintutil
|
||||
# github.com/go-lintpack/lintpack v0.5.2
|
||||
@ -19,19 +19,19 @@ github.com/go-lintpack/lintpack/astwalk
|
||||
# github.com/go-ole/go-ole v1.2.1
|
||||
github.com/go-ole/go-ole
|
||||
github.com/go-ole/go-ole/oleutil
|
||||
# github.com/go-toolsmith/astcast v0.0.0-20181028201508-b7a89ed70af1
|
||||
# github.com/go-toolsmith/astcast v1.0.0
|
||||
github.com/go-toolsmith/astcast
|
||||
# github.com/go-toolsmith/astcopy v0.0.0-20180903214859-79b422d080c4
|
||||
# github.com/go-toolsmith/astcopy v1.0.0
|
||||
github.com/go-toolsmith/astcopy
|
||||
# github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6
|
||||
# github.com/go-toolsmith/astequal v1.0.0
|
||||
github.com/go-toolsmith/astequal
|
||||
# github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086
|
||||
# github.com/go-toolsmith/astfmt v1.0.0
|
||||
github.com/go-toolsmith/astfmt
|
||||
# github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30
|
||||
# github.com/go-toolsmith/astp v1.0.0
|
||||
github.com/go-toolsmith/astp
|
||||
# github.com/go-toolsmith/strparse v0.0.0-20180903215201-830b6daa1241
|
||||
# github.com/go-toolsmith/strparse v1.0.0
|
||||
github.com/go-toolsmith/strparse
|
||||
# github.com/go-toolsmith/typep v0.0.0-20181030061450-d63dc7650676
|
||||
# github.com/go-toolsmith/typep v1.0.0
|
||||
github.com/go-toolsmith/typep
|
||||
# github.com/gobwas/glob v0.2.3
|
||||
github.com/gobwas/glob
|
||||
@ -196,7 +196,7 @@ golang.org/x/sys/windows
|
||||
golang.org/x/text/width
|
||||
golang.org/x/text/transform
|
||||
golang.org/x/text/unicode/norm
|
||||
# golang.org/x/tools v0.0.0-20190420000508-685fecacd0a0
|
||||
# golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd
|
||||
golang.org/x/tools/go/analysis
|
||||
golang.org/x/tools/go/analysis/passes/asmdecl
|
||||
golang.org/x/tools/go/analysis/passes/assign
|
||||
@ -240,9 +240,10 @@ golang.org/x/tools/go/internal/cgo
|
||||
golang.org/x/tools/go/internal/packagesdriver
|
||||
golang.org/x/tools/internal/gopathwalk
|
||||
golang.org/x/tools/internal/semver
|
||||
golang.org/x/tools/internal/module
|
||||
golang.org/x/tools/internal/imports
|
||||
golang.org/x/tools/go/internal/gcimporter
|
||||
golang.org/x/tools/internal/fastwalk
|
||||
golang.org/x/tools/internal/module
|
||||
# gopkg.in/yaml.v2 v2.2.1
|
||||
gopkg.in/yaml.v2
|
||||
# mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
|
||||
|
Loading…
x
Reference in New Issue
Block a user