From b326aebcab754c3ae4a26d707e4a207fe15e785c Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Thu, 3 Aug 2023 02:33:26 +0000 Subject: [PATCH] upgrade to latest dependencies bumping golang.org/x/tools 031fc75...675bf3c: > 675bf3c go.mod: update golang.org/x dependencies > ad52c1c go/ssa/interp: support conversions to slices of named bytes > 14ec3c0 gopls/doc/contributing.md: document error handling strategies > c495364 go/packages/gopackages: document -mode flag > 87ad891 gopls/internal/lsp/source/typerefs: move test into _test.go > 27fd94e internal/fastwalk: doc formatting fixes (including godoc links) > d362be0 gopls/internal/lsp/filecache: reduce GC frequency > 969078b Revert "go/analysis: add Sizes that matches gc size computations" > 5aa6acb go/analysis: add Sizes that matches gc size computations > 5a89a3b go/vcs: delete > d03a819 go/vcs: isolate into a nested module > a659412 go/vcs: deprecate package in favor of go list -json > 9d8d408 gopls/internal/lsp/cmd: list bug reports in 'gopls bug' > 8f9bce4 go/ast/inspector: clarify behavior regarding comment traversal > fa10359 gopls/internal/lsp/cache: don't panic when import fails during analysis > c8278fe gopls/internal/lsp/cache: don't record edges to invalid packages > 87df9bc cmd/godoc: disable TestWebIndex, a very slow test > 63624df gopls/internal/lsp/cache: remove ITVs from shared import graph > 0ca9d30 gopls/internal/lsp/cache: fix nil panic in analysis toSourceDiagnostic > 85554d6 gopls/internal/lsp/cache: add debugging assertion for golang/go# 60904 > 9960b69 gopls/internal/lsp/cache: guard against "unsafe" by package path, not ID > 6480332 gopls/internal/lsp/cache: use types.Unsafe in analysisPackage > 155320d gopls/internal/lsp/work: don't crash when hovering over broken mod dir > b71392a gopls/internal/lsp/cache: reduce importing in analysis > d1a388b internal/gcimporter: avoid a crash when exporting a struct with no pkg > a4ed05f cmd/digraph: add "to dot" to emit Graphviz dot > 7261b32 gopls/internal/regtest: fix goimports on windows when using vendoring > 41e4e56 gopls/internal/lsp/source/completion: ensuring completion completeness > ac29460 go/ssa: fix bug in writeSignature on external functions > 3b62e7e go/ssa: use core type within (*builder).receiver > f394d45 gopls/internal/lsp/cache: compute xrefs and methodsets asynchronously > 27dbf85 go.mod: update golang.org/x dependencies > c6c9830 go/types/objectpath: memoize scope lookup in objectpath.Encoder > 0245e1d gopls/internal/regtest/codelens: set GOWORK=off for go mod vendor > 85be888 go/analysis/passes/defers: add analyser for defer mistake > c43232f cmd/digraph: improve examples using go list, mod > 6e1595c internal/gcimporter: treat unknown constant values the same as invalid > c59d87f gopls/internal/lsp/cache: two minor simplifications > db6a81e go/packages/packagestest: set Config.Logf if the test is run verbosely > a01290f internal/typeparams: work around LookupFieldOrMethod inconsistency > 6f567c8 gopls/internal/lsp/filecache: reduce lifespan of os.FileInfos > 726c727 gopls/internal/lsp: enable min/max builtin completion test > 86c93e8 gopls: unimported completion should use the completion matcher > 04ceacb gopls/internal/lsp/source: fix panic in typeDefinition on comparable > 947adca gopls/internal/lsp/source/methodsets: comparable also has no package > c35c44f gopls/internal/lsp/cache: add assertions > 0b4461b internal/diff: fix LineEdits bug in slow path > 1943c1e internal/diff: fix LineEdits bug in fast path > c6d86c4 go/pointer: delete package > 77fd064 go/types/objectpath: remove unnecessary unsafe import > 0dda7d6 go/pointer: remove replace directive > 98f1b4d gopls/internal/lsp/cache: check number of orphaned files after filtering > a260315 go/pointer: create submodule > 96844c3 cmd/{guru,callgraph}: stop using go/pointer > cd694d8 go/packages: include "unsafe".GoFiles=["unsafe.go"] > 33c741d gopls/internal/lsp: add min/max builtin > 933c7cc internal/lsp/source: use exact match in import highlighting > 5974258 gopls/internal/lsp: clear vuln diagnostics on config changes > f3faea1 go/packages: pass -pgo=off on go1.21 and later > 5f74ec7 internal/lsp/debug: add links to profiles and GC > ed90c6d internal/diff: unexport various identifiers > 827f5aa gopls/internal/lsp/source: test references bug on struct{p.T} > a12e1a6 go/ssa/interp: implement min/max builtins > 9c97539 gopls/internal/lsp/cache: remove nested module warning > d44a094 gopls/internal/lsp/cmd: add a stats -anon flag to show anonymous data > e106694 gopls/internal/lsp: bundle certain quick-fixes with their diagnostic > 5dc3f74 gopls/internal/lsp/filecache: reenable memory cache layer > 7e146a6 gopls/internal/lsp/cmd: simplify connection type > 1e60668 gopls/internal/regtest/workspace: unskip duplicate modules test > 5ce721d gopls/doc: Fix broken links > 7a03feb gopls/internal/lsp/cmd: remove vestiges of debugging golang/go# 59475 > a70f2bc gopls/internal/regtest/misc: update and unskip TestHoverIntLiteral > 6997d19 gopls/internal/regtest/misc: unskip TestMajorOptionsChange > ec543c5 gopls/internal/lsp/cache: fix crash in Session.updateViewLocked > a12ee94 gopls/internal/regtest/misc: update some unilaterally skipped tests > 5ff5cbb gopls: deprecate support for Go 1.16 and 1.17, update warnings > e6fd7f4 gopls/internal/lsp/cache: limit module scan to 100K files > 9ca66ba gopls/internal/lsp/regtest: delete TestWatchReplaceTargets > edbfdbe gopls/internal/lsp/source/completion: (unimported) add placeholders > 3a5dbf3 gopls: add a new "subdirWatchPatterns" setting > 3c02551 internal/typesinternal: remove NewObjectpathFunc > 0729362 present: reformat doc comment for lack of inline code > d4e66bd go/ssa: TestStdlib: disable check that function names are distinct > 738ea2b go/ssa: use core type for field accesses > 2ec4299 gopls/internal/lsp: split file-watching glob patterns > 43b02ea gopls/internal/lsp/cache: only delete the most relevant mod tidy handle > 5919673 internal/lsp/filecache: eliminate 'kind' directories > a5ef6c3 gopls/internal/lsp: keep track of overlays on the files map > d7f4359 gopls/internal/lsp/mod: optimizations for mod tidy diagnostics > 2eb726b gopls/internal/lsp/filecache: touch only files older than 1h > b742cb9 gopls/internal/regtest/bench: add a benchmark for diagnosing saves > 4d66324 gopls/internal/lsp/cache: tweak error message > e46df40 gopls/internal/lsp/filecache: delayed tweaks from code review > 3df69b8 gopls/internal/lsp/debug: remove memory monitoring > a069704 gopls/internal/lsp/filecache: avoid flock > 3d53c2d gopls/internal/lsp/cache: fix race in adhoc reloading > 8b4b27b go/analysis/passes/slog: fix Group kv offset > 242e5ed cover: eliminate an unnecessary fsync in TestParseProfiles > 651d951 go/ssa: fix typo in package docs > 743372f gopls/internal/lsp/debug: limit to 100 recent trace entries > 522243a go/ssa/interp: avoid hard-coding GOOS and GOARCH > a059382 gopls/internal/lsp/cache: fail workspace load on context cancellation > e5c8d4d gopls/internal/lsp/cache: unexport ValidBuildConfiguration > f4e8a71 go/ssa: use core type for composite literal addresses > 3b25dbd go/ssa: use core types for array length > e7048d5 gopls/internal/lsp/filecache: front with a 100MB in-memory LRU cache > 8c0fcd2 gopls/internal/lsp/lru: extract LRU logic to a standalone package > 19d700c go/ssa/interp: use the actual GOOS and GOARCH to interpret tests > 9dcd3d5 gopls/internal/lsp/filecache: limit Get parallelism too > 7f203f0 go/ssa: consolidate use of underlying pointer > a13793e gopls/internal/lsp: add quick-fixes to manage the go.work file > 12a0517 internal/gcimporter: improve error handling > 5eb1eb9 gopls/internal/lsp/cache: call filecache.Set asynchronously > 35fe77a gopls/internal/lsp/filecache: limit parallelism in Set > 1c9fe3f gopls: improve diagnostics for orphaned files > ad74ff6 go/gcexportdata: drop support for the ancient binary format > 01128f9 gopls/internal/lsp/source: fix bug renaming field to unexported > cd39d2b internal/lsp/cache: support loading multiple orphaned files > abeba28 gopls/internal/regtest/marker: support proxy files in marker tests > 18186f0 go/analysis/passes/slog: simplify function matching > 9aa9d13 cmd/bisect, internal/bisect: use more precise skip suffixes, written in hex > 3034d9c gopls/internal/lsp/cmd: append, don't overwrite, in PublishDiagnostics > 4318d63 gopls: change the default value of "symbolScope" to "all" > f44f50e gopls/internal/lsp/source: implementation: report builtin 'error' > 787e720 gopls/internal/lsp: optimize checks for ignored files > 4ed7de1 gopls: add google-cloud-go as a benchmark repo > d799eba gopls: additional instrumentation during goimports > a7e7dc4 go/ssa: rename test cases in TestGenericBodies > d668f58 gopls/internal/regtest/marker: require cgo for issue59944.txt > 005fa64 go/analysis/passes/slog: add check for slog.Group > 033e628 go/ssa: more reindentation of TestGenericBodies > 2310848 go/ssa: reindent test cases in TestGenericBodies > 90e9c65 gopls/internal/lsp/cache: skip type errors after parse errors > 08b24db gopls/internal/lsp/regtest: check for "// @marker" rogue space > b9c20f6 gopls/internal/regtest/marker: migrate @diag to new marker tests > 4609d79 cmd/bisect: add -compile and -godebug shorthands > ddfa220 internal/fuzzy: improvements to the symbol scoring algorithm > 3449242 go/types/objectpath: don't panic when receiver is missing a method > 0809ec2 gopls/internal/lsp/source: document {All,Workspace}Metadata > 8f7fb01 go/analysis/unitchecker: add test of go vet on std > 23e52a3 bisect: diagnose bad targets better > d5af889 gopls: set GOWORK=off for loads from debug and safetoken tests > c93329a go/analysis/passes/printf: reshorten diagnostic about %s in Println call > 6219726 go.mod: update golang.org/x dependencies > f4d143e go/ssa: cleanup TestGenericBodies to pickup package name > 3d99ebe gopls/diff/unified: remove redundant information > 479f5c6 go/ssa: Origin is only available after building > 6d1dd12 go/analysis: simplify unusedresult > 4a2dd0d go/callgraph/vta: allow pointer to type parameter in sliceArrayElem > 7c6c2b7 go/ssa: keep syntax for instantiations > ce1b96b all: fix some comments > 0500fd4 go/ssa: use core type in address > 8e9b185 gopls/internal/lsp/source: add the "symbolScope" option > 4ac71c0 internal/imports: sort fixes for deterministic results > 573915d gopls/internal/lsp/cache: always init the resolver in runProcessEnvFunc > dd09381 bisect: move to internal/bisect until API is reviewed > 516063a bisect, cmd/bisect: add new library and tool > 58fedf6 internal/diffp: add patience diff from main repo > 7b684a9 gopls: port import tests to the new marker framework > 87974e3 gopls/internal/lsp/filecache: skip TestConcurrency on plan9 builder > c64bb76 gopls/internal/lsp/source: make infertypeargs a convenience analyzer > 91b7a8e go/ssa: use origin method in source lookup > ba892bb go/types/internal/play: show formatted AST > 7df6af8 gopls/internal/lsp/filecache: silently discard CRC errors on macOS > 2563079 go/analysis/passes/printf: update directive diagnostic message > 3f6c3b3 gopls: upgrade to latest version of LSP protocol > 216928d gopls: port function extraction marker tests to the new framework > 2415ce1 gopls: skip tests that load gopls packages if x/tools replacement is missing > 17e5ef3 gopls/internal/lsp/cache: remove cycle check from buildMetadata > affb5fc gopls/internal/lsp/source: fix crash in definitions of builtins > 558d701 gopls/internal/lsp/source: fix another bug in reference expansion > 51dfad7 gopls: port workspace/symbol marker tests to the new framework > c6b5780 gopls: fix build at older Go versions > 7590fe4 gopls/internal/lsp: hover over linkname directives. > ec61ad3 gopls/internal/lsp/source: add invert-if-condition refactoring > 5283a01 go/packages: delete TestCgoOption as it doesn't test the cgo option > e2f3b25 gopls/internal/bug: record bug reports in file cache > ab24b7b gopls/internal/regtest/marker: add a test case for issue # 59554 > 8235df3 gopls/internal/regtest/marker: port format tests to the new framework > 80dc031 internal/diff: unified: match diff delete for empty file > 165099b all: remove repeated definite articles > ac40903 internal/gocommand: simplify GoVersion invocation > 9e0a7b1 copyright: don't require checkout to be named tools > 94ed378 internal/lsp/testdata: update for new diagnostic from go list > a5c37ba gopls/internal/regtest/marker: skip on small machines > 76e1037 internal/testenv: assume that mobile platforms are small machines > 17e2d70 gopls/internal/bug: remove unused Data parameter > dd89a2e gopls/internal/lsp: remove now redundant debouncing logic > 2a9398d go/analysis/passes/slog: do not report multiple incorrect keys > 4baa3dc gopls/internal/bug: move bug package into gopls > 71ea8f1 go/ssa: lift structs, arrays and typeparams > d59a28f gopls/internal/lsp/source: references: restrict search to workspace packages > e8f417a gopls/internal/lsp/cache: cleanups to active packages > 82c8a38 internal/gocommand: set a WaitDelay (when available) on commands > e286d22 gopls/internal/lsp: eliminate diagnoseDetached > 4e3238a gopls/internal/lsp/cache: break metadata cycles > 660614b gopls/internal/lsp/source: more ITV filtering > ce50135 go/analysis/passes/slog: static checks for slog k-v pairs > b9619ee gopls/internal/regtest/bench: run kubernetes benchmarks with -short > 21a4769 gopls: remove related info for informational diagnostic > 6deeacb all: fix remaining tests on js/wasm > bfcd41e gopls/internal/lsp/source: add missing punctuation to stubbed method doc > 1c5ccad gopls: add a 'stats' subcommand > 9c9e11f gopls/internal/lsp/cache: load modules by dir, not module path > b35949e gopls/internal/lsp/source: filter intermediate test variants > 133605d gopls/internal/lsp/cache: remove spurious error check > 240a4dc gopls/internal/lsp/cmd: add instrumentation for TestFix > ed3ff1b gopls/internal/lsp: finish debouncing on context cancellation > 780626c all: fix non-gopls short tests on js/wasm and update for wasip1/wasm > 13c52bc internal/gocommand: stop copying stdout as soon as ctx is done > 641e4d7 gopls/doc: update coc.nvim config > 85d651a go/analysis/checker/internal: resolve Diagnostic.URLs > 54c806f gopls/internal/lsp: eliminate more uses of Span > 60d9c06 go/analysis/passes: skip passes that do not import relevant packages > 0d77eea gopls/internal/regstest/misc: use go 1.19 instead of 1.29 in TestIssue59124 > 1b2d1bd gopls/internal/lsp/cache: improve precision of cache key > b6f4d07 gopls/internal/lsp: fix initial diagnostics pass > d03c59d gopls/internal/lsp/source/typerefs: serialization support > 6492058 gopls: strict LSP compliance for empty slices > 0f415ef gopls/internal/lsp/source: support hover over non-decimal int literals > 40fb89c internal/lsp/testdata: correct DefinitionsCount in 1.21 summary file > a4ffa6e internal/lsp/testdata: update 'bad0' diagnostics test for 1.21 > 5bcc1bd gopls/internal/lsp/filecache: evict aggressively on Go builders > 866a200 internal/gocommand: more tweaks to DebugHangingGoCommands > a5338c9 go/types/objectpath: add Encoder type, to amortize Scope.Names > 45ef829 gopls/internal/lsp/filecache: add integrity check > 4bea115 gopls/internal/lsp/source/typerefs: collapse SCCs of ref graph > 5ef3193 gopls/internal/lsp/source/typerefs: reexpress tests wrt ExternalRefs > c5f768a go.mod: update golang.org/x dependencies > 7c33a56 gopls/internal/lsp/source: show both the original declaration and the value of constants in hover > 4d205d8 gopls/doc: add instructions for using go.work with the Go distribution > d5076cc gopls/internal/lsp/cache: don't trace a region for MetadataForFile > f796361 gopls/internal/lsp: add tracing instrumentation for all Server methods > e104501 gopls/internal/astutil: TestPurgeFuncBodies requires source code for std > 6520870 gopls/internal/lsp/source/typerefs: allow for duplicate decls > 902fdca gopls/internal/lsp/source/typerefs: purge func bodies before parsing > 58c9a63 go/packages/internal/nodecount: count ast.Node frequency > 0a3e5f0 gopls: use safetoken.Line to compute line numbers > f4e613e go/analysis/passes/tests: enable fuzz checks in 'tests' analysis pass for cmd/vet > 6546e8e gopls/internal/lsp/source/typerefs: new package to analyze syntax deps > 04059e1 gopls/internal/lsp/cache: record unloadable files if loading completes > 4b11203 gopls/internal/lsp/cache: parse the builtin file through the cache > bc35a69 gopls/internal/lsp/source: fix references expansion bug > 374b64a go/types/internal/play: show AST debug representation too > 13850b3 gopls/internal/lsp/regtest: move @symbol to new marker tests > e9188f8 go/analysis/analysistest: Validate analyzers in Run > cc511f4 gopls/internal/lsp/regtest: move @implementation to new framework > e0ecd1b go/analysis/passes/printf: check new fmt.Appendf function too > 488ba86 gopls/internal/lsp/cache: hold on to imports used by open packages > d52bc56 gopls/internal/lsp: reorder the way we compute diagnostics > 83c1ba1 gopls/internal/lsp/cache: fix two crashes when parsed file overflows > cbe6614 go/analysis/passes/printf: improve documentation > 255eeeb go/.../analysisutil: ExtractDoc unifies Analyzer.Doc and package doc > 1b71eda gopls/internal/regtest/bench: add flags to reuse benchmark repo dirs > f8a7325 gopls/internal/lsp/cache: use json encoding for diagnostics > df92f17 gopls: pre-initialize the file cache > c3edf5a gopls/internal/lsp/cache: actually preload files in parallel > acaae98 gopls/internal/lsp/cache: stream package results > fa55648 gopls/internal/lsp/cache: evaluate imports lazily in TypeCheck > a164829 gopls/internal/lsp/cache: add additional debug assertions during parsing > 665c922 gopls/internal/lsp/source: fix panic in quickParse > ff76038 go/analysis/passes/printf: improve workaround doc > b222520 gopls/internal/cache: use AddExistingFiles in the parse cache > 6e5f425 gopls/mod: show hint for discordant module versions > e5f7ae1 go/analysis: add Analyser.URL and Diagnostic.URI fields > b6dbcf8 internal/gcimporter: have IImportShallow accept an import func > 35ef64e internal/tool: add the profile.alloc flag > 912861f gopls/internal/lsp/cache: skip object resolution during parsing > c881168 internal/tokeninternal: add AddExistingFiles helper > c4b943d gopls/internal/lsp: delay workspace diagnostics and analysis > c17e55e gopls/internal/lsp/cmd: definition on items without support for hover. > 537c4aa gopls/internal/regtest: port @refs to new marker tests > 36ed0b1 gopls/internal/lsp/source: rename snapshot.GetFile to ReadFile > 4feee84 go/types/internal/play: a playground for go/types > 243a948 internal/lsp/regtest: have the regtests control their diagnosticsDelay > ae907a4 gopls/internal/lsp/cache: pre-load files after loading packages > 293fdc9 gopls/internal/lsp/cache: don't ignore type-errors that can't be mapped > 6bb0e47 gopls/internal/lsp: improve concurrency of the diagnostics pass > e4da1ee gopls/internal/lsp/debug: show log of recent spans > dd1e2f6 cmd/present/static: fork needed godoc static resources > 75c657b gopls/internal/regtest/bench: small fixes for DiagnoseChange > 786752b gopls/internal/lsp/source: rename FileHandle.Read to Content > edc0084 gopls/internal/regtest/bench: narrow the -short guard in iwl_test.go > 656f17c gopls/internal/lsp/cache: parallelize getPackageData > bac9896 gopls/internal/regtest/marker: add a test for golang/go# 56943 bumping knative.dev/pkg aef227e...8d3f951: > 8d3f951 Allow overriding webhook secret data keys (# 2662) > c11003a Use go sync/atomic instead of go.uber.org/atomic (# 2777) > b3a65a0 Bump github.com/gorilla/websocket from 1.4.2 to 1.5.0 (# 2775) > e888f79 rename-sandbox (# 2779) > 532e082 Update actions (# 2778) > 72f2648 Bump go.uber.org/zap from 1.19.1 to 1.24.0 (# 2774) > 7b50f3c Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 (# 2771) > 1ea9b2d Bump github.com/tsenart/vegeta/v12 from 12.8.4 to 12.11.0 (# 2772) > 4866914 Fix github action for dependabot (# 2776) > edf95e6 Bump actions/setup-go from 3 to 4 (# 2770) > 801a900 Add dependabot and auto update deps (# 2768) > aa56e29 Update community files (# 2769) bumping github.com/gorilla/websocket b65e629...9111bb8: > 9111bb8 Dialer: add optional method NetDialTLSContext (# 746) > 2f25f78 Update README (# 757) > 4fad403 Remove support for Go 1.8 > f0643a3 Improve protocol error messages > 2d6ee4c Update autobahn example > beca1d3 Fix broadcast benchmarks (# 542) > bcef843 Use context.Context in TLS handshake (# 751) > 2c89656 Modify http Method String Literal to Variable (# 728) > 1905f7e Update source to match output from gofmt 1.17 > b4b5d88 Document the allowed concurrency on Upgrader and Dialer (# 636) > e8629af improve echo example (# 671) > c3dd95a build: use build matrix; drop Go <= 1.10 (# 629) > 78ab81e docs: clarify that sub protocols are not set via responseHeader arg. > 873e67e Fix how the client checks for presence of Upgrade: websocket, Connection: upgrade (# 604) bumping knative.dev/networking 75dcd54...29da3ac: > 29da3ac rename-sandbox (# 833) > 23adcb7 Update actions (# 832) > 964322c Fix comment for old config (# 831) > b13f88f Update community files (# 829) bumping knative.dev/hack ddae802...338500e: > 338500e Update actions (# 304) > 6f48889 Update community files (# 303) bumping golang.org/x/mod 69aa7ac...baa5c2d: > baa5c2d all: add godoc links > 7603649 zip: fix TestCreateFromDirSpecial/ignore_symlink on wasmtime > 22d21f4 zip: fix doc for CreateFromVCS function > bfed713 zip: fix LICENSE file handling to match modfetch > 62c7e57 sumdb: handle panic from c.ReadRemote during ReadTiles > 2a1c06a modfile: update toolchain syntax > e81ad10 sumdb: correct spelling mistakes > e343115 sumdb: add missing return after http.Error > fc83a8f modfile: add support for dropping go and toolchain stmts > 1846133 modfile: add parsing support for toolchain > a73672d modfile: add support for go and toolchain lines > e7bea8f modfile: use semantic sort for exclude blocks > ad6fd61 zip: fix on Windows bumping golang.org/x/sync 1ea3257...93782cc: > 93782cc errgroup: use WithCancelCause to cancel context > 4966af6 singleflight: example for using Group > a6666c1 go.mod: upgrade to go 1.17 Signed-off-by: Knative Automation --- go.mod | 14 +- go.sum | 28 ++-- vendor/github.com/gorilla/websocket/README.md | 39 +---- vendor/github.com/gorilla/websocket/client.go | 77 ++++++--- .../gorilla/websocket/client_clone.go | 16 -- .../gorilla/websocket/client_clone_legacy.go | 38 ----- vendor/github.com/gorilla/websocket/conn.go | 63 ++++++-- .../gorilla/websocket/conn_write.go | 15 -- .../gorilla/websocket/conn_write_legacy.go | 18 --- vendor/github.com/gorilla/websocket/mask.go | 1 + .../github.com/gorilla/websocket/mask_safe.go | 1 + vendor/github.com/gorilla/websocket/proxy.go | 2 +- vendor/github.com/gorilla/websocket/server.go | 8 +- .../gorilla/websocket/tls_handshake.go | 21 +++ .../gorilla/websocket/tls_handshake_116.go | 21 +++ vendor/github.com/gorilla/websocket/trace.go | 19 --- .../github.com/gorilla/websocket/trace_17.go | 12 -- .../x/mod/internal/lazyregexp/lazyre.go | 2 +- vendor/golang.org/x/mod/module/module.go | 30 ++-- vendor/golang.org/x/mod/module/pseudo.go | 2 +- vendor/golang.org/x/mod/semver/semver.go | 6 +- vendor/golang.org/x/sync/errgroup/errgroup.go | 10 +- vendor/golang.org/x/sync/errgroup/go120.go | 14 ++ .../golang.org/x/sync/errgroup/pre_go120.go | 15 ++ .../x/tools/internal/event/tag/tag.go | 59 +++++++ .../x/tools/internal/fastwalk/fastwalk.go | 16 +- .../x/tools/internal/gocommand/invoke.go | 146 +++++++++++++++--- .../x/tools/internal/gocommand/version.go | 18 +-- .../x/tools/internal/imports/fix.go | 40 ++++- .../x/tools/internal/imports/imports.go | 9 +- .../x/tools/internal/imports/mod.go | 12 +- .../x/tools/internal/typeparams/common.go | 20 +++ .../networking/config/config-network.yaml | 8 +- .../test/conformance/ingress/README.md | 4 +- vendor/knative.dev/pkg/metrics/metrics.go | 6 +- vendor/knative.dev/pkg/profiling/server.go | 7 +- .../pkg/reconciler/testing/context.go | 7 +- .../pkg/reconciler/testing/hooks.go | 14 +- vendor/knative.dev/pkg/test/zipkin/util.go | 2 +- vendor/knative.dev/pkg/webhook/helper.go | 14 ++ vendor/knative.dev/pkg/webhook/webhook.go | 16 +- vendor/modules.txt | 17 +- 42 files changed, 559 insertions(+), 328 deletions(-) delete mode 100644 vendor/github.com/gorilla/websocket/client_clone.go delete mode 100644 vendor/github.com/gorilla/websocket/client_clone_legacy.go delete mode 100644 vendor/github.com/gorilla/websocket/conn_write.go delete mode 100644 vendor/github.com/gorilla/websocket/conn_write_legacy.go create mode 100644 vendor/github.com/gorilla/websocket/tls_handshake.go create mode 100644 vendor/github.com/gorilla/websocket/tls_handshake_116.go delete mode 100644 vendor/github.com/gorilla/websocket/trace.go delete mode 100644 vendor/github.com/gorilla/websocket/trace_17.go create mode 100644 vendor/golang.org/x/sync/errgroup/go120.go create mode 100644 vendor/golang.org/x/sync/errgroup/pre_go120.go create mode 100644 vendor/golang.org/x/tools/internal/event/tag/tag.go diff --git a/go.mod b/go.mod index 5ce687c99..9dc79f465 100644 --- a/go.mod +++ b/go.mod @@ -21,9 +21,9 @@ require ( k8s.io/apimachinery v0.26.5 k8s.io/client-go v0.26.5 k8s.io/code-generator v0.26.5 - knative.dev/hack v0.0.0-20230712131415-ddae80293c43 - knative.dev/networking v0.0.0-20230718160410-75dcd54d9510 - knative.dev/pkg v0.0.0-20230718152110-aef227e72ead + knative.dev/hack v0.0.0-20230802014852-338500eed425 + knative.dev/networking v0.0.0-20230802091048-29da3ac7ef4d + knative.dev/pkg v0.0.0-20230802191948-8d3f95106327 ) require ( @@ -52,7 +52,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect + github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect github.com/imdario/mergo v0.3.9 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -78,15 +78,15 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/automaxprocs v1.5.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/mod v0.9.0 // indirect + golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.2.0 // indirect + golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/term v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/tools v0.11.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/api v0.124.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 0043b8941..21e589f68 100644 --- a/go.sum +++ b/go.sum @@ -205,8 +205,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk= @@ -432,8 +432,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -491,8 +491,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -601,8 +601,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= +golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= 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= @@ -760,12 +760,12 @@ k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+O k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/hack v0.0.0-20230712131415-ddae80293c43 h1:3SE06uNfSFGm/5XS+0trbyCUpgsOaBeyhPQU8FPNFz8= -knative.dev/hack v0.0.0-20230712131415-ddae80293c43/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/networking v0.0.0-20230718160410-75dcd54d9510 h1:eNbWjEkbtGjCqK5TB4S0CjSSDd4PvyXm+w7bM9/zce4= -knative.dev/networking v0.0.0-20230718160410-75dcd54d9510/go.mod h1:Vngl91M++hqgoGNIjCii7MXnsEeN3kRbGC1aodhFqbk= -knative.dev/pkg v0.0.0-20230718152110-aef227e72ead h1:2dDzorpKuVZW3Qp7TbirMMq16FbId8f6bacQFX8jXLw= -knative.dev/pkg v0.0.0-20230718152110-aef227e72ead/go.mod h1:WmrwRV/P+hGHoMraAEfwg6ec+fBTf+Obu41v354Iabc= +knative.dev/hack v0.0.0-20230802014852-338500eed425 h1:/4R6Jbsfq3O7PTlVA4XcePxS/UAOZZ/qE4AdozSjy2s= +knative.dev/hack v0.0.0-20230802014852-338500eed425/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= +knative.dev/networking v0.0.0-20230802091048-29da3ac7ef4d h1:v6vVLhZvUQXFaer8lpJvcE/YZGzkAjF7rXJNQMg9jnE= +knative.dev/networking v0.0.0-20230802091048-29da3ac7ef4d/go.mod h1:Vngl91M++hqgoGNIjCii7MXnsEeN3kRbGC1aodhFqbk= +knative.dev/pkg v0.0.0-20230802191948-8d3f95106327 h1:YvgaCUbXU7S9lJpm+Qh/z6LGiTSAWhyJLs5E/6dIx+8= +knative.dev/pkg v0.0.0-20230802191948-8d3f95106327/go.mod h1:iOH3bns9qjwY1/Ufq3/Vaqd+Lsk65b7yMFcWG3EriiI= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md index 19aa2e75c..2517a2871 100644 --- a/vendor/github.com/gorilla/websocket/README.md +++ b/vendor/github.com/gorilla/websocket/README.md @@ -6,6 +6,13 @@ Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. + +--- + +⚠️ **[The Gorilla WebSocket Package is looking for a new maintainer](https://github.com/gorilla/websocket/issues/370)** + +--- + ### Documentation * [API Reference](https://pkg.go.dev/github.com/gorilla/websocket?tab=doc) @@ -30,35 +37,3 @@ The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). -### Gorilla WebSocket compared with other packages - - - - - - - - - - - - - - - - - - -
github.com/gorillagolang.org/x/net
RFC 6455 Features
Passes Autobahn Test SuiteYesNo
Receive fragmented messageYesNo, see note 1
Send close messageYesNo
Send pings and receive pongsYesNo
Get the type of a received data messageYesYes, see note 2
Other Features
Compression ExtensionsExperimentalNo
Read message using io.ReaderYesNo, see note 3
Write message using io.WriteCloserYesNo, see note 3
- -Notes: - -1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html). -2. The application can get the type of a received data message by implementing - a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal) - function. -3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries. - Read returns when the input buffer is full or a frame boundary is - encountered. Each call to Write sends a single frame message. The Gorilla - io.Reader and io.WriteCloser operate on a single WebSocket message. - diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go index 962c06a39..2efd83555 100644 --- a/vendor/github.com/gorilla/websocket/client.go +++ b/vendor/github.com/gorilla/websocket/client.go @@ -48,15 +48,23 @@ func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufS } // A Dialer contains options for connecting to WebSocket server. +// +// It is safe to call Dialer's methods concurrently. type Dialer struct { // NetDial specifies the dial function for creating TCP connections. If // NetDial is nil, net.Dial is used. NetDial func(network, addr string) (net.Conn, error) // NetDialContext specifies the dial function for creating TCP connections. If - // NetDialContext is nil, net.DialContext is used. + // NetDialContext is nil, NetDial is used. NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) + // NetDialTLSContext specifies the dial function for creating TLS/TCP connections. If + // NetDialTLSContext is nil, NetDialContext is used. + // If NetDialTLSContext is set, Dial assumes the TLS handshake is done there and + // TLSClientConfig is ignored. + NetDialTLSContext func(ctx context.Context, network, addr string) (net.Conn, error) + // Proxy specifies a function to return a proxy for a given // Request. If the function returns a non-nil error, the // request is aborted with the provided error. @@ -65,6 +73,8 @@ type Dialer struct { // TLSClientConfig specifies the TLS configuration to use with tls.Client. // If nil, the default configuration is used. + // If either NetDialTLS or NetDialTLSContext are set, Dial assumes the TLS handshake + // is done there and TLSClientConfig is ignored. TLSClientConfig *tls.Config // HandshakeTimeout specifies the duration for the handshake to complete. @@ -176,7 +186,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } req := &http.Request{ - Method: "GET", + Method: http.MethodGet, URL: u, Proto: "HTTP/1.1", ProtoMajor: 1, @@ -237,13 +247,32 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h // Get network dial function. var netDial func(network, add string) (net.Conn, error) - if d.NetDialContext != nil { - netDial = func(network, addr string) (net.Conn, error) { - return d.NetDialContext(ctx, network, addr) + switch u.Scheme { + case "http": + if d.NetDialContext != nil { + netDial = func(network, addr string) (net.Conn, error) { + return d.NetDialContext(ctx, network, addr) + } + } else if d.NetDial != nil { + netDial = d.NetDial } - } else if d.NetDial != nil { - netDial = d.NetDial - } else { + case "https": + if d.NetDialTLSContext != nil { + netDial = func(network, addr string) (net.Conn, error) { + return d.NetDialTLSContext(ctx, network, addr) + } + } else if d.NetDialContext != nil { + netDial = func(network, addr string) (net.Conn, error) { + return d.NetDialContext(ctx, network, addr) + } + } else if d.NetDial != nil { + netDial = d.NetDial + } + default: + return nil, nil, errMalformedURL + } + + if netDial == nil { netDialer := &net.Dialer{} netDial = func(network, addr string) (net.Conn, error) { return netDialer.DialContext(ctx, network, addr) @@ -304,7 +333,9 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } }() - if u.Scheme == "https" { + if u.Scheme == "https" && d.NetDialTLSContext == nil { + // If NetDialTLSContext is set, assume that the TLS handshake has already been done + cfg := cloneTLSConfig(d.TLSClientConfig) if cfg.ServerName == "" { cfg.ServerName = hostNoPort @@ -312,11 +343,12 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h tlsConn := tls.Client(netConn, cfg) netConn = tlsConn - var err error - if trace != nil { - err = doHandshakeWithTrace(trace, tlsConn, cfg) - } else { - err = doHandshake(tlsConn, cfg) + if trace != nil && trace.TLSHandshakeStart != nil { + trace.TLSHandshakeStart() + } + err := doHandshake(ctx, tlsConn, cfg) + if trace != nil && trace.TLSHandshakeDone != nil { + trace.TLSHandshakeDone(tlsConn.ConnectionState(), err) } if err != nil { @@ -348,8 +380,8 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } if resp.StatusCode != 101 || - !strings.EqualFold(resp.Header.Get("Upgrade"), "websocket") || - !strings.EqualFold(resp.Header.Get("Connection"), "upgrade") || + !tokenListContainsValue(resp.Header, "Upgrade", "websocket") || + !tokenListContainsValue(resp.Header, "Connection", "upgrade") || resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) { // Before closing the network connection on return from this // function, slurp up some of the response to aid application @@ -382,14 +414,9 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h return conn, resp, nil } -func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error { - if err := tlsConn.Handshake(); err != nil { - return err - } - if !cfg.InsecureSkipVerify { - if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { - return err - } +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} } - return nil + return cfg.Clone() } diff --git a/vendor/github.com/gorilla/websocket/client_clone.go b/vendor/github.com/gorilla/websocket/client_clone.go deleted file mode 100644 index 4f0d94372..000000000 --- a/vendor/github.com/gorilla/websocket/client_clone.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.8 - -package websocket - -import "crypto/tls" - -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return cfg.Clone() -} diff --git a/vendor/github.com/gorilla/websocket/client_clone_legacy.go b/vendor/github.com/gorilla/websocket/client_clone_legacy.go deleted file mode 100644 index babb007fb..000000000 --- a/vendor/github.com/gorilla/websocket/client_clone_legacy.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.8 - -package websocket - -import "crypto/tls" - -// cloneTLSConfig clones all public fields except the fields -// SessionTicketsDisabled and SessionTicketKey. This avoids copying the -// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a -// config in active use. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - } -} diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go index ca46d2f79..331eebc85 100644 --- a/vendor/github.com/gorilla/websocket/conn.go +++ b/vendor/github.com/gorilla/websocket/conn.go @@ -13,6 +13,7 @@ import ( "math/rand" "net" "strconv" + "strings" "sync" "time" "unicode/utf8" @@ -401,6 +402,12 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error return nil } +func (c *Conn) writeBufs(bufs ...[]byte) error { + b := net.Buffers(bufs) + _, err := b.WriteTo(c.conn) + return err +} + // WriteControl writes a control message with the given deadline. The allowed // message types are CloseMessage, PingMessage and PongMessage. func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error { @@ -794,47 +801,69 @@ func (c *Conn) advanceFrame() (int, error) { } // 2. Read and parse first two bytes of frame header. + // To aid debugging, collect and report all errors in the first two bytes + // of the header. + + var errors []string p, err := c.read(2) if err != nil { return noFrame, err } - final := p[0]&finalBit != 0 frameType := int(p[0] & 0xf) + final := p[0]&finalBit != 0 + rsv1 := p[0]&rsv1Bit != 0 + rsv2 := p[0]&rsv2Bit != 0 + rsv3 := p[0]&rsv3Bit != 0 mask := p[1]&maskBit != 0 c.setReadRemaining(int64(p[1] & 0x7f)) c.readDecompress = false - if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 { - c.readDecompress = true - p[0] &^= rsv1Bit + if rsv1 { + if c.newDecompressionReader != nil { + c.readDecompress = true + } else { + errors = append(errors, "RSV1 set") + } + } + + if rsv2 { + errors = append(errors, "RSV2 set") } - if rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 { - return noFrame, c.handleProtocolError("unexpected reserved bits 0x" + strconv.FormatInt(int64(rsv), 16)) + if rsv3 { + errors = append(errors, "RSV3 set") } switch frameType { case CloseMessage, PingMessage, PongMessage: if c.readRemaining > maxControlFramePayloadSize { - return noFrame, c.handleProtocolError("control frame length > 125") + errors = append(errors, "len > 125 for control") } if !final { - return noFrame, c.handleProtocolError("control frame not final") + errors = append(errors, "FIN not set on control") } case TextMessage, BinaryMessage: if !c.readFinal { - return noFrame, c.handleProtocolError("message start before final message frame") + errors = append(errors, "data before FIN") } c.readFinal = final case continuationFrame: if c.readFinal { - return noFrame, c.handleProtocolError("continuation after final message frame") + errors = append(errors, "continuation after FIN") } c.readFinal = final default: - return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType)) + errors = append(errors, "bad opcode "+strconv.Itoa(frameType)) + } + + if mask != c.isServer { + errors = append(errors, "bad MASK") + } + + if len(errors) > 0 { + return noFrame, c.handleProtocolError(strings.Join(errors, ", ")) } // 3. Read and parse frame length as per @@ -872,10 +901,6 @@ func (c *Conn) advanceFrame() (int, error) { // 4. Handle frame masking. - if mask != c.isServer { - return noFrame, c.handleProtocolError("incorrect mask flag") - } - if mask { c.readMaskPos = 0 p, err := c.read(len(c.readMaskKey)) @@ -935,7 +960,7 @@ func (c *Conn) advanceFrame() (int, error) { if len(payload) >= 2 { closeCode = int(binary.BigEndian.Uint16(payload)) if !isValidReceivedCloseCode(closeCode) { - return noFrame, c.handleProtocolError("invalid close code") + return noFrame, c.handleProtocolError("bad close code " + strconv.Itoa(closeCode)) } closeText = string(payload[2:]) if !utf8.ValidString(closeText) { @@ -952,7 +977,11 @@ func (c *Conn) advanceFrame() (int, error) { } func (c *Conn) handleProtocolError(message string) error { - c.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait)) + data := FormatCloseMessage(CloseProtocolError, message) + if len(data) > maxControlFramePayloadSize { + data = data[:maxControlFramePayloadSize] + } + c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)) return errors.New("websocket: " + message) } diff --git a/vendor/github.com/gorilla/websocket/conn_write.go b/vendor/github.com/gorilla/websocket/conn_write.go deleted file mode 100644 index a509a21f8..000000000 --- a/vendor/github.com/gorilla/websocket/conn_write.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.8 - -package websocket - -import "net" - -func (c *Conn) writeBufs(bufs ...[]byte) error { - b := net.Buffers(bufs) - _, err := b.WriteTo(c.conn) - return err -} diff --git a/vendor/github.com/gorilla/websocket/conn_write_legacy.go b/vendor/github.com/gorilla/websocket/conn_write_legacy.go deleted file mode 100644 index 37edaff5a..000000000 --- a/vendor/github.com/gorilla/websocket/conn_write_legacy.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.8 - -package websocket - -func (c *Conn) writeBufs(bufs ...[]byte) error { - for _, buf := range bufs { - if len(buf) > 0 { - if _, err := c.conn.Write(buf); err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go index 577fce9ef..d0742bf2a 100644 --- a/vendor/github.com/gorilla/websocket/mask.go +++ b/vendor/github.com/gorilla/websocket/mask.go @@ -2,6 +2,7 @@ // this source code is governed by a BSD-style license that can be found in the // LICENSE file. +//go:build !appengine // +build !appengine package websocket diff --git a/vendor/github.com/gorilla/websocket/mask_safe.go b/vendor/github.com/gorilla/websocket/mask_safe.go index 2aac060e5..36250ca7c 100644 --- a/vendor/github.com/gorilla/websocket/mask_safe.go +++ b/vendor/github.com/gorilla/websocket/mask_safe.go @@ -2,6 +2,7 @@ // this source code is governed by a BSD-style license that can be found in the // LICENSE file. +//go:build appengine // +build appengine package websocket diff --git a/vendor/github.com/gorilla/websocket/proxy.go b/vendor/github.com/gorilla/websocket/proxy.go index e87a8c9f0..e0f466b72 100644 --- a/vendor/github.com/gorilla/websocket/proxy.go +++ b/vendor/github.com/gorilla/websocket/proxy.go @@ -48,7 +48,7 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) } connectReq := &http.Request{ - Method: "CONNECT", + Method: http.MethodConnect, URL: &url.URL{Opaque: addr}, Host: addr, Header: connectHeader, diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go index 887d55891..24d53b38a 100644 --- a/vendor/github.com/gorilla/websocket/server.go +++ b/vendor/github.com/gorilla/websocket/server.go @@ -23,6 +23,8 @@ func (e HandshakeError) Error() string { return e.message } // Upgrader specifies parameters for upgrading an HTTP connection to a // WebSocket connection. +// +// It is safe to call Upgrader's methods concurrently. type Upgrader struct { // HandshakeTimeout specifies the duration for the handshake to complete. HandshakeTimeout time.Duration @@ -115,8 +117,8 @@ func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header // Upgrade upgrades the HTTP server connection to the WebSocket protocol. // // The responseHeader is included in the response to the client's upgrade -// request. Use the responseHeader to specify cookies (Set-Cookie) and the -// application negotiated subprotocol (Sec-WebSocket-Protocol). +// request. Use the responseHeader to specify cookies (Set-Cookie). To specify +// subprotocols supported by the server, set Upgrader.Subprotocols directly. // // If the upgrade fails, then Upgrade replies to the client with an HTTP error // response. @@ -131,7 +133,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'websocket' token not found in 'Upgrade' header") } - if r.Method != "GET" { + if r.Method != http.MethodGet { return u.returnError(w, r, http.StatusMethodNotAllowed, badHandshake+"request method is not GET") } diff --git a/vendor/github.com/gorilla/websocket/tls_handshake.go b/vendor/github.com/gorilla/websocket/tls_handshake.go new file mode 100644 index 000000000..a62b68ccb --- /dev/null +++ b/vendor/github.com/gorilla/websocket/tls_handshake.go @@ -0,0 +1,21 @@ +//go:build go1.17 +// +build go1.17 + +package websocket + +import ( + "context" + "crypto/tls" +) + +func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error { + if err := tlsConn.HandshakeContext(ctx); err != nil { + return err + } + if !cfg.InsecureSkipVerify { + if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/gorilla/websocket/tls_handshake_116.go b/vendor/github.com/gorilla/websocket/tls_handshake_116.go new file mode 100644 index 000000000..e1b2b44f6 --- /dev/null +++ b/vendor/github.com/gorilla/websocket/tls_handshake_116.go @@ -0,0 +1,21 @@ +//go:build !go1.17 +// +build !go1.17 + +package websocket + +import ( + "context" + "crypto/tls" +) + +func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error { + if err := tlsConn.Handshake(); err != nil { + return err + } + if !cfg.InsecureSkipVerify { + if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/gorilla/websocket/trace.go b/vendor/github.com/gorilla/websocket/trace.go deleted file mode 100644 index 834f122a0..000000000 --- a/vendor/github.com/gorilla/websocket/trace.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build go1.8 - -package websocket - -import ( - "crypto/tls" - "net/http/httptrace" -) - -func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error { - if trace.TLSHandshakeStart != nil { - trace.TLSHandshakeStart() - } - err := doHandshake(tlsConn, cfg) - if trace.TLSHandshakeDone != nil { - trace.TLSHandshakeDone(tlsConn.ConnectionState(), err) - } - return err -} diff --git a/vendor/github.com/gorilla/websocket/trace_17.go b/vendor/github.com/gorilla/websocket/trace_17.go deleted file mode 100644 index 77d05a0b5..000000000 --- a/vendor/github.com/gorilla/websocket/trace_17.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !go1.8 - -package websocket - -import ( - "crypto/tls" - "net/http/httptrace" -) - -func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error { - return doHandshake(tlsConn, cfg) -} diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go index 2681af35a..150f887e7 100644 --- a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go +++ b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go @@ -13,7 +13,7 @@ import ( "sync" ) -// Regexp is a wrapper around regexp.Regexp, where the underlying regexp will be +// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be // compiled the first time it is needed. type Regexp struct { str string diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go index e9dec6e61..2a364b229 100644 --- a/vendor/golang.org/x/mod/module/module.go +++ b/vendor/golang.org/x/mod/module/module.go @@ -4,7 +4,7 @@ // Package module defines the module.Version type along with support code. // -// The module.Version type is a simple Path, Version pair: +// The [module.Version] type is a simple Path, Version pair: // // type Version struct { // Path string @@ -12,7 +12,7 @@ // } // // There are no restrictions imposed directly by use of this structure, -// but additional checking functions, most notably Check, verify that +// but additional checking functions, most notably [Check], verify that // a particular path, version pair is valid. // // # Escaped Paths @@ -140,7 +140,7 @@ type ModuleError struct { Err error } -// VersionError returns a ModuleError derived from a Version and error, +// VersionError returns a [ModuleError] derived from a [Version] and error, // or err itself if it is already such an error. func VersionError(v Version, err error) error { var mErr *ModuleError @@ -169,7 +169,7 @@ func (e *ModuleError) Unwrap() error { return e.Err } // An InvalidVersionError indicates an error specific to a version, with the // module path unknown or specified externally. // -// A ModuleError may wrap an InvalidVersionError, but an InvalidVersionError +// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError // must not wrap a ModuleError. type InvalidVersionError struct { Version string @@ -193,8 +193,8 @@ func (e *InvalidVersionError) Error() string { func (e *InvalidVersionError) Unwrap() error { return e.Err } // An InvalidPathError indicates a module, import, or file path doesn't -// satisfy all naming constraints. See CheckPath, CheckImportPath, -// and CheckFilePath for specific restrictions. +// satisfy all naming constraints. See [CheckPath], [CheckImportPath], +// and [CheckFilePath] for specific restrictions. type InvalidPathError struct { Kind string // "module", "import", or "file" Path string @@ -294,7 +294,7 @@ func fileNameOK(r rune) bool { } // CheckPath checks that a module path is valid. -// A valid module path is a valid import path, as checked by CheckImportPath, +// A valid module path is a valid import path, as checked by [CheckImportPath], // with three additional constraints. // First, the leading path element (up to the first slash, if any), // by convention a domain name, must contain only lower-case ASCII letters, @@ -380,7 +380,7 @@ const ( // checkPath returns an error describing why the path is not valid. // Because these checks apply to module, import, and file paths, // and because other checks may be applied, the caller is expected to wrap -// this error with InvalidPathError. +// this error with [InvalidPathError]. func checkPath(path string, kind pathKind) error { if !utf8.ValidString(path) { return fmt.Errorf("invalid UTF-8") @@ -532,7 +532,7 @@ var badWindowsNames = []string{ // they require ".vN" instead of "/vN", and for all N, not just N >= 2. // SplitPathVersion returns with ok = false when presented with // a path whose last path element does not satisfy the constraints -// applied by CheckPath, such as "example.com/pkg/v1" or "example.com/pkg/v1.2". +// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2". func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { if strings.HasPrefix(path, "gopkg.in/") { return splitGopkgIn(path) @@ -582,7 +582,7 @@ func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { // MatchPathMajor reports whether the semantic version v // matches the path major version pathMajor. // -// MatchPathMajor returns true if and only if CheckPathMajor returns nil. +// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil. func MatchPathMajor(v, pathMajor string) bool { return CheckPathMajor(v, pathMajor) == nil } @@ -622,7 +622,7 @@ func CheckPathMajor(v, pathMajor string) error { // PathMajorPrefix returns the major-version tag prefix implied by pathMajor. // An empty PathMajorPrefix allows either v0 or v1. // -// Note that MatchPathMajor may accept some versions that do not actually begin +// Note that [MatchPathMajor] may accept some versions that do not actually begin // with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' // pathMajor, even though that pathMajor implies 'v1' tagging. func PathMajorPrefix(pathMajor string) string { @@ -643,7 +643,7 @@ func PathMajorPrefix(pathMajor string) string { } // CanonicalVersion returns the canonical form of the version string v. -// It is the same as semver.Canonical(v) except that it preserves the special build suffix "+incompatible". +// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible". func CanonicalVersion(v string) string { cv := semver.Canonical(v) if semver.Build(v) == "+incompatible" { @@ -652,8 +652,8 @@ func CanonicalVersion(v string) string { return cv } -// Sort sorts the list by Path, breaking ties by comparing Version fields. -// The Version fields are interpreted as semantic versions (using semver.Compare) +// Sort sorts the list by Path, breaking ties by comparing [Version] fields. +// The Version fields are interpreted as semantic versions (using [semver.Compare]) // optionally followed by a tie-breaking suffix introduced by a slash character, // like in "v0.0.1/go.mod". func Sort(list []Version) { @@ -793,7 +793,7 @@ func unescapeString(escaped string) (string, bool) { } // MatchPrefixPatterns reports whether any path prefix of target matches one of -// the glob patterns (as defined by path.Match) in the comma-separated globs +// the glob patterns (as defined by [path.Match]) in the comma-separated globs // list. This implements the algorithm used when matching a module path to the // GOPRIVATE environment variable, as described by 'go help module-private'. // diff --git a/vendor/golang.org/x/mod/module/pseudo.go b/vendor/golang.org/x/mod/module/pseudo.go index f04ad3788..9cf19d325 100644 --- a/vendor/golang.org/x/mod/module/pseudo.go +++ b/vendor/golang.org/x/mod/module/pseudo.go @@ -125,7 +125,7 @@ func IsPseudoVersion(v string) bool { } // IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, -// timestamp, and revision, as returned by ZeroPseudoVersion. +// timestamp, and revision, as returned by [ZeroPseudoVersion]. func IsZeroPseudoVersion(v string) bool { return v == ZeroPseudoVersion(semver.Major(v)) } diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go index a30a22bf2..9a2dfd33a 100644 --- a/vendor/golang.org/x/mod/semver/semver.go +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -140,7 +140,7 @@ func Compare(v, w string) int { // Max canonicalizes its arguments and then returns the version string // that compares greater. // -// Deprecated: use Compare instead. In most cases, returning a canonicalized +// Deprecated: use [Compare] instead. In most cases, returning a canonicalized // version is not expected or desired. func Max(v, w string) string { v = Canonical(v) @@ -151,7 +151,7 @@ func Max(v, w string) string { return w } -// ByVersion implements sort.Interface for sorting semantic version strings. +// ByVersion implements [sort.Interface] for sorting semantic version strings. type ByVersion []string func (vs ByVersion) Len() int { return len(vs) } @@ -164,7 +164,7 @@ func (vs ByVersion) Less(i, j int) bool { return vs[i] < vs[j] } -// Sort sorts a list of semantic version strings using ByVersion. +// Sort sorts a list of semantic version strings using [ByVersion]. func Sort(list []string) { sort.Sort(ByVersion(list)) } diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go index cbee7a4e2..b18efb743 100644 --- a/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -20,7 +20,7 @@ type token struct{} // A zero Group is valid, has no limit on the number of active goroutines, // and does not cancel on error. type Group struct { - cancel func() + cancel func(error) wg sync.WaitGroup @@ -43,7 +43,7 @@ func (g *Group) done() { // returns a non-nil error or the first time Wait returns, whichever occurs // first. func WithContext(ctx context.Context) (*Group, context.Context) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := withCancelCause(ctx) return &Group{cancel: cancel}, ctx } @@ -52,7 +52,7 @@ func WithContext(ctx context.Context) (*Group, context.Context) { func (g *Group) Wait() error { g.wg.Wait() if g.cancel != nil { - g.cancel() + g.cancel(g.err) } return g.err } @@ -76,7 +76,7 @@ func (g *Group) Go(f func() error) { g.errOnce.Do(func() { g.err = err if g.cancel != nil { - g.cancel() + g.cancel(g.err) } }) } @@ -105,7 +105,7 @@ func (g *Group) TryGo(f func() error) bool { g.errOnce.Do(func() { g.err = err if g.cancel != nil { - g.cancel() + g.cancel(g.err) } }) } diff --git a/vendor/golang.org/x/sync/errgroup/go120.go b/vendor/golang.org/x/sync/errgroup/go120.go new file mode 100644 index 000000000..7d419d376 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/go120.go @@ -0,0 +1,14 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.20 +// +build go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + return context.WithCancelCause(parent) +} diff --git a/vendor/golang.org/x/sync/errgroup/pre_go120.go b/vendor/golang.org/x/sync/errgroup/pre_go120.go new file mode 100644 index 000000000..1795c18ac --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/pre_go120.go @@ -0,0 +1,15 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.20 +// +build !go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + ctx, cancel := context.WithCancel(parent) + return ctx, func(error) { cancel() } +} diff --git a/vendor/golang.org/x/tools/internal/event/tag/tag.go b/vendor/golang.org/x/tools/internal/event/tag/tag.go new file mode 100644 index 000000000..581b26c20 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/tag/tag.go @@ -0,0 +1,59 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tag provides the labels used for telemetry throughout gopls. +package tag + +import ( + "golang.org/x/tools/internal/event/keys" +) + +var ( + // create the label keys we use + Method = keys.NewString("method", "") + StatusCode = keys.NewString("status.code", "") + StatusMessage = keys.NewString("status.message", "") + RPCID = keys.NewString("id", "") + RPCDirection = keys.NewString("direction", "") + File = keys.NewString("file", "") + Directory = keys.New("directory", "") + URI = keys.New("URI", "") + Package = keys.NewString("package", "") // sorted comma-separated list of Package IDs + PackagePath = keys.NewString("package_path", "") + Query = keys.New("query", "") + Snapshot = keys.NewUInt64("snapshot", "") + Operation = keys.NewString("operation", "") + + Position = keys.New("position", "") + Category = keys.NewString("category", "") + PackageCount = keys.NewInt("packages", "") + Files = keys.New("files", "") + Port = keys.NewInt("port", "") + Type = keys.New("type", "") + HoverKind = keys.NewString("hoverkind", "") + + NewServer = keys.NewString("new_server", "A new server was added") + EndServer = keys.NewString("end_server", "A server was shut down") + + ServerID = keys.NewString("server", "The server ID an event is related to") + Logfile = keys.NewString("logfile", "") + DebugAddress = keys.NewString("debug_address", "") + GoplsPath = keys.NewString("gopls_path", "") + ClientID = keys.NewString("client_id", "") + + Level = keys.NewInt("level", "The logging level") +) + +var ( + // create the stats we measure + Started = keys.NewInt64("started", "Count of started RPCs.") + ReceivedBytes = keys.NewInt64("received_bytes", "Bytes received.") //, unit.Bytes) + SentBytes = keys.NewInt64("sent_bytes", "Bytes sent.") //, unit.Bytes) + Latency = keys.NewFloat64("latency_ms", "Elapsed time in milliseconds") //, unit.Milliseconds) +) + +const ( + Inbound = "in" + Outbound = "out" +) diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go index 798fe599b..c40c7e931 100644 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package fastwalk provides a faster version of filepath.Walk for file system +// Package fastwalk provides a faster version of [filepath.Walk] for file system // scanning tools. package fastwalk @@ -23,31 +23,31 @@ var ErrTraverseLink = errors.New("fastwalk: traverse symlink, assuming target is // Child directories will still be traversed. var ErrSkipFiles = errors.New("fastwalk: skip remaining files in directory") -// Walk is a faster implementation of filepath.Walk. +// Walk is a faster implementation of [filepath.Walk]. // -// filepath.Walk's design necessarily calls os.Lstat on each file, +// [filepath.Walk]'s design necessarily calls [os.Lstat] on each file, // even if the caller needs less info. // Many tools need only the type of each file. // On some platforms, this information is provided directly by the readdir // system call, avoiding the need to stat each file individually. // fastwalk_unix.go contains a fork of the syscall routines. // -// See golang.org/issue/16399 +// See golang.org/issue/16399. // // Walk walks the file tree rooted at root, calling walkFn for // each file or directory in the tree, including root. // -// If fastWalk returns filepath.SkipDir, the directory is skipped. +// If Walk returns [filepath.SkipDir], the directory is skipped. // -// Unlike filepath.Walk: +// Unlike [filepath.Walk]: // - file stat calls must be done by the user. // The only provided metadata is the file type, which does not include // any permission bits. // - multiple goroutines stat the filesystem concurrently. The provided // walkFn must be safe for concurrent use. -// - fastWalk can follow symlinks if walkFn returns the TraverseLink +// - Walk can follow symlinks if walkFn returns the TraverseLink // sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. +// Walk from going into symlink cycles. func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { // TODO(bradfitz): make numWorkers configurable? We used a // minimum of 4 to give the kernel more info about multiple diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go index d50551693..8d9fc98d8 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/invoke.go +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -8,10 +8,12 @@ package gocommand import ( "bytes" "context" + "errors" "fmt" "io" "log" "os" + "reflect" "regexp" "runtime" "strconv" @@ -22,6 +24,9 @@ import ( exec "golang.org/x/sys/execabs" "golang.org/x/tools/internal/event" + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" + "golang.org/x/tools/internal/event/tag" ) // An Runner will run go command invocations and serialize @@ -51,9 +56,19 @@ func (runner *Runner) initialize() { // 1.14: go: updating go.mod: existing contents have changed since last read var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`) +// verb is an event label for the go command verb. +var verb = keys.NewString("verb", "go command verb") + +func invLabels(inv Invocation) []label.Label { + return []label.Label{verb.Of(inv.Verb), tag.Directory.Of(inv.WorkingDir)} +} + // Run is a convenience wrapper around RunRaw. // It returns only stdout and a "friendly" error. func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.Run", invLabels(inv)...) + defer done() + stdout, _, friendly, _ := runner.RunRaw(ctx, inv) return stdout, friendly } @@ -61,6 +76,9 @@ func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, e // RunPiped runs the invocation serially, always waiting for any concurrent // invocations to complete first. func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error { + ctx, done := event.Start(ctx, "gocommand.Runner.RunPiped", invLabels(inv)...) + defer done() + _, err := runner.runPiped(ctx, inv, stdout, stderr) return err } @@ -68,6 +86,8 @@ func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stde // RunRaw runs the invocation, serializing requests only if they fight over // go.mod changes. func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.RunRaw", invLabels(inv)...) + defer done() // Make sure the runner is always initialized. runner.initialize() @@ -215,6 +235,18 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { cmd := exec.Command("go", goArgs...) cmd.Stdout = stdout cmd.Stderr = stderr + + // cmd.WaitDelay was added only in go1.20 (see #50436). + if waitDelay := reflect.ValueOf(cmd).Elem().FieldByName("WaitDelay"); waitDelay.IsValid() { + // https://go.dev/issue/59541: don't wait forever copying stderr + // after the command has exited. + // After CL 484741 we copy stdout manually, so we we'll stop reading that as + // soon as ctx is done. However, we also don't want to wait around forever + // for stderr. Give a much-longer-than-reasonable delay and then assume that + // something has wedged in the kernel or runtime. + waitDelay.Set(reflect.ValueOf(30 * time.Second)) + } + // On darwin the cwd gets resolved to the real path, which breaks anything that // expects the working directory to keep the original path, including the // go command when dealing with modules. @@ -229,6 +261,7 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir) cmd.Dir = i.WorkingDir } + defer func(start time.Time) { log("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now()) return runCmdContext(ctx, cmd) @@ -242,10 +275,85 @@ var DebugHangingGoCommands = false // runCmdContext is like exec.CommandContext except it sends os.Interrupt // before os.Kill. -func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { - if err := cmd.Start(); err != nil { +func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) { + // If cmd.Stdout is not an *os.File, the exec package will create a pipe and + // copy it to the Writer in a goroutine until the process has finished and + // either the pipe reaches EOF or command's WaitDelay expires. + // + // However, the output from 'go list' can be quite large, and we don't want to + // keep reading (and allocating buffers) if we've already decided we don't + // care about the output. We don't want to wait for the process to finish, and + // we don't wait to wait for the WaitDelay to expire either. + // + // Instead, if cmd.Stdout requires a copying goroutine we explicitly replace + // it with a pipe (which is an *os.File), which we can close in order to stop + // copying output as soon as we realize we don't care about it. + var stdoutW *os.File + if cmd.Stdout != nil { + if _, ok := cmd.Stdout.(*os.File); !ok { + var stdoutR *os.File + stdoutR, stdoutW, err = os.Pipe() + if err != nil { + return err + } + prevStdout := cmd.Stdout + cmd.Stdout = stdoutW + + stdoutErr := make(chan error, 1) + go func() { + _, err := io.Copy(prevStdout, stdoutR) + if err != nil { + err = fmt.Errorf("copying stdout: %w", err) + } + stdoutErr <- err + }() + defer func() { + // We started a goroutine to copy a stdout pipe. + // Wait for it to finish, or terminate it if need be. + var err2 error + select { + case err2 = <-stdoutErr: + stdoutR.Close() + case <-ctx.Done(): + stdoutR.Close() + // Per https://pkg.go.dev/os#File.Close, the call to stdoutR.Close + // should cause the Read call in io.Copy to unblock and return + // immediately, but we still need to receive from stdoutErr to confirm + // that that has happened. + <-stdoutErr + err2 = ctx.Err() + } + if err == nil { + err = err2 + } + }() + + // Per https://pkg.go.dev/os/exec#Cmd, “If Stdout and Stderr are the + // same writer, and have a type that can be compared with ==, at most + // one goroutine at a time will call Write.” + // + // Since we're starting a goroutine that writes to cmd.Stdout, we must + // also update cmd.Stderr so that that still holds. + func() { + defer func() { recover() }() + if cmd.Stderr == prevStdout { + cmd.Stderr = cmd.Stdout + } + }() + } + } + + err = cmd.Start() + if stdoutW != nil { + // The child process has inherited the pipe file, + // so close the copy held in this process. + stdoutW.Close() + stdoutW = nil + } + if err != nil { return err } + resChan := make(chan error, 1) go func() { resChan <- cmd.Wait() @@ -253,11 +361,14 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { // If we're interested in debugging hanging Go commands, stop waiting after a // minute and panic with interesting information. - if DebugHangingGoCommands { + debug := DebugHangingGoCommands + if debug { + timer := time.NewTimer(1 * time.Minute) + defer timer.Stop() select { case err := <-resChan: return err - case <-time.After(1 * time.Minute): + case <-timer.C: HandleHangingGoCommand(cmd.Process) case <-ctx.Done(): } @@ -270,30 +381,25 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { } // Cancelled. Interrupt and see if it ends voluntarily. - cmd.Process.Signal(os.Interrupt) - select { - case err := <-resChan: - return err - case <-time.After(time.Second): + if err := cmd.Process.Signal(os.Interrupt); err == nil { + // (We used to wait only 1s but this proved + // fragile on loaded builder machines.) + timer := time.NewTimer(5 * time.Second) + defer timer.Stop() + select { + case err := <-resChan: + return err + case <-timer.C: + } } // Didn't shut down in response to interrupt. Kill it hard. // TODO(rfindley): per advice from bcmills@, it may be better to send SIGQUIT // on certain platforms, such as unix. - if err := cmd.Process.Kill(); err != nil && DebugHangingGoCommands { - // Don't panic here as this reliably fails on windows with EINVAL. + if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug { log.Printf("error killing the Go command: %v", err) } - // See above: don't wait indefinitely if we're debugging hanging Go commands. - if DebugHangingGoCommands { - select { - case err := <-resChan: - return err - case <-time.After(10 * time.Second): // a shorter wait as resChan should return quickly following Kill - HandleHangingGoCommand(cmd.Process) - } - } return <-resChan } diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go index 307a76d47..446c5846a 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/version.go +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -23,21 +23,11 @@ import ( func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { inv.Verb = "list" inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} - inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") - // Unset any unneeded flags, and remove them from BuildFlags, if they're - // present. - inv.ModFile = "" + inv.BuildFlags = nil // This is not a build command. inv.ModFlag = "" - var buildFlags []string - for _, flag := range inv.BuildFlags { - // Flags can be prefixed by one or two dashes. - f := strings.TrimPrefix(strings.TrimPrefix(flag, "-"), "-") - if strings.HasPrefix(f, "mod=") || strings.HasPrefix(f, "modfile=") { - continue - } - buildFlags = append(buildFlags, flag) - } - inv.BuildFlags = buildFlags + inv.ModFile = "" + inv.Env = append(inv.Env[:len(inv.Env):len(inv.Env)], "GO111MODULE=off") + stdoutBytes, err := r.Run(ctx, inv) if err != nil { return 0, err diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go index 642a5ac2d..d4f1b4e8a 100644 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -26,6 +26,7 @@ import ( "unicode/utf8" "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/gopathwalk" ) @@ -414,9 +415,16 @@ func (p *pass) fix() ([]*ImportFix, bool) { }) } } + // Collecting fixes involved map iteration, so sort for stability. See + // golang/go#59976. + sortFixes(fixes) + // collect selected fixes in a separate slice, so that it can be sorted + // separately. Note that these fixes must occur after fixes to existing + // imports. TODO(rfindley): figure out why. + var selectedFixes []*ImportFix for _, imp := range selected { - fixes = append(fixes, &ImportFix{ + selectedFixes = append(selectedFixes, &ImportFix{ StmtInfo: ImportInfo{ Name: p.importSpecName(imp), ImportPath: imp.ImportPath, @@ -425,8 +433,25 @@ func (p *pass) fix() ([]*ImportFix, bool) { FixType: AddImport, }) } + sortFixes(selectedFixes) - return fixes, true + return append(fixes, selectedFixes...), true +} + +func sortFixes(fixes []*ImportFix) { + sort.Slice(fixes, func(i, j int) bool { + fi, fj := fixes[i], fixes[j] + if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath { + return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath + } + if fi.StmtInfo.Name != fj.StmtInfo.Name { + return fi.StmtInfo.Name < fj.StmtInfo.Name + } + if fi.IdentName != fj.IdentName { + return fi.IdentName < fj.IdentName + } + return fi.FixType < fj.FixType + }) } // importSpecName gets the import name of imp in the import spec. @@ -519,7 +544,7 @@ func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) { var fixImports = fixImportsDefault func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error { - fixes, err := getFixes(fset, f, filename, env) + fixes, err := getFixes(context.Background(), fset, f, filename, env) if err != nil { return err } @@ -529,7 +554,7 @@ 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(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { +func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { abs, err := filepath.Abs(filename) if err != nil { return nil, err @@ -583,7 +608,7 @@ func getFixes(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv // Go look for candidates in $GOPATH, etc. We don't necessarily load // the real exports of sibling imports, so keep assuming their contents. - if err := addExternalCandidates(p, p.missingRefs, filename); err != nil { + if err := addExternalCandidates(ctx, p, p.missingRefs, filename); err != nil { return nil, err } @@ -1031,7 +1056,10 @@ type scanCallback struct { exportsLoaded func(pkg *pkg, exports []string) } -func addExternalCandidates(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{ diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go index 95a88383a..58e637b90 100644 --- a/vendor/golang.org/x/tools/internal/imports/imports.go +++ b/vendor/golang.org/x/tools/internal/imports/imports.go @@ -11,6 +11,7 @@ package imports import ( "bufio" "bytes" + "context" "fmt" "go/ast" "go/format" @@ -23,6 +24,7 @@ import ( "strings" "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" ) // Options is golang.org/x/tools/imports.Options with extra internal-only options. @@ -66,14 +68,17 @@ 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(filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { +func FixImports(ctx context.Context, filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { + ctx, done := event.Start(ctx, "imports.FixImports") + defer done() + fileSet := token.NewFileSet() file, _, err := parse(fileSet, filename, src, opt) if err != nil { return nil, err } - return getFixes(fileSet, file, filename, opt.Env) + return getFixes(ctx, fileSet, file, filename, opt.Env) } // ApplyFixes applies all of the fixes to the file and formats it. extraMode diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go index 7d99d04ca..977d2389d 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -19,6 +19,7 @@ import ( "strings" "golang.org/x/mod/module" + "golang.org/x/tools/internal/event" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/gopathwalk" ) @@ -37,7 +38,7 @@ type ModuleResolver struct { mains []*gocommand.ModuleJSON mainByDir map[string]*gocommand.ModuleJSON modsByModPath []*gocommand.ModuleJSON // All modules, ordered by # of path components in module Path... - modsByDir []*gocommand.ModuleJSON // ...or Dir. + modsByDir []*gocommand.ModuleJSON // ...or number of path components in their Dir. // moduleCacheCache stores information about the module cache. moduleCacheCache *dirInfoCache @@ -123,7 +124,7 @@ func (r *ModuleResolver) init() error { }) sort.Slice(r.modsByDir, func(i, j int) bool { count := func(x int) int { - return strings.Count(r.modsByDir[x].Dir, "/") + return strings.Count(r.modsByDir[x].Dir, string(filepath.Separator)) } return count(j) < count(i) // descending order }) @@ -327,6 +328,10 @@ func (r *ModuleResolver) findModuleByDir(dir string) *gocommand.ModuleJSON { // - in /vendor/ in -mod=vendor mode. // - nested module? Dunno. // Rumor has it that replace targets cannot contain other replace targets. + // + // Note that it is critical here that modsByDir is sorted to have deeper dirs + // first. This ensures that findModuleByDir finds the innermost module. + // See also golang/go#56291. for _, m := range r.modsByDir { if !strings.HasPrefix(dir, m.Dir) { continue @@ -424,6 +429,9 @@ func (r *ModuleResolver) loadPackageNames(importPaths []string, srcDir string) ( } func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error { + ctx, done := event.Start(ctx, "imports.ModuleResolver.scan") + defer done() + if err := r.init(); err != nil { return err } diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go index cfba8189f..b9e87c691 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/common.go +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -105,6 +105,26 @@ func OriginMethod(fn *types.Func) *types.Func { } orig := NamedTypeOrigin(named) gfn, _, _ := types.LookupFieldOrMethod(orig, true, fn.Pkg(), fn.Name()) + + // This is a fix for a gopls crash (#60628) due to a go/types bug (#60634). In: + // package p + // type T *int + // func (*T) f() {} + // LookupFieldOrMethod(T, true, p, f)=nil, but NewMethodSet(*T)={(*T).f}. + // Here we make them consistent by force. + // (The go/types bug is general, but this workaround is reached only + // for generic T thanks to the early return above.) + if gfn == nil { + mset := types.NewMethodSet(types.NewPointer(orig)) + for i := 0; i < mset.Len(); i++ { + m := mset.At(i) + if m.Obj().Id() == fn.Id() { + gfn = m.Obj() + break + } + } + } + return gfn.(*types.Func) } diff --git a/vendor/knative.dev/networking/config/config-network.yaml b/vendor/knative.dev/networking/config/config-network.yaml index d87048a2c..efec10718 100644 --- a/vendor/knative.dev/networking/config/config-network.yaml +++ b/vendor/knative.dev/networking/config/config-network.yaml @@ -22,7 +22,7 @@ metadata: app.kubernetes.io/component: networking app.kubernetes.io/version: devel annotations: - knative.dev/example-checksum: "2b6d10ba" + knative.dev/example-checksum: "a576301d" data: _example: | ################################ @@ -88,7 +88,7 @@ data: # value is "{{.Name}}.{{.Namespace}}.{{.Domain}}". # # Valid variables defined in the template include Name, Namespace, Domain, - # Labels, and Annotations. Name will be the result of the tagTemplate + # Labels, and Annotations. Name will be the result of the tag-template # below, if a tag is specified for the route. # # Changing this value might be necessary when the extra levels in @@ -108,10 +108,10 @@ data: # would be {Name}-{Namespace}.foo.{Domain} domain-template: "{{.Name}}.{{.Namespace}}.{{.Domain}}" - # tagTemplate specifies the golang text template string to use + # tag-template specifies the golang text template string to use # when constructing the DNS name for "tags" within the traffic blocks # of Routes and Configuration. This is used in conjunction with the - # domainTemplate above to determine the full URL for the tag. + # domain-template above to determine the full URL for the tag. tag-template: "{{.Tag}}-{{.Name}}" # Controls whether TLS certificates are automatically provisioned and diff --git a/vendor/knative.dev/networking/test/conformance/ingress/README.md b/vendor/knative.dev/networking/test/conformance/ingress/README.md index 66c330155..dce3a853a 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/README.md +++ b/vendor/knative.dev/networking/test/conformance/ingress/README.md @@ -31,7 +31,7 @@ This directory contains Ingress conformance tests for Knative Ingress resource. export NETWORKING_ROOT= ``` 1. (Recommended) Knative - [net-istio](https://github.com/knative-sandbox/net-istio) source code checked + [net-istio](https://github.com/knative-extensions/net-istio) source code checked out. This contains an invocation of `RunConformance` that easily allows to run tests. 1. (For setup only) Knative Serving source code check out at `${SERVING_ROOT}`. @@ -106,7 +106,7 @@ func TestYourIngressConformance(t *testing.T) { ### Running the tests from `net-istio` repository `net-istio` already invokes the `RunConformance` function in -[`ingress_test.go`](https://github.com/knative-sandbox/net-istio/blob/main/test/conformance/ingress_test.go), +[`ingress_test.go`](https://github.com/knative-extensions/net-istio/blob/main/test/conformance/ingress_test.go), so it offers a convenient place to run the tests. If `INGRESS_CLASS` is already set, then you can simply `go test ingress_test.go` diff --git a/vendor/knative.dev/pkg/metrics/metrics.go b/vendor/knative.dev/pkg/metrics/metrics.go index 453e1b84a..b65f470cc 100644 --- a/vendor/knative.dev/pkg/metrics/metrics.go +++ b/vendor/knative.dev/pkg/metrics/metrics.go @@ -19,12 +19,12 @@ package metrics import ( "context" "net/url" + "sync/atomic" "time" "go.opencensus.io/stats" "go.opencensus.io/stats/view" "go.opencensus.io/tag" - "go.uber.org/atomic" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/metrics" "k8s.io/client-go/util/workqueue" @@ -74,13 +74,13 @@ var _ workqueue.GaugeMetric = (*gaugeMetric)(nil) // Inc implements CounterMetric func (m *gaugeMetric) Inc() { - total := m.total.Inc() + total := m.total.Add(1) Record(context.Background(), m.measure.M(total), stats.WithTags(m.mutators...)) } // Dec implements GaugeMetric func (m *gaugeMetric) Dec() { - total := m.total.Dec() + total := m.total.Add(-1) Record(context.Background(), m.measure.M(total), stats.WithTags(m.mutators...)) } diff --git a/vendor/knative.dev/pkg/profiling/server.go b/vendor/knative.dev/pkg/profiling/server.go index 36e08b4b4..f362f36fa 100644 --- a/vendor/knative.dev/pkg/profiling/server.go +++ b/vendor/knative.dev/pkg/profiling/server.go @@ -22,9 +22,9 @@ import ( "net/http/pprof" "os" "strconv" + "sync/atomic" "time" - "go.uber.org/atomic" "go.uber.org/zap" corev1 "k8s.io/api/core/v1" ) @@ -63,8 +63,11 @@ func NewHandler(logger *zap.SugaredLogger, enableProfiling bool) *Handler { mux.HandleFunc(pprofPrefix+"trace", pprof.Trace) logger.Info("Profiling enabled: ", enableProfiling) + var enabled atomic.Bool + enabled.Store(enableProfiling) + return &Handler{ - enabled: atomic.NewBool(enableProfiling), + enabled: &enabled, handler: mux, log: logger, } diff --git a/vendor/knative.dev/pkg/reconciler/testing/context.go b/vendor/knative.dev/pkg/reconciler/testing/context.go index 150c59bf2..0a36caefc 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/context.go +++ b/vendor/knative.dev/pkg/reconciler/testing/context.go @@ -18,11 +18,10 @@ package testing import ( "context" + "sync/atomic" "testing" "time" - "go.uber.org/atomic" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -94,7 +93,7 @@ func RunAndSyncInformers(ctx context.Context, informers ...controller.Informer) c.PrependReactor("list", "*", func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { // Every list (before actual informer usage) is going to be followed by a Watch call. - watchesPending.Inc() + watchesPending.Add(1) return false, nil, nil }) @@ -108,7 +107,7 @@ func RunAndSyncInformers(ctx context.Context, informers ...controller.Informer) return false, nil, err } - watchesPending.Dec() + watchesPending.Add(-1) return true, watch, nil }) diff --git a/vendor/knative.dev/pkg/reconciler/testing/hooks.go b/vendor/knative.dev/pkg/reconciler/testing/hooks.go index c89be34a0..c4129c612 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/hooks.go +++ b/vendor/knative.dev/pkg/reconciler/testing/hooks.go @@ -20,9 +20,9 @@ package testing import ( "errors" "sync" + "sync/atomic" "time" - "go.uber.org/atomic" "k8s.io/apimachinery/pkg/runtime" kubetesting "k8s.io/client-go/testing" ) @@ -94,16 +94,18 @@ type Hooks struct { // more fake clients and wait for all hooks to complete. // TODO(grantr): Allow validating that a hook never fires func NewHooks() *Hooks { + var ci atomic.Int32 + ci.Store(-1) return &Hooks{ completionCh: make(chan int32, 100), - completionIndex: atomic.NewInt32(-1), + completionIndex: &ci, } } // OnCreate attaches a create hook to the given Fake. The hook function is // executed every time a resource of the given type is created. func (h *Hooks) OnCreate(fake *kubetesting.Fake, resource string, rf CreateHookFunc) { - index := h.completionIndex.Inc() + index := h.completionIndex.Add(1) fake.PrependReactor("create", resource, func(a kubetesting.Action) (bool, runtime.Object, error) { obj := a.(kubetesting.CreateActionImpl).Object @@ -119,7 +121,7 @@ func (h *Hooks) OnCreate(fake *kubetesting.Fake, resource string, rf CreateHookF // OnUpdate attaches an update hook to the given Fake. The hook function is // executed every time a resource of the given type is updated. func (h *Hooks) OnUpdate(fake *kubetesting.Fake, resource string, rf UpdateHookFunc) { - index := h.completionIndex.Inc() + index := h.completionIndex.Add(1) fake.PrependReactor("update", resource, func(a kubetesting.Action) (bool, runtime.Object, error) { obj := a.(kubetesting.UpdateActionImpl).Object @@ -135,7 +137,7 @@ func (h *Hooks) OnUpdate(fake *kubetesting.Fake, resource string, rf UpdateHookF // OnDelete attaches a delete hook to the given Fake. The hook function is // executed every time a resource of the given type is deleted. func (h *Hooks) OnDelete(fake *kubetesting.Fake, resource string, rf DeleteHookFunc) { - index := h.completionIndex.Inc() + index := h.completionIndex.Add(1) fake.PrependReactor("delete", resource, func(a kubetesting.Action) (bool, runtime.Object, error) { name := a.(kubetesting.DeleteActionImpl).Name @@ -173,7 +175,7 @@ func (h *Hooks) WaitForHooks(timeout time.Duration) error { case i := <-h.completionCh: hookCompletions[i] = HookComplete if len(hookCompletions) == ci { - h.completionIndex.Dec() + h.completionIndex.Add(-1) return nil } case <-timer: diff --git a/vendor/knative.dev/pkg/test/zipkin/util.go b/vendor/knative.dev/pkg/test/zipkin/util.go index 72d867f19..2e9b8dbae 100644 --- a/vendor/knative.dev/pkg/test/zipkin/util.go +++ b/vendor/knative.dev/pkg/test/zipkin/util.go @@ -28,10 +28,10 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "testing" "time" - "go.uber.org/atomic" tracingconfig "knative.dev/pkg/tracing/config" "github.com/openzipkin/zipkin-go/model" diff --git a/vendor/knative.dev/pkg/webhook/helper.go b/vendor/knative.dev/pkg/webhook/helper.go index f9ff2daa9..a3647ac74 100644 --- a/vendor/knative.dev/pkg/webhook/helper.go +++ b/vendor/knative.dev/pkg/webhook/helper.go @@ -20,6 +20,7 @@ import ( "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/webhook/certificates/resources" ) // EnsureLabelSelectorExpressions merges the current label selector's MatchExpressions @@ -66,3 +67,16 @@ func ensureLabelSelectorRequirements( return append(want, nonKnative...) } + +func getSecretDataKeyNamesOrDefault(sKey string, sCert string) (serverKey string, serverCert string) { + serverKey = resources.ServerKey + serverCert = resources.ServerCert + + if sKey != "" { + serverKey = sKey + } + if sCert != "" { + serverCert = sCert + } + return serverKey, serverCert +} diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index 92dd01ae3..7be0336ac 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -38,7 +38,6 @@ import ( admissionv1 "k8s.io/api/admission/v1" "knative.dev/pkg/logging" "knative.dev/pkg/system" - certresources "knative.dev/pkg/webhook/certificates/resources" ) // Options contains the configuration for the webhook @@ -58,6 +57,14 @@ type Options struct { // If no SecretName is provided, then the webhook serves without TLS. SecretName string + // ServerPrivateKeyName is the name for the webhook secret's data key e.g. `tls.key`. + // Default value is `server-key.pem` if no value is passed. + ServerPrivateKeyName string + + // ServerCertificateName is the name for the webhook secret's ca data key e.g. `tls.crt`. + // Default value is `server-cert.pem` if no value is passed. + ServerCertificateName string + // Port where the webhook is served. Per k8s admission // registration requirements this should be 443 unless there is // only a single port for the service. @@ -169,13 +176,14 @@ func New( logger.Errorw("failed to fetch secret", zap.Error(err)) return nil, nil } - - serverKey, ok := secret.Data[certresources.ServerKey] + webOpts := GetOptions(ctx) + sKey, sCert := getSecretDataKeyNamesOrDefault(webOpts.ServerPrivateKeyName, webOpts.ServerCertificateName) + serverKey, ok := secret.Data[sKey] if !ok { logger.Warn("server key missing") return nil, nil } - serverCert, ok := secret.Data[certresources.ServerCert] + serverCert, ok := secret.Data[sCert] if !ok { logger.Warn("server cert missing") return nil, nil diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a32457ae..365ec5534 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -164,7 +164,7 @@ github.com/google/gofuzz/bytesource # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid -# github.com/gorilla/websocket v1.4.2 +# github.com/gorilla/websocket v1.5.0 ## explicit; go 1.12 github.com/gorilla/websocket # github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 @@ -314,7 +314,7 @@ go.uber.org/zap/internal/exit go.uber.org/zap/internal/ztest go.uber.org/zap/zapcore go.uber.org/zap/zaptest -# golang.org/x/mod v0.9.0 +# golang.org/x/mod v0.12.0 ## explicit; go 1.17 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module @@ -333,8 +333,8 @@ golang.org/x/net/trace ## explicit; go 1.17 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sync v0.2.0 -## explicit +# golang.org/x/sync v0.3.0 +## explicit; go 1.17 golang.org/x/sync/errgroup golang.org/x/sync/semaphore golang.org/x/sync/singleflight @@ -357,7 +357,7 @@ golang.org/x/text/unicode/norm # golang.org/x/time v0.3.0 ## explicit golang.org/x/time/rate -# golang.org/x/tools v0.7.0 +# golang.org/x/tools v0.11.0 ## explicit; go 1.18 golang.org/x/tools/go/ast/astutil golang.org/x/tools/imports @@ -365,6 +365,7 @@ golang.org/x/tools/internal/event golang.org/x/tools/internal/event/core golang.org/x/tools/internal/event/keys golang.org/x/tools/internal/event/label +golang.org/x/tools/internal/event/tag golang.org/x/tools/internal/fastwalk golang.org/x/tools/internal/gocommand golang.org/x/tools/internal/gopathwalk @@ -998,10 +999,10 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/hack v0.0.0-20230712131415-ddae80293c43 +# knative.dev/hack v0.0.0-20230802014852-338500eed425 ## explicit; go 1.18 knative.dev/hack -# knative.dev/networking v0.0.0-20230718160410-75dcd54d9510 +# knative.dev/networking v0.0.0-20230802091048-29da3ac7ef4d ## explicit; go 1.18 knative.dev/networking/config knative.dev/networking/pkg @@ -1042,7 +1043,7 @@ knative.dev/networking/test/test_images/runtime/handlers knative.dev/networking/test/test_images/timeout knative.dev/networking/test/test_images/wsserver knative.dev/networking/test/types -# knative.dev/pkg v0.0.0-20230718152110-aef227e72ead +# knative.dev/pkg v0.0.0-20230802191948-8d3f95106327 ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck