mirror of https://github.com/knative/client.git
upgrade to latest dependencies (#1690)
bumping knative.dev/networking 3103f3a...07c9d76: > 07c9d76 Support `internal-encryption` to deploy internal certificates automatically (# 680) bumping knative.dev/eventing f488f46...c1b0ea6: > c1b0ea6 Bump cloudevents/sdk-go to v2.10.1 (# 6422) > c71c362 upgrade to latest dependencies (# 6419) bumping knative.dev/serving 2f7b6db...3573163: > 3573163 only watch endpoints for our private services (# 13048) > 35a94ff Update link, thanks to Zhu Lei (# 13052) > 5f8892f skip http2 test early (# 13047) > e67dbb9 Improve SKS handling for unavailable Activator. (# 13027) > 6fca86c fix scale-from-zero mako test (# 13035) > 7c2b46d Relax the "timeout" requirement for `TestProbeRuntimeAfterStartup` (# 13026) > d54ad4c Remove the scale-to-zero checking in conformance. (# 13025) bumping go.uber.org/multierr 3114a8b...10aaa3c: > 10aaa3c Prepare release v1.8.0 (# 56) > cea7d2e Combine: Optimize for all nil (# 55) > d49c2ba doc: AppendInvoke: Fix typo (# 54) > ee7346a Merge pull request # 52 from uber-go/fossa > 7c6ff6f Integrate FOSSA (# 51) > d9efa4b fossa: Run separately, only on push > a5cd550 Release v1.7.0 (# 50) > a20a852 ci: Use GitHub Workflows (# 49) > 1014a7c AppendInvoke: Merge test, real example (# 48) > 0b65632 Use GitHub workflows > a402392 Add AppendInvoke (# 47) > 520752c Update license headers everywhere > e015acf error.go: Fix typo of doc (# 44) > 40de9b0 tools: Update to latest versions > 8b005e6 doc: change godoc to go.dev (# 45) > b78aea8 tools: Delete update-license > 0eb6eb5 Drop Go 1.12 support (# 41) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
56e146231a
commit
1b039776c7
26
go.mod
26
go.mod
|
@ -15,17 +15,17 @@ require (
|
|||
golang.org/x/mod v0.5.1
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
|
||||
gotest.tools/v3 v3.1.0
|
||||
k8s.io/api v0.23.5
|
||||
k8s.io/apiextensions-apiserver v0.23.4
|
||||
k8s.io/apimachinery v0.23.5
|
||||
k8s.io/api v0.23.8
|
||||
k8s.io/apiextensions-apiserver v0.23.8
|
||||
k8s.io/apimachinery v0.23.8
|
||||
k8s.io/cli-runtime v0.23.4
|
||||
k8s.io/client-go v0.23.5
|
||||
k8s.io/code-generator v0.23.5
|
||||
knative.dev/eventing v0.32.1-0.20220610013825-f488f4670727
|
||||
k8s.io/client-go v0.23.8
|
||||
k8s.io/code-generator v0.23.8
|
||||
knative.dev/eventing v0.32.1-0.20220614135415-c1b0ea692715
|
||||
knative.dev/hack v0.0.0-20220610014127-dc6c287516dc
|
||||
knative.dev/networking v0.0.0-20220610013825-3103f3a72792
|
||||
knative.dev/pkg v0.0.0-20220610014025-7d607d643ee2
|
||||
knative.dev/serving v0.32.1-0.20220610185625-2f7b6dbeaf25
|
||||
knative.dev/networking v0.0.0-20220614203516-07c9d7614c61
|
||||
knative.dev/pkg v0.0.0-20220621173822-9c5a7317fa9d
|
||||
knative.dev/serving v0.32.1-0.20220621141822-357316355d00
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
||||
|
@ -47,7 +47,7 @@ require (
|
|||
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cloudevents/sdk-go/sql/v2 v2.8.0 // indirect
|
||||
github.com/cloudevents/sdk-go/v2 v2.8.0 // indirect
|
||||
github.com/cloudevents/sdk-go/v2 v2.10.1 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
||||
|
@ -107,8 +107,8 @@ require (
|
|||
go.opencensus.io v0.23.0 // indirect
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.19.1 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
|
||||
|
@ -127,7 +127,7 @@ require (
|
|||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo v0.0.0-20220307231824-4627b89bbf1b // indirect
|
||||
k8s.io/klog/v2 v2.60.1-0.20220317184644-43cc75f9ae89 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
|
||||
|
|
49
go.sum
49
go.sum
|
@ -283,8 +283,9 @@ github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.4.1/go.mod h1:lhEpx
|
|||
github.com/cloudevents/sdk-go/sql/v2 v2.8.0 h1:gWednxJHL0Ycf93XeEFyQxYj81A7b4eNwkzjNxGunAM=
|
||||
github.com/cloudevents/sdk-go/sql/v2 v2.8.0/go.mod h1:u9acNJbhmi1wnDJro4PEAqbr4N1LTCyEUClErxbPS1A=
|
||||
github.com/cloudevents/sdk-go/v2 v2.4.1/go.mod h1:MZiMwmAh5tGj+fPFvtHv9hKurKqXtdB9haJYMJ/7GJY=
|
||||
github.com/cloudevents/sdk-go/v2 v2.8.0 h1:kmRaLbsafZmidZ0rZ6h7WOMqCkRMcVTLV5lxV/HKQ9Y=
|
||||
github.com/cloudevents/sdk-go/v2 v2.8.0/go.mod h1:GpCBmUj7DIRiDhVvsK5d6WCbgTWs8DxAWTRtAwQmIXs=
|
||||
github.com/cloudevents/sdk-go/v2 v2.10.1 h1:qNFovJ18fWOd8Q9ydWJPk1oiFudXyv1GxJIP7MwPjuM=
|
||||
github.com/cloudevents/sdk-go/v2 v2.10.1/go.mod h1:GpCBmUj7DIRiDhVvsK5d6WCbgTWs8DxAWTRtAwQmIXs=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
|
@ -1473,20 +1474,23 @@ go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
|||
go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q=
|
||||
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
|
||||
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
|
||||
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
|
||||
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
|
||||
go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI=
|
||||
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
|
||||
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
|
||||
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
|
@ -2172,8 +2176,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
|||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
|
@ -2194,10 +2199,12 @@ k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ=
|
|||
k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8=
|
||||
k8s.io/api v0.22.5/go.mod h1:mEhXyLaSD1qTOf40rRiKXkc+2iCem09rWLlFwhCEiAs=
|
||||
k8s.io/api v0.23.4/go.mod h1:i77F4JfyNNrhOjZF7OwwNJS5Y1S9dpwvb9iYRYRczfI=
|
||||
k8s.io/api v0.23.5 h1:zno3LUiMubxD/V1Zw3ijyKO3wxrhbUF1Ck+VjBvfaoA=
|
||||
k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8=
|
||||
k8s.io/apiextensions-apiserver v0.23.4 h1:AFDUEu/yEf0YnuZhqhIFhPLPhhcQQVuR1u3WCh0rveU=
|
||||
k8s.io/api v0.23.8 h1:tBMQ7z7s1NUUii649OaGe962xPacUzHwnGEj6Ahneu0=
|
||||
k8s.io/api v0.23.8/go.mod h1:26VNldp5fRyiZ/tEO/3V8RJW+In1Aay3YkxsDzkvuWU=
|
||||
k8s.io/apiextensions-apiserver v0.23.4/go.mod h1:TWYAKymJx7nLMxWCgWm2RYGXHrGlVZnxIlGnvtfYu+g=
|
||||
k8s.io/apiextensions-apiserver v0.23.8 h1:a8xlE5Jlpyjy7kTpABIt6uHLkt0714HuWnu1BARGQZE=
|
||||
k8s.io/apiextensions-apiserver v0.23.8/go.mod h1:pcYtXkSRncXGgCCQSbTqppO3XMaLWdqlDisD4dUKQ/U=
|
||||
k8s.io/apimachinery v0.19.7/go.mod h1:6sRbGRAVY5DOCuZwB5XkqguBqpqLU6q/kOaOdk29z6Q=
|
||||
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
|
@ -2205,13 +2212,15 @@ k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MA
|
|||
k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0=
|
||||
k8s.io/apimachinery v0.22.5/go.mod h1:xziclGKwuuJ2RM5/rSFQSYAj0zdbci3DH8kj+WvyN0U=
|
||||
k8s.io/apimachinery v0.23.4/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
|
||||
k8s.io/apimachinery v0.23.5 h1:Va7dwhp8wgkUPWsEXk6XglXWU4IKYLKNlv8VkX7SDM0=
|
||||
k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
|
||||
k8s.io/apimachinery v0.23.8 h1:6Z+0LLvvPnAF6GXbUcBmzB1+b/AnDZpVd2N0MxUJcl0=
|
||||
k8s.io/apimachinery v0.23.8/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
|
||||
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
|
||||
k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM=
|
||||
k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q=
|
||||
k8s.io/apiserver v0.22.5/go.mod h1:s2WbtgZAkTKt679sYtSudEQrTGWUSQAPe6MupLnlmaQ=
|
||||
k8s.io/apiserver v0.23.4/go.mod h1:A6l/ZcNtxGfPSqbFDoxxOjEjSKBaQmE+UTveOmMkpNc=
|
||||
k8s.io/apiserver v0.23.8/go.mod h1:/WVQG619hfUCgp3pazpqVspyC83NJemH5B0qxlZjNpw=
|
||||
k8s.io/cli-runtime v0.23.4 h1:C3AFQmo4TK4dlVPLOI62gtHEHu0OfA2Cp4UVRZ1JXns=
|
||||
k8s.io/cli-runtime v0.23.4/go.mod h1:7KywUNTUibmHPqmpDFuRO1kc9RhsufHv2lkjCm2YZyM=
|
||||
k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y=
|
||||
|
@ -2219,17 +2228,20 @@ k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k=
|
|||
k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0=
|
||||
k8s.io/client-go v0.22.5/go.mod h1:cs6yf/61q2T1SdQL5Rdcjg9J1ElXSwbjSrW2vFImM4Y=
|
||||
k8s.io/client-go v0.23.4/go.mod h1:PKnIL4pqLuvYUK1WU7RLTMYKPiIh7MYShLshtRY9cj0=
|
||||
k8s.io/client-go v0.23.5 h1:zUXHmEuqx0RY4+CsnkOn5l0GU+skkRXKGJrhmE2SLd8=
|
||||
k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4=
|
||||
k8s.io/client-go v0.23.8 h1:0POvFP1/bN0DQYO41ks1tdzIBf9I+afqpUUNedyZ3T4=
|
||||
k8s.io/client-go v0.23.8/go.mod h1:m9GosuTn6NlShCjb5XvrRlNDuHeIbGrsDLxjDoS6gec=
|
||||
k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0=
|
||||
k8s.io/code-generator v0.23.4/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
|
||||
k8s.io/code-generator v0.23.5 h1:xn3a6J5pUL49AoH6SPrOFtnB5cvdMl76f/bEY176R3c=
|
||||
k8s.io/code-generator v0.23.5/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
|
||||
k8s.io/code-generator v0.23.8 h1:YHHiSaUd2uzLhUpzh1Wlsz20ah0BG6V3gYjkYSte8Gs=
|
||||
k8s.io/code-generator v0.23.8/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
|
||||
k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=
|
||||
k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI=
|
||||
k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM=
|
||||
k8s.io/component-base v0.22.5/go.mod h1:VK3I+TjuF9eaa+Ln67dKxhGar5ynVbwnGrUiNF4MqCI=
|
||||
k8s.io/component-base v0.23.4/go.mod h1:8o3Gg8i2vnUXGPOwciiYlkSaZT+p+7gA9Scoz8y4W4E=
|
||||
k8s.io/component-base v0.23.8/go.mod h1:rCj6EeaYLsNneVoFuSPL/AlEWmomc39j9M9i4NpR8r0=
|
||||
k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM=
|
||||
k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI=
|
||||
k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI=
|
||||
|
@ -2269,22 +2281,24 @@ k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
|
|||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
|
||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/caching v0.0.0-20220610113725-9c092893371a/go.mod h1:IcfEPqEP6ma4EcRUcPkwVNx5FWHHWu8w4/eqRQguDwc=
|
||||
knative.dev/eventing v0.32.1-0.20220610013825-f488f4670727 h1:4dEOTqf5VREEFVh9Ji99O2K2R3tblkCvifNQaz3W6/s=
|
||||
knative.dev/eventing v0.32.1-0.20220610013825-f488f4670727/go.mod h1:669e7eZgjBLy+SLXi4I0HvE+trswWV1w36lCyUnXGCY=
|
||||
knative.dev/eventing v0.32.1-0.20220614135415-c1b0ea692715 h1:efjNLZXLgbphN5IiHpkTqK1ztorP+1Nlu1s53/1BPS0=
|
||||
knative.dev/eventing v0.32.1-0.20220614135415-c1b0ea692715/go.mod h1:WKC5YSu8dhjcSOgrhgB5ipdV9Of/KrcETkJObM67Mhk=
|
||||
knative.dev/hack v0.0.0-20220524153203-12d3e2a7addc/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20220609132040-fd240e2cef5c/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20220610014127-dc6c287516dc h1:LyqyT+rtgZYfOb3ChGE5jTFApCOcUmAcSV+TzgLxnys=
|
||||
knative.dev/hack v0.0.0-20220610014127-dc6c287516dc/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack/schema v0.0.0-20220524153203-12d3e2a7addc/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||
knative.dev/networking v0.0.0-20220610013825-3103f3a72792 h1:GDLLrx8w9oEXoE/am8AdWSTtSsLoZevmEMaeAdetM1Q=
|
||||
knative.dev/hack/schema v0.0.0-20220610014127-dc6c287516dc/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
|
||||
knative.dev/networking v0.0.0-20220610013825-3103f3a72792/go.mod h1:oIETD09Q4GSOXjdBdiPc0eEQxMwmjH7/gdhfg+sgdW8=
|
||||
knative.dev/networking v0.0.0-20220614203516-07c9d7614c61 h1:IsEfLWjHFt10XEUnAE/W4XcEU2uA+PMd1aZFkz5vrzA=
|
||||
knative.dev/networking v0.0.0-20220614203516-07c9d7614c61/go.mod h1:oIETD09Q4GSOXjdBdiPc0eEQxMwmjH7/gdhfg+sgdW8=
|
||||
knative.dev/pkg v0.0.0-20220524202603-19adf798efb8/go.mod h1:pApypeWDkGrsMkUDkV6StWXS4CXhwGWuJEID9GGZY0Y=
|
||||
knative.dev/pkg v0.0.0-20220609131940-865e331abfa5/go.mod h1:pApypeWDkGrsMkUDkV6StWXS4CXhwGWuJEID9GGZY0Y=
|
||||
knative.dev/pkg v0.0.0-20220610014025-7d607d643ee2 h1:MMClRZRz6rzhrpySJ21XCJqVDd4K3rurUEJ1Yrh8DmA=
|
||||
knative.dev/pkg v0.0.0-20220610014025-7d607d643ee2/go.mod h1:pApypeWDkGrsMkUDkV6StWXS4CXhwGWuJEID9GGZY0Y=
|
||||
knative.dev/reconciler-test v0.0.0-20220524205904-f750f80bfc7e/go.mod h1:/ps2aEdmtjId+pUGJuuADQN4IucIp4rI7KnrYEahOgE=
|
||||
knative.dev/serving v0.32.1-0.20220610185625-2f7b6dbeaf25 h1:Uf5yuPzu9e2NS9pi1BIeGSZRP+LkpGG8oQhUCWculYI=
|
||||
knative.dev/serving v0.32.1-0.20220610185625-2f7b6dbeaf25/go.mod h1:2DTwW8KZVZgsobW0EYhv4nTR8+LhKu2pZhEAoytUqE8=
|
||||
knative.dev/pkg v0.0.0-20220621173822-9c5a7317fa9d h1:H/naKtQODjCIr9wFb1YOG17CgbkgSFMy5dX0WZnrz6o=
|
||||
knative.dev/pkg v0.0.0-20220621173822-9c5a7317fa9d/go.mod h1:hmwyuQ6uQlqLVEM4lJGg6LZ12gbnUQv9kH88sA5pLDg=
|
||||
knative.dev/reconciler-test v0.0.0-20220610141926-64ffd15625ec/go.mod h1:/vZ6/AKGYQQPYY/7BSebqt62QrxiJ97T3r1jso9dAJg=
|
||||
knative.dev/serving v0.32.1-0.20220621141822-357316355d00 h1:YWCweftFQuy+cflkhYw2a3xQP7mqN5kGyYEGeZSVzsE=
|
||||
knative.dev/serving v0.32.1-0.20220621141822-357316355d00/go.mod h1:2DTwW8KZVZgsobW0EYhv4nTR8+LhKu2pZhEAoytUqE8=
|
||||
mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
|
||||
|
@ -2297,6 +2311,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyz
|
|||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.27/go.mod h1:tq2nT0Kx7W+/f2JVE+zxYtUhdjuELJkVpNz+x/QN5R4=
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw=
|
||||
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs=
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y=
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY=
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017 Uber Technologies, Inc.
|
||||
Copyright (c) 2017-2021 Uber Technologies, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -97,6 +97,7 @@ type ceClient struct {
|
|||
receiverMu sync.Mutex
|
||||
eventDefaulterFns []EventDefaulter
|
||||
pollGoroutines int
|
||||
blockingCallback bool
|
||||
}
|
||||
|
||||
func (c *ceClient) applyOptions(opts ...Option) error {
|
||||
|
@ -248,14 +249,22 @@ func (c *ceClient) StartReceiver(ctx context.Context, fn interface{}) error {
|
|||
continue
|
||||
}
|
||||
|
||||
// Do not block on the invoker.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
callback := func() {
|
||||
if err := c.invoker.Invoke(ctx, msg, respFn); err != nil {
|
||||
cecontext.LoggerFrom(ctx).Warn("Error while handling a message: ", err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
|
||||
if c.blockingCallback {
|
||||
callback()
|
||||
} else {
|
||||
// Do not block on the invoker.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
callback()
|
||||
}()
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package client
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudevents/sdk-go/v2/binding"
|
||||
)
|
||||
|
||||
|
@ -113,3 +114,15 @@ func WithInboundContextDecorator(dec func(context.Context, binding.Message) cont
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithBlockingCallback makes the callback passed into StartReceiver is executed as a blocking call,
|
||||
// i.e. in each poll go routine, the next event will not be received until the callback on current event completes.
|
||||
// To make event processing serialized (no concurrency), use this option along with WithPollGoroutines(1)
|
||||
func WithBlockingCallback() Option {
|
||||
return func(i interface{}) error {
|
||||
if c, ok := i.(*ceClient); ok {
|
||||
c.blockingCallback = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ func (e Event) Data() []byte {
|
|||
}
|
||||
|
||||
// DataAs attempts to populate the provided data object with the event payload.
|
||||
// data should be a pointer type.
|
||||
// obj should be a pointer type.
|
||||
func (e Event) DataAs(obj interface{}) error {
|
||||
data := e.Data()
|
||||
|
||||
|
|
|
@ -157,7 +157,14 @@ func (p *Protocol) Send(ctx context.Context, m binding.Message, transformers ...
|
|||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(message.BodyReader)
|
||||
errorStr := buf.String()
|
||||
err = NewResult(res.StatusCode, "%s", errorStr)
|
||||
// If the error is not wrapped, then append the original error string.
|
||||
if og, ok := err.(*Result); ok {
|
||||
og.Format = og.Format + "%s"
|
||||
og.Args = append(og.Args, errorStr)
|
||||
err = og
|
||||
} else {
|
||||
err = NewResult(res.StatusCode, "%w: %s", err, errorStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
package http
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -53,6 +56,24 @@ func (p *Protocol) doWithRetry(ctx context.Context, params *cecontext.RetryParam
|
|||
retry := 0
|
||||
results := make([]protocol.Result, 0)
|
||||
|
||||
var (
|
||||
body []byte
|
||||
err error
|
||||
)
|
||||
|
||||
if req != nil && req.Body != nil {
|
||||
defer func() {
|
||||
if err = req.Body.Close(); err != nil {
|
||||
cecontext.LoggerFrom(ctx).Warnw("could not close request body", zap.Error(err))
|
||||
}
|
||||
}()
|
||||
body, err = ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
resetBody(req, body)
|
||||
}
|
||||
|
||||
for {
|
||||
msg, result := p.doOnce(req)
|
||||
|
||||
|
@ -90,6 +111,8 @@ func (p *Protocol) doWithRetry(ctx context.Context, params *cecontext.RetryParam
|
|||
}
|
||||
|
||||
DoBackoff:
|
||||
resetBody(req, body)
|
||||
|
||||
// Wait for the correct amount of backoff time.
|
||||
|
||||
// total tries = retry + 1
|
||||
|
@ -103,3 +126,20 @@ func (p *Protocol) doWithRetry(ctx context.Context, params *cecontext.RetryParam
|
|||
results = append(results, result)
|
||||
}
|
||||
}
|
||||
|
||||
// reset body to allow it to be read multiple times, e.g. when retrying http
|
||||
// requests
|
||||
func resetBody(req *http.Request, body []byte) {
|
||||
if req == nil || req.Body == nil {
|
||||
return
|
||||
}
|
||||
|
||||
req.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
|
||||
// do not modify existing GetBody function
|
||||
if req.GetBody == nil {
|
||||
req.GetBody = func() (io.ReadCloser, error) {
|
||||
return ioutil.NopCloser(bytes.NewReader(body)), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
sudo: false
|
||||
language: go
|
||||
go_import_path: go.uber.org/multierr
|
||||
|
||||
env:
|
||||
global:
|
||||
- GO111MODULE=on
|
||||
|
||||
go:
|
||||
- oldstable
|
||||
- stable
|
||||
|
||||
before_install:
|
||||
- go version
|
||||
|
||||
script:
|
||||
- |
|
||||
set -e
|
||||
make lint
|
||||
make cover
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
|
@ -1,6 +1,18 @@
|
|||
Releases
|
||||
========
|
||||
|
||||
v1.8.0 (2022-02-28)
|
||||
===================
|
||||
|
||||
- `Combine`: perform zero allocations when there are no errors.
|
||||
|
||||
|
||||
v1.7.0 (2021-05-06)
|
||||
===================
|
||||
|
||||
- Add `AppendInvoke` to append into errors from `defer` blocks.
|
||||
|
||||
|
||||
v1.6.0 (2020-09-14)
|
||||
===================
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017 Uber Technologies, Inc.
|
||||
Copyright (c) 2017-2021 Uber Technologies, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -34,9 +34,5 @@ lint: gofmt golint staticcheck
|
|||
|
||||
.PHONY: cover
|
||||
cover:
|
||||
go test -coverprofile=cover.out -coverpkg=./... -v ./...
|
||||
go test -race -coverprofile=cover.out -coverpkg=./... -v ./...
|
||||
go tool cover -html=cover.out -o cover.html
|
||||
|
||||
update-license:
|
||||
@cd tools && go install go.uber.org/tools/update-license
|
||||
@$(GOBIN)/update-license $(GO_FILES)
|
||||
|
|
|
@ -15,9 +15,9 @@ Stable: No breaking changes will be made before 2.0.
|
|||
Released under the [MIT License].
|
||||
|
||||
[MIT License]: LICENSE.txt
|
||||
[doc-img]: https://godoc.org/go.uber.org/multierr?status.svg
|
||||
[doc]: https://godoc.org/go.uber.org/multierr
|
||||
[ci-img]: https://travis-ci.com/uber-go/multierr.svg?branch=master
|
||||
[doc-img]: https://pkg.go.dev/badge/go.uber.org/multierr
|
||||
[doc]: https://pkg.go.dev/go.uber.org/multierr
|
||||
[ci-img]: https://github.com/uber-go/multierr/actions/workflows/go.yml/badge.svg
|
||||
[cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg
|
||||
[ci]: https://travis-ci.com/uber-go/multierr
|
||||
[ci]: https://github.com/uber-go/multierr/actions/workflows/go.yml
|
||||
[cov]: https://codecov.io/gh/uber-go/multierr
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Uber Technologies, Inc.
|
||||
// Copyright (c) 2017-2021 Uber Technologies, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -35,8 +35,53 @@
|
|||
//
|
||||
// err = multierr.Append(reader.Close(), writer.Close())
|
||||
//
|
||||
// This makes it possible to record resource cleanup failures from deferred
|
||||
// blocks with the help of named return values.
|
||||
// The underlying list of errors for a returned error object may be retrieved
|
||||
// with the Errors function.
|
||||
//
|
||||
// errors := multierr.Errors(err)
|
||||
// if len(errors) > 0 {
|
||||
// fmt.Println("The following errors occurred:", errors)
|
||||
// }
|
||||
//
|
||||
// Appending from a loop
|
||||
//
|
||||
// You sometimes need to append into an error from a loop.
|
||||
//
|
||||
// var err error
|
||||
// for _, item := range items {
|
||||
// err = multierr.Append(err, process(item))
|
||||
// }
|
||||
//
|
||||
// Cases like this may require knowledge of whether an individual instance
|
||||
// failed. This usually requires introduction of a new variable.
|
||||
//
|
||||
// var err error
|
||||
// for _, item := range items {
|
||||
// if perr := process(item); perr != nil {
|
||||
// log.Warn("skipping item", item)
|
||||
// err = multierr.Append(err, perr)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// multierr includes AppendInto to simplify cases like this.
|
||||
//
|
||||
// var err error
|
||||
// for _, item := range items {
|
||||
// if multierr.AppendInto(&err, process(item)) {
|
||||
// log.Warn("skipping item", item)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// This will append the error into the err variable, and return true if that
|
||||
// individual error was non-nil.
|
||||
//
|
||||
// See AppendInto for more information.
|
||||
//
|
||||
// Deferred Functions
|
||||
//
|
||||
// Go makes it possible to modify the return value of a function in a defer
|
||||
// block if the function was using named returns. This makes it possible to
|
||||
// record resource cleanup failures from deferred blocks.
|
||||
//
|
||||
// func sendRequest(req Request) (err error) {
|
||||
// conn, err := openConnection()
|
||||
|
@ -49,14 +94,21 @@
|
|||
// // ...
|
||||
// }
|
||||
//
|
||||
// The underlying list of errors for a returned error object may be retrieved
|
||||
// with the Errors function.
|
||||
// multierr provides the Invoker type and AppendInvoke function to make cases
|
||||
// like the above simpler and obviate the need for a closure. The following is
|
||||
// roughly equivalent to the example above.
|
||||
//
|
||||
// errors := multierr.Errors(err)
|
||||
// if len(errors) > 0 {
|
||||
// fmt.Println("The following errors occurred:", errors)
|
||||
// func sendRequest(req Request) (err error) {
|
||||
// conn, err := openConnection()
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// defer multierr.AppendInvoke(&err, multierr.Close(conn))
|
||||
// // ...
|
||||
// }
|
||||
//
|
||||
// See AppendInvoke and Invoker for more information.
|
||||
//
|
||||
// Advanced Usage
|
||||
//
|
||||
// Errors returned by Combine and Append MAY implement the following
|
||||
|
@ -87,6 +139,7 @@ package multierr // import "go.uber.org/multierr"
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
@ -186,6 +239,33 @@ func (merr *multiError) Errors() []error {
|
|||
return merr.errors
|
||||
}
|
||||
|
||||
// As attempts to find the first error in the error list that matches the type
|
||||
// of the value that target points to.
|
||||
//
|
||||
// This function allows errors.As to traverse the values stored on the
|
||||
// multierr error.
|
||||
func (merr *multiError) As(target interface{}) bool {
|
||||
for _, err := range merr.Errors() {
|
||||
if errors.As(err, target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Is attempts to match the provided error against errors in the error list.
|
||||
//
|
||||
// This function allows errors.Is to traverse the values stored on the
|
||||
// multierr error.
|
||||
func (merr *multiError) Is(target error) bool {
|
||||
for _, err := range merr.Errors() {
|
||||
if errors.Is(err, target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (merr *multiError) Error() string {
|
||||
if merr == nil {
|
||||
return ""
|
||||
|
@ -292,6 +372,14 @@ func inspect(errors []error) (res inspectResult) {
|
|||
|
||||
// fromSlice converts the given list of errors into a single error.
|
||||
func fromSlice(errors []error) error {
|
||||
// Don't pay to inspect small slices.
|
||||
switch len(errors) {
|
||||
case 0:
|
||||
return nil
|
||||
case 1:
|
||||
return errors[0]
|
||||
}
|
||||
|
||||
res := inspect(errors)
|
||||
switch res.Count {
|
||||
case 0:
|
||||
|
@ -301,8 +389,13 @@ func fromSlice(errors []error) error {
|
|||
return errors[res.FirstErrorIdx]
|
||||
case len(errors):
|
||||
if !res.ContainsMultiError {
|
||||
// already flat
|
||||
return &multiError{errors: errors}
|
||||
// Error list is flat. Make a copy of it
|
||||
// Otherwise "errors" escapes to the heap
|
||||
// unconditionally for all other cases.
|
||||
// This lets us optimize for the "no errors" case.
|
||||
out := make([]error, len(errors))
|
||||
copy(out, errors)
|
||||
return &multiError{errors: out}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,7 +514,7 @@ func Append(left error, right error) error {
|
|||
// items = append(items, item)
|
||||
// }
|
||||
//
|
||||
// Compare this with a verison that relies solely on Append:
|
||||
// Compare this with a version that relies solely on Append:
|
||||
//
|
||||
// var err error
|
||||
// for line := range lines {
|
||||
|
@ -447,3 +540,113 @@ func AppendInto(into *error, err error) (errored bool) {
|
|||
*into = Append(*into, err)
|
||||
return true
|
||||
}
|
||||
|
||||
// Invoker is an operation that may fail with an error. Use it with
|
||||
// AppendInvoke to append the result of calling the function into an error.
|
||||
// This allows you to conveniently defer capture of failing operations.
|
||||
//
|
||||
// See also, Close and Invoke.
|
||||
type Invoker interface {
|
||||
Invoke() error
|
||||
}
|
||||
|
||||
// Invoke wraps a function which may fail with an error to match the Invoker
|
||||
// interface. Use it to supply functions matching this signature to
|
||||
// AppendInvoke.
|
||||
//
|
||||
// For example,
|
||||
//
|
||||
// func processReader(r io.Reader) (err error) {
|
||||
// scanner := bufio.NewScanner(r)
|
||||
// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
|
||||
// for scanner.Scan() {
|
||||
// // ...
|
||||
// }
|
||||
// // ...
|
||||
// }
|
||||
//
|
||||
// In this example, the following line will construct the Invoker right away,
|
||||
// but defer the invocation of scanner.Err() until the function returns.
|
||||
//
|
||||
// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
|
||||
type Invoke func() error
|
||||
|
||||
// Invoke calls the supplied function and returns its result.
|
||||
func (i Invoke) Invoke() error { return i() }
|
||||
|
||||
// Close builds an Invoker that closes the provided io.Closer. Use it with
|
||||
// AppendInvoke to close io.Closers and append their results into an error.
|
||||
//
|
||||
// For example,
|
||||
//
|
||||
// func processFile(path string) (err error) {
|
||||
// f, err := os.Open(path)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// defer multierr.AppendInvoke(&err, multierr.Close(f))
|
||||
// return processReader(f)
|
||||
// }
|
||||
//
|
||||
// In this example, multierr.Close will construct the Invoker right away, but
|
||||
// defer the invocation of f.Close until the function returns.
|
||||
//
|
||||
// defer multierr.AppendInvoke(&err, multierr.Close(f))
|
||||
func Close(closer io.Closer) Invoker {
|
||||
return Invoke(closer.Close)
|
||||
}
|
||||
|
||||
// AppendInvoke appends the result of calling the given Invoker into the
|
||||
// provided error pointer. Use it with named returns to safely defer
|
||||
// invocation of fallible operations until a function returns, and capture the
|
||||
// resulting errors.
|
||||
//
|
||||
// func doSomething(...) (err error) {
|
||||
// // ...
|
||||
// f, err := openFile(..)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// // multierr will call f.Close() when this function returns and
|
||||
// // if the operation fails, its append its error into the
|
||||
// // returned error.
|
||||
// defer multierr.AppendInvoke(&err, multierr.Close(f))
|
||||
//
|
||||
// scanner := bufio.NewScanner(f)
|
||||
// // Similarly, this scheduled scanner.Err to be called and
|
||||
// // inspected when the function returns and append its error
|
||||
// // into the returned error.
|
||||
// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
|
||||
//
|
||||
// // ...
|
||||
// }
|
||||
//
|
||||
// Without defer, AppendInvoke behaves exactly like AppendInto.
|
||||
//
|
||||
// err := // ...
|
||||
// multierr.AppendInvoke(&err, mutltierr.Invoke(foo))
|
||||
//
|
||||
// // ...is roughly equivalent to...
|
||||
//
|
||||
// err := // ...
|
||||
// multierr.AppendInto(&err, foo())
|
||||
//
|
||||
// The advantage of the indirection introduced by Invoker is to make it easy
|
||||
// to defer the invocation of a function. Without this indirection, the
|
||||
// invoked function will be evaluated at the time of the defer block rather
|
||||
// than when the function returns.
|
||||
//
|
||||
// // BAD: This is likely not what the caller intended. This will evaluate
|
||||
// // foo() right away and append its result into the error when the
|
||||
// // function returns.
|
||||
// defer multierr.AppendInto(&err, foo())
|
||||
//
|
||||
// // GOOD: This will defer invocation of foo unutil the function returns.
|
||||
// defer multierr.AppendInvoke(&err, multierr.Invoke(foo))
|
||||
//
|
||||
// multierr provides a few Invoker implementations out of the box for
|
||||
// convenience. See Invoker for more information.
|
||||
func AppendInvoke(into *error, invoker Invoker) {
|
||||
AppendInto(into, invoker.Invoke())
|
||||
}
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
// Copyright (c) 2019 Uber Technologies, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
// +build go1.13
|
||||
|
||||
package multierr
|
||||
|
||||
import "errors"
|
||||
|
||||
// As attempts to find the first error in the error list that matches the type
|
||||
// of the value that target points to.
|
||||
//
|
||||
// This function allows errors.As to traverse the values stored on the
|
||||
// multierr error.
|
||||
func (merr *multiError) As(target interface{}) bool {
|
||||
for _, err := range merr.Errors() {
|
||||
if errors.As(err, target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Is attempts to match the provided error against errors in the error list.
|
||||
//
|
||||
// This function allows errors.Is to traverse the values stored on the
|
||||
// multierr error.
|
||||
func (merr *multiError) Is(target error) bool {
|
||||
for _, err := range merr.Errors() {
|
||||
if errors.Is(err, target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
|
@ -96,14 +96,14 @@ Released under the [MIT License](LICENSE.txt).
|
|||
|
||||
<sup id="footnote-versions">1</sup> In particular, keep in mind that we may be
|
||||
benchmarking against slightly older versions of other packages. Versions are
|
||||
pinned in zap's [glide.lock][] file. [↩](#anchor-versions)
|
||||
pinned in the [benchmarks/go.mod][] file. [↩](#anchor-versions)
|
||||
|
||||
[doc-img]: https://godoc.org/go.uber.org/zap?status.svg
|
||||
[doc]: https://godoc.org/go.uber.org/zap
|
||||
[ci-img]: https://travis-ci.com/uber-go/zap.svg?branch=master
|
||||
[ci]: https://travis-ci.com/uber-go/zap
|
||||
[doc-img]: https://pkg.go.dev/badge/go.uber.org/zap
|
||||
[doc]: https://pkg.go.dev/go.uber.org/zap
|
||||
[ci-img]: https://github.com/uber-go/zap/actions/workflows/go.yml/badge.svg
|
||||
[ci]: https://github.com/uber-go/zap/actions/workflows/go.yml
|
||||
[cov-img]: https://codecov.io/gh/uber-go/zap/branch/master/graph/badge.svg
|
||||
[cov]: https://codecov.io/gh/uber-go/zap
|
||||
[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks
|
||||
[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock
|
||||
[benchmarks/go.mod]: https://github.com/uber-go/zap/blob/master/benchmarks/go.mod
|
||||
|
||||
|
|
|
@ -3,9 +3,57 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.21.0 (7 Feb 2022)
|
||||
|
||||
Enhancements:
|
||||
* [#1047][]: Add `zapcore.ParseLevel` to parse a `Level` from a string.
|
||||
* [#1048][]: Add `zap.ParseAtomicLevel` to parse an `AtomicLevel` from a
|
||||
string.
|
||||
|
||||
Bugfixes:
|
||||
* [#1058][]: Fix panic in JSON encoder when `EncodeLevel` is unset.
|
||||
|
||||
Other changes:
|
||||
* [#1052][]: Improve encoding performance when the `AddCaller` and
|
||||
`AddStacktrace` options are used together.
|
||||
|
||||
[#1047]: https://github.com/uber-go/zap/pull/1047
|
||||
[#1048]: https://github.com/uber-go/zap/pull/1048
|
||||
[#1052]: https://github.com/uber-go/zap/pull/1052
|
||||
[#1058]: https://github.com/uber-go/zap/pull/1058
|
||||
|
||||
Thanks to @aerosol and @Techassi for their contributions to this release.
|
||||
|
||||
## 1.20.0 (4 Jan 2022)
|
||||
|
||||
Enhancements:
|
||||
* [#989][]: Add `EncoderConfig.SkipLineEnding` flag to disable adding newline
|
||||
characters between log statements.
|
||||
* [#1039][]: Add `EncoderConfig.NewReflectedEncoder` field to customize JSON
|
||||
encoding of reflected log fields.
|
||||
|
||||
Bugfixes:
|
||||
* [#1011][]: Fix inaccurate precision when encoding complex64 as JSON.
|
||||
* [#554][], [#1017][]: Close JSON namespaces opened in `MarshalLogObject`
|
||||
methods when the methods return.
|
||||
* [#1033][]: Avoid panicking in Sampler core if `thereafter` is zero.
|
||||
|
||||
Other changes:
|
||||
* [#1028][]: Drop support for Go < 1.15.
|
||||
|
||||
[#554]: https://github.com/uber-go/zap/pull/554
|
||||
[#989]: https://github.com/uber-go/zap/pull/989
|
||||
[#1011]: https://github.com/uber-go/zap/pull/1011
|
||||
[#1017]: https://github.com/uber-go/zap/pull/1017
|
||||
[#1028]: https://github.com/uber-go/zap/pull/1028
|
||||
[#1033]: https://github.com/uber-go/zap/pull/1033
|
||||
[#1039]: https://github.com/uber-go/zap/pull/1039
|
||||
|
||||
Thanks to @psrajat, @lruggieri, @sammyrnycreal for their contributions to this release.
|
||||
|
||||
## 1.19.1 (8 Sep 2021)
|
||||
|
||||
### Fixed
|
||||
Bugfixes:
|
||||
* [#1001][]: JSON: Fix complex number encoding with negative imaginary part. Thanks to @hemantjadon.
|
||||
* [#1003][]: JSON: Fix inaccurate precision when encoding float32.
|
||||
|
||||
|
|
|
@ -66,38 +66,38 @@ Log a message and 10 fields:
|
|||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 862 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 1250 ns/op | +45% | 11 allocs/op
|
||||
| zerolog | 4021 ns/op | +366% | 76 allocs/op
|
||||
| go-kit | 4542 ns/op | +427% | 105 allocs/op
|
||||
| apex/log | 26785 ns/op | +3007% | 115 allocs/op
|
||||
| logrus | 29501 ns/op | +3322% | 125 allocs/op
|
||||
| log15 | 29906 ns/op | +3369% | 122 allocs/op
|
||||
| :zap: zap | 2900 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 3475 ns/op | +20% | 10 allocs/op
|
||||
| zerolog | 10639 ns/op | +267% | 32 allocs/op
|
||||
| go-kit | 14434 ns/op | +398% | 59 allocs/op
|
||||
| logrus | 17104 ns/op | +490% | 81 allocs/op
|
||||
| apex/log | 32424 ns/op | +1018% | 66 allocs/op
|
||||
| log15 | 33579 ns/op | +1058% | 76 allocs/op
|
||||
|
||||
Log a message with a logger that already has 10 fields of context:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 126 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 187 ns/op | +48% | 2 allocs/op
|
||||
| zerolog | 88 ns/op | -30% | 0 allocs/op
|
||||
| go-kit | 5087 ns/op | +3937% | 103 allocs/op
|
||||
| log15 | 18548 ns/op | +14621% | 73 allocs/op
|
||||
| apex/log | 26012 ns/op | +20544% | 104 allocs/op
|
||||
| logrus | 27236 ns/op | +21516% | 113 allocs/op
|
||||
| :zap: zap | 373 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 452 ns/op | +21% | 1 allocs/op
|
||||
| zerolog | 288 ns/op | -23% | 0 allocs/op
|
||||
| go-kit | 11785 ns/op | +3060% | 58 allocs/op
|
||||
| logrus | 19629 ns/op | +5162% | 70 allocs/op
|
||||
| log15 | 21866 ns/op | +5762% | 72 allocs/op
|
||||
| apex/log | 30890 ns/op | +8182% | 55 allocs/op
|
||||
|
||||
Log a static string, without any context or `printf`-style templating:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 118 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 191 ns/op | +62% | 2 allocs/op
|
||||
| zerolog | 93 ns/op | -21% | 0 allocs/op
|
||||
| go-kit | 280 ns/op | +137% | 11 allocs/op
|
||||
| standard library | 499 ns/op | +323% | 2 allocs/op
|
||||
| apex/log | 1990 ns/op | +1586% | 10 allocs/op
|
||||
| logrus | 3129 ns/op | +2552% | 24 allocs/op
|
||||
| log15 | 3887 ns/op | +3194% | 23 allocs/op
|
||||
| :zap: zap | 381 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 410 ns/op | +8% | 1 allocs/op
|
||||
| zerolog | 369 ns/op | -3% | 0 allocs/op
|
||||
| standard library | 385 ns/op | +1% | 2 allocs/op
|
||||
| go-kit | 606 ns/op | +59% | 11 allocs/op
|
||||
| logrus | 1730 ns/op | +354% | 25 allocs/op
|
||||
| apex/log | 1998 ns/op | +424% | 7 allocs/op
|
||||
| log15 | 4546 ns/op | +1093% | 22 allocs/op
|
||||
|
||||
## Development Status: Stable
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
_stdLogDefaultDepth = 1
|
||||
_loggerWriterDepth = 2
|
||||
_programmerErrorTemplate = "You've found a bug in zap! Please file a bug at " +
|
||||
"https://github.com/uber-go/zap/issues/new and reference this error: %v"
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) 2019 Uber Technologies, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
// See #682 for more information.
|
||||
// +build !go1.12
|
||||
|
||||
package zap
|
||||
|
||||
const _stdLogDefaultDepth = 2
|
|
@ -86,6 +86,23 @@ func NewAtomicLevelAt(l zapcore.Level) AtomicLevel {
|
|||
return a
|
||||
}
|
||||
|
||||
// ParseAtomicLevel parses an AtomicLevel based on a lowercase or all-caps ASCII
|
||||
// representation of the log level. If the provided ASCII representation is
|
||||
// invalid an error is returned.
|
||||
//
|
||||
// This is particularly useful when dealing with text input to configure log
|
||||
// levels.
|
||||
func ParseAtomicLevel(text string) (AtomicLevel, error) {
|
||||
a := NewAtomicLevel()
|
||||
l, err := zapcore.ParseLevel(text)
|
||||
if err != nil {
|
||||
return a, err
|
||||
}
|
||||
|
||||
a.SetLevel(l)
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Enabled implements the zapcore.LevelEnabler interface, which allows the
|
||||
// AtomicLevel to be used in place of traditional static levels.
|
||||
func (lvl AtomicLevel) Enabled(l zapcore.Level) bool {
|
||||
|
|
|
@ -24,9 +24,9 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap/internal/bufferpool"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
|
@ -259,8 +259,10 @@ func (log *Logger) clone() *Logger {
|
|||
}
|
||||
|
||||
func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
// check must always be called directly by a method in the Logger interface
|
||||
// (e.g., Check, Info, Fatal).
|
||||
// Logger.check must always be called directly by a method in the
|
||||
// Logger interface (e.g., Check, Info, Fatal).
|
||||
// This skips Logger.check and the Info/Fatal/Check/etc. method that
|
||||
// called it.
|
||||
const callerSkipOffset = 2
|
||||
|
||||
// Check the level first to reduce the cost of disabled log calls.
|
||||
|
@ -307,42 +309,55 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
|||
|
||||
// Thread the error output through to the CheckedEntry.
|
||||
ce.ErrorOutput = log.errorOutput
|
||||
if log.addCaller {
|
||||
frame, defined := getCallerFrame(log.callerSkip + callerSkipOffset)
|
||||
if !defined {
|
||||
|
||||
addStack := log.addStack.Enabled(ce.Level)
|
||||
if !log.addCaller && !addStack {
|
||||
return ce
|
||||
}
|
||||
|
||||
// Adding the caller or stack trace requires capturing the callers of
|
||||
// this function. We'll share information between these two.
|
||||
stackDepth := stacktraceFirst
|
||||
if addStack {
|
||||
stackDepth = stacktraceFull
|
||||
}
|
||||
stack := captureStacktrace(log.callerSkip+callerSkipOffset, stackDepth)
|
||||
defer stack.Free()
|
||||
|
||||
if stack.Count() == 0 {
|
||||
if log.addCaller {
|
||||
fmt.Fprintf(log.errorOutput, "%v Logger.check error: failed to get caller\n", ent.Time.UTC())
|
||||
log.errorOutput.Sync()
|
||||
}
|
||||
return ce
|
||||
}
|
||||
|
||||
ce.Entry.Caller = zapcore.EntryCaller{
|
||||
Defined: defined,
|
||||
frame, more := stack.Next()
|
||||
|
||||
if log.addCaller {
|
||||
ce.Caller = zapcore.EntryCaller{
|
||||
Defined: frame.PC != 0,
|
||||
PC: frame.PC,
|
||||
File: frame.File,
|
||||
Line: frame.Line,
|
||||
Function: frame.Function,
|
||||
}
|
||||
}
|
||||
if log.addStack.Enabled(ce.Entry.Level) {
|
||||
ce.Entry.Stack = StackSkip("", log.callerSkip+callerSkipOffset).String
|
||||
|
||||
if addStack {
|
||||
buffer := bufferpool.Get()
|
||||
defer buffer.Free()
|
||||
|
||||
stackfmt := newStackFormatter(buffer)
|
||||
|
||||
// We've already extracted the first frame, so format that
|
||||
// separately and defer to stackfmt for the rest.
|
||||
stackfmt.FormatFrame(frame)
|
||||
if more {
|
||||
stackfmt.FormatStack(stack)
|
||||
}
|
||||
ce.Stack = buffer.String()
|
||||
}
|
||||
|
||||
return ce
|
||||
}
|
||||
|
||||
// getCallerFrame gets caller frame. The argument skip is the number of stack
|
||||
// frames to ascend, with 0 identifying the caller of getCallerFrame. The
|
||||
// boolean ok is false if it was not possible to recover the information.
|
||||
//
|
||||
// Note: This implementation is similar to runtime.Caller, but it returns the whole frame.
|
||||
func getCallerFrame(skip int) (frame runtime.Frame, ok bool) {
|
||||
const skipOffset = 2 // skip getCallerFrame and Callers
|
||||
|
||||
pc := make([]uintptr, 1)
|
||||
numFrames := runtime.Callers(skip+skipOffset, pc)
|
||||
if numFrames < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
frame, _ = runtime.CallersFrames(pc).Next()
|
||||
return frame, frame.PC != 0
|
||||
}
|
||||
|
|
|
@ -24,62 +24,153 @@ import (
|
|||
"runtime"
|
||||
"sync"
|
||||
|
||||
"go.uber.org/zap/buffer"
|
||||
"go.uber.org/zap/internal/bufferpool"
|
||||
)
|
||||
|
||||
var (
|
||||
_stacktracePool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return newProgramCounters(64)
|
||||
},
|
||||
}
|
||||
var _stacktracePool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &stacktrace{
|
||||
storage: make([]uintptr, 64),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
type stacktrace struct {
|
||||
pcs []uintptr // program counters; always a subslice of storage
|
||||
frames *runtime.Frames
|
||||
|
||||
// The size of pcs varies depending on requirements:
|
||||
// it will be one if the only the first frame was requested,
|
||||
// and otherwise it will reflect the depth of the call stack.
|
||||
//
|
||||
// storage decouples the slice we need (pcs) from the slice we pool.
|
||||
// We will always allocate a reasonably large storage, but we'll use
|
||||
// only as much of it as we need.
|
||||
storage []uintptr
|
||||
}
|
||||
|
||||
// stacktraceDepth specifies how deep of a stack trace should be captured.
|
||||
type stacktraceDepth int
|
||||
|
||||
const (
|
||||
// stacktraceFirst captures only the first frame.
|
||||
stacktraceFirst stacktraceDepth = iota
|
||||
|
||||
// stacktraceFull captures the entire call stack, allocating more
|
||||
// storage for it if needed.
|
||||
stacktraceFull
|
||||
)
|
||||
|
||||
// captureStacktrace captures a stack trace of the specified depth, skipping
|
||||
// the provided number of frames. skip=0 identifies the caller of
|
||||
// captureStacktrace.
|
||||
//
|
||||
// The caller must call Free on the returned stacktrace after using it.
|
||||
func captureStacktrace(skip int, depth stacktraceDepth) *stacktrace {
|
||||
stack := _stacktracePool.Get().(*stacktrace)
|
||||
|
||||
switch depth {
|
||||
case stacktraceFirst:
|
||||
stack.pcs = stack.storage[:1]
|
||||
case stacktraceFull:
|
||||
stack.pcs = stack.storage
|
||||
}
|
||||
|
||||
// Unlike other "skip"-based APIs, skip=0 identifies runtime.Callers
|
||||
// itself. +2 to skip captureStacktrace and runtime.Callers.
|
||||
numFrames := runtime.Callers(
|
||||
skip+2,
|
||||
stack.pcs,
|
||||
)
|
||||
|
||||
// runtime.Callers truncates the recorded stacktrace if there is no
|
||||
// room in the provided slice. For the full stack trace, keep expanding
|
||||
// storage until there are fewer frames than there is room.
|
||||
if depth == stacktraceFull {
|
||||
pcs := stack.pcs
|
||||
for numFrames == len(pcs) {
|
||||
pcs = make([]uintptr, len(pcs)*2)
|
||||
numFrames = runtime.Callers(skip+2, pcs)
|
||||
}
|
||||
|
||||
// Discard old storage instead of returning it to the pool.
|
||||
// This will adjust the pool size over time if stack traces are
|
||||
// consistently very deep.
|
||||
stack.storage = pcs
|
||||
stack.pcs = pcs[:numFrames]
|
||||
} else {
|
||||
stack.pcs = stack.pcs[:numFrames]
|
||||
}
|
||||
|
||||
stack.frames = runtime.CallersFrames(stack.pcs)
|
||||
return stack
|
||||
}
|
||||
|
||||
// Free releases resources associated with this stacktrace
|
||||
// and returns it back to the pool.
|
||||
func (st *stacktrace) Free() {
|
||||
st.frames = nil
|
||||
st.pcs = nil
|
||||
_stacktracePool.Put(st)
|
||||
}
|
||||
|
||||
// Count reports the total number of frames in this stacktrace.
|
||||
// Count DOES NOT change as Next is called.
|
||||
func (st *stacktrace) Count() int {
|
||||
return len(st.pcs)
|
||||
}
|
||||
|
||||
// Next returns the next frame in the stack trace,
|
||||
// and a boolean indicating whether there are more after it.
|
||||
func (st *stacktrace) Next() (_ runtime.Frame, more bool) {
|
||||
return st.frames.Next()
|
||||
}
|
||||
|
||||
func takeStacktrace(skip int) string {
|
||||
stack := captureStacktrace(skip+1, stacktraceFull)
|
||||
defer stack.Free()
|
||||
|
||||
buffer := bufferpool.Get()
|
||||
defer buffer.Free()
|
||||
programCounters := _stacktracePool.Get().(*programCounters)
|
||||
defer _stacktracePool.Put(programCounters)
|
||||
|
||||
var numFrames int
|
||||
for {
|
||||
// Skip the call to runtime.Callers and takeStacktrace so that the
|
||||
// program counters start at the caller of takeStacktrace.
|
||||
numFrames = runtime.Callers(skip+2, programCounters.pcs)
|
||||
if numFrames < len(programCounters.pcs) {
|
||||
break
|
||||
}
|
||||
// Don't put the too-short counter slice back into the pool; this lets
|
||||
// the pool adjust if we consistently take deep stacktraces.
|
||||
programCounters = newProgramCounters(len(programCounters.pcs) * 2)
|
||||
}
|
||||
|
||||
i := 0
|
||||
frames := runtime.CallersFrames(programCounters.pcs[:numFrames])
|
||||
|
||||
// Note: On the last iteration, frames.Next() returns false, with a valid
|
||||
// frame, but we ignore this frame. The last frame is a a runtime frame which
|
||||
// adds noise, since it's only either runtime.main or runtime.goexit.
|
||||
for frame, more := frames.Next(); more; frame, more = frames.Next() {
|
||||
if i != 0 {
|
||||
buffer.AppendByte('\n')
|
||||
}
|
||||
i++
|
||||
buffer.AppendString(frame.Function)
|
||||
buffer.AppendByte('\n')
|
||||
buffer.AppendByte('\t')
|
||||
buffer.AppendString(frame.File)
|
||||
buffer.AppendByte(':')
|
||||
buffer.AppendInt(int64(frame.Line))
|
||||
}
|
||||
|
||||
stackfmt := newStackFormatter(buffer)
|
||||
stackfmt.FormatStack(stack)
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
type programCounters struct {
|
||||
pcs []uintptr
|
||||
// stackFormatter formats a stack trace into a readable string representation.
|
||||
type stackFormatter struct {
|
||||
b *buffer.Buffer
|
||||
nonEmpty bool // whehther we've written at least one frame already
|
||||
}
|
||||
|
||||
func newProgramCounters(size int) *programCounters {
|
||||
return &programCounters{make([]uintptr, size)}
|
||||
// newStackFormatter builds a new stackFormatter.
|
||||
func newStackFormatter(b *buffer.Buffer) stackFormatter {
|
||||
return stackFormatter{b: b}
|
||||
}
|
||||
|
||||
// FormatStack formats all remaining frames in the provided stacktrace -- minus
|
||||
// the final runtime.main/runtime.goexit frame.
|
||||
func (sf *stackFormatter) FormatStack(stack *stacktrace) {
|
||||
// Note: On the last iteration, frames.Next() returns false, with a valid
|
||||
// frame, but we ignore this frame. The last frame is a a runtime frame which
|
||||
// adds noise, since it's only either runtime.main or runtime.goexit.
|
||||
for frame, more := stack.Next(); more; frame, more = stack.Next() {
|
||||
sf.FormatFrame(frame)
|
||||
}
|
||||
}
|
||||
|
||||
// FormatFrame formats the given frame.
|
||||
func (sf *stackFormatter) FormatFrame(frame runtime.Frame) {
|
||||
if sf.nonEmpty {
|
||||
sf.b.AppendByte('\n')
|
||||
}
|
||||
sf.nonEmpty = true
|
||||
sf.b.AppendString(frame.Function)
|
||||
sf.b.AppendByte('\n')
|
||||
sf.b.AppendByte('\t')
|
||||
sf.b.AppendString(frame.File)
|
||||
sf.b.AppendByte(':')
|
||||
sf.b.AppendInt(int64(frame.Line))
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
|
||||
package zapcore
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
import "time"
|
||||
|
||||
// DefaultClock is the default clock used by Zap in operations that require
|
||||
// time. This clock uses the system clock for all operations.
|
||||
|
|
|
@ -125,11 +125,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
|||
line.AppendString(ent.Stack)
|
||||
}
|
||||
|
||||
if c.LineEnding != "" {
|
||||
line.AppendString(c.LineEnding)
|
||||
} else {
|
||||
line.AppendString(DefaultLineEnding)
|
||||
}
|
||||
line.AppendString(c.LineEnding)
|
||||
return line, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package zapcore
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap/buffer"
|
||||
|
@ -312,14 +313,15 @@ func (e *NameEncoder) UnmarshalText(text []byte) error {
|
|||
type EncoderConfig struct {
|
||||
// Set the keys used for each log entry. If any key is empty, that portion
|
||||
// of the entry is omitted.
|
||||
MessageKey string `json:"messageKey" yaml:"messageKey"`
|
||||
LevelKey string `json:"levelKey" yaml:"levelKey"`
|
||||
TimeKey string `json:"timeKey" yaml:"timeKey"`
|
||||
NameKey string `json:"nameKey" yaml:"nameKey"`
|
||||
CallerKey string `json:"callerKey" yaml:"callerKey"`
|
||||
FunctionKey string `json:"functionKey" yaml:"functionKey"`
|
||||
StacktraceKey string `json:"stacktraceKey" yaml:"stacktraceKey"`
|
||||
LineEnding string `json:"lineEnding" yaml:"lineEnding"`
|
||||
MessageKey string `json:"messageKey" yaml:"messageKey"`
|
||||
LevelKey string `json:"levelKey" yaml:"levelKey"`
|
||||
TimeKey string `json:"timeKey" yaml:"timeKey"`
|
||||
NameKey string `json:"nameKey" yaml:"nameKey"`
|
||||
CallerKey string `json:"callerKey" yaml:"callerKey"`
|
||||
FunctionKey string `json:"functionKey" yaml:"functionKey"`
|
||||
StacktraceKey string `json:"stacktraceKey" yaml:"stacktraceKey"`
|
||||
SkipLineEnding bool `json:"skipLineEnding" yaml:"skipLineEnding"`
|
||||
LineEnding string `json:"lineEnding" yaml:"lineEnding"`
|
||||
// Configure the primitive representations of common complex types. For
|
||||
// example, some users may want all time.Times serialized as floating-point
|
||||
// seconds since epoch, while others may prefer ISO8601 strings.
|
||||
|
@ -330,6 +332,9 @@ type EncoderConfig struct {
|
|||
// Unlike the other primitive type encoders, EncodeName is optional. The
|
||||
// zero value falls back to FullNameEncoder.
|
||||
EncodeName NameEncoder `json:"nameEncoder" yaml:"nameEncoder"`
|
||||
// Configure the encoder for interface{} type objects.
|
||||
// If not provided, objects are encoded using json.Encoder
|
||||
NewReflectedEncoder func(io.Writer) ReflectedEncoder `json:"-" yaml:"-"`
|
||||
// Configures the field separator used by the console encoder. Defaults
|
||||
// to tab.
|
||||
ConsoleSeparator string `json:"consoleSeparator" yaml:"consoleSeparator"`
|
||||
|
|
|
@ -22,7 +22,6 @@ package zapcore
|
|||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -64,7 +63,7 @@ type jsonEncoder struct {
|
|||
|
||||
// for encoding generic values by reflection
|
||||
reflectBuf *buffer.Buffer
|
||||
reflectEnc *json.Encoder
|
||||
reflectEnc ReflectedEncoder
|
||||
}
|
||||
|
||||
// NewJSONEncoder creates a fast, low-allocation JSON encoder. The encoder
|
||||
|
@ -82,6 +81,17 @@ func NewJSONEncoder(cfg EncoderConfig) Encoder {
|
|||
}
|
||||
|
||||
func newJSONEncoder(cfg EncoderConfig, spaced bool) *jsonEncoder {
|
||||
if cfg.SkipLineEnding {
|
||||
cfg.LineEnding = ""
|
||||
} else if cfg.LineEnding == "" {
|
||||
cfg.LineEnding = DefaultLineEnding
|
||||
}
|
||||
|
||||
// If no EncoderConfig.NewReflectedEncoder is provided by the user, then use default
|
||||
if cfg.NewReflectedEncoder == nil {
|
||||
cfg.NewReflectedEncoder = defaultReflectedEncoder
|
||||
}
|
||||
|
||||
return &jsonEncoder{
|
||||
EncoderConfig: &cfg,
|
||||
buf: bufferpool.Get(),
|
||||
|
@ -118,6 +128,11 @@ func (enc *jsonEncoder) AddComplex128(key string, val complex128) {
|
|||
enc.AppendComplex128(val)
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AddComplex64(key string, val complex64) {
|
||||
enc.addKey(key)
|
||||
enc.AppendComplex64(val)
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AddDuration(key string, val time.Duration) {
|
||||
enc.addKey(key)
|
||||
enc.AppendDuration(val)
|
||||
|
@ -141,10 +156,7 @@ func (enc *jsonEncoder) AddInt64(key string, val int64) {
|
|||
func (enc *jsonEncoder) resetReflectBuf() {
|
||||
if enc.reflectBuf == nil {
|
||||
enc.reflectBuf = bufferpool.Get()
|
||||
enc.reflectEnc = json.NewEncoder(enc.reflectBuf)
|
||||
|
||||
// For consistency with our custom JSON encoder.
|
||||
enc.reflectEnc.SetEscapeHTML(false)
|
||||
enc.reflectEnc = enc.NewReflectedEncoder(enc.reflectBuf)
|
||||
} else {
|
||||
enc.reflectBuf.Reset()
|
||||
}
|
||||
|
@ -206,10 +218,16 @@ func (enc *jsonEncoder) AppendArray(arr ArrayMarshaler) error {
|
|||
}
|
||||
|
||||
func (enc *jsonEncoder) AppendObject(obj ObjectMarshaler) error {
|
||||
// Close ONLY new openNamespaces that are created during
|
||||
// AppendObject().
|
||||
old := enc.openNamespaces
|
||||
enc.openNamespaces = 0
|
||||
enc.addElementSeparator()
|
||||
enc.buf.AppendByte('{')
|
||||
err := obj.MarshalLogObject(enc)
|
||||
enc.buf.AppendByte('}')
|
||||
enc.closeOpenNamespaces()
|
||||
enc.openNamespaces = old
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -225,20 +243,23 @@ func (enc *jsonEncoder) AppendByteString(val []byte) {
|
|||
enc.buf.AppendByte('"')
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AppendComplex128(val complex128) {
|
||||
// appendComplex appends the encoded form of the provided complex128 value.
|
||||
// precision specifies the encoding precision for the real and imaginary
|
||||
// components of the complex number.
|
||||
func (enc *jsonEncoder) appendComplex(val complex128, precision int) {
|
||||
enc.addElementSeparator()
|
||||
// Cast to a platform-independent, fixed-size type.
|
||||
r, i := float64(real(val)), float64(imag(val))
|
||||
enc.buf.AppendByte('"')
|
||||
// Because we're always in a quoted string, we can use strconv without
|
||||
// special-casing NaN and +/-Inf.
|
||||
enc.buf.AppendFloat(r, 64)
|
||||
enc.buf.AppendFloat(r, precision)
|
||||
// If imaginary part is less than 0, minus (-) sign is added by default
|
||||
// by AppendFloat.
|
||||
if i >= 0 {
|
||||
enc.buf.AppendByte('+')
|
||||
}
|
||||
enc.buf.AppendFloat(i, 64)
|
||||
enc.buf.AppendFloat(i, precision)
|
||||
enc.buf.AppendByte('i')
|
||||
enc.buf.AppendByte('"')
|
||||
}
|
||||
|
@ -301,28 +322,28 @@ func (enc *jsonEncoder) AppendUint64(val uint64) {
|
|||
enc.buf.AppendUint(val)
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AddComplex64(k string, v complex64) { enc.AddComplex128(k, complex128(v)) }
|
||||
func (enc *jsonEncoder) AddInt(k string, v int) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt32(k string, v int32) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt16(k string, v int16) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt8(k string, v int8) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddUint(k string, v uint) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint32(k string, v uint32) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint16(k string, v uint16) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint8(k string, v uint8) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUintptr(k string, v uintptr) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendComplex64(v complex64) { enc.AppendComplex128(complex128(v)) }
|
||||
func (enc *jsonEncoder) AppendFloat64(v float64) { enc.appendFloat(v, 64) }
|
||||
func (enc *jsonEncoder) AppendFloat32(v float32) { enc.appendFloat(float64(v), 32) }
|
||||
func (enc *jsonEncoder) AppendInt(v int) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt32(v int32) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt16(v int16) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt8(v int8) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint(v uint) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint32(v uint32) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint16(v uint16) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint8(v uint8) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUintptr(v uintptr) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AddInt(k string, v int) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt32(k string, v int32) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt16(k string, v int16) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddInt8(k string, v int8) { enc.AddInt64(k, int64(v)) }
|
||||
func (enc *jsonEncoder) AddUint(k string, v uint) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint32(k string, v uint32) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint16(k string, v uint16) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUint8(k string, v uint8) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AddUintptr(k string, v uintptr) { enc.AddUint64(k, uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendComplex64(v complex64) { enc.appendComplex(complex128(v), 32) }
|
||||
func (enc *jsonEncoder) AppendComplex128(v complex128) { enc.appendComplex(complex128(v), 64) }
|
||||
func (enc *jsonEncoder) AppendFloat64(v float64) { enc.appendFloat(v, 64) }
|
||||
func (enc *jsonEncoder) AppendFloat32(v float32) { enc.appendFloat(float64(v), 32) }
|
||||
func (enc *jsonEncoder) AppendInt(v int) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt32(v int32) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt16(v int16) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendInt8(v int8) { enc.AppendInt64(int64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint(v uint) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint32(v uint32) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint16(v uint16) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUint8(v uint8) { enc.AppendUint64(uint64(v)) }
|
||||
func (enc *jsonEncoder) AppendUintptr(v uintptr) { enc.AppendUint64(uint64(v)) }
|
||||
|
||||
func (enc *jsonEncoder) Clone() Encoder {
|
||||
clone := enc.clone()
|
||||
|
@ -343,7 +364,7 @@ func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
|||
final := enc.clone()
|
||||
final.buf.AppendByte('{')
|
||||
|
||||
if final.LevelKey != "" {
|
||||
if final.LevelKey != "" && final.EncodeLevel != nil {
|
||||
final.addKey(final.LevelKey)
|
||||
cur := final.buf.Len()
|
||||
final.EncodeLevel(ent.Level, final)
|
||||
|
@ -404,11 +425,7 @@ func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
|||
final.AddString(final.StacktraceKey, ent.Stack)
|
||||
}
|
||||
final.buf.AppendByte('}')
|
||||
if final.LineEnding != "" {
|
||||
final.buf.AppendString(final.LineEnding)
|
||||
} else {
|
||||
final.buf.AppendString(DefaultLineEnding)
|
||||
}
|
||||
final.buf.AppendString(final.LineEnding)
|
||||
|
||||
ret := final.buf
|
||||
putJSONEncoder(final)
|
||||
|
@ -423,6 +440,7 @@ func (enc *jsonEncoder) closeOpenNamespaces() {
|
|||
for i := 0; i < enc.openNamespaces; i++ {
|
||||
enc.buf.AppendByte('}')
|
||||
}
|
||||
enc.openNamespaces = 0
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) addKey(key string) {
|
||||
|
|
|
@ -55,6 +55,18 @@ const (
|
|||
_maxLevel = FatalLevel
|
||||
)
|
||||
|
||||
// ParseLevel parses a level based on the lower-case or all-caps ASCII
|
||||
// representation of the log level. If the provided ASCII representation is
|
||||
// invalid an error is returned.
|
||||
//
|
||||
// This is particularly useful when dealing with text input to configure log
|
||||
// levels.
|
||||
func ParseLevel(text string) (Level, error) {
|
||||
var level Level
|
||||
err := level.UnmarshalText([]byte(text))
|
||||
return level, err
|
||||
}
|
||||
|
||||
// String returns a lower-case ASCII representation of the log level.
|
||||
func (l Level) String() string {
|
||||
switch l {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Uber Technologies, Inc.
|
||||
// Copyright (c) 2016 Uber Technologies, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -18,9 +18,24 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
// See #682 for more information.
|
||||
// +build go1.12
|
||||
package zapcore
|
||||
|
||||
package zap
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
)
|
||||
|
||||
const _stdLogDefaultDepth = 1
|
||||
// ReflectedEncoder serializes log fields that can't be serialized with Zap's
|
||||
// JSON encoder. These have the ReflectType field type.
|
||||
// Use EncoderConfig.NewReflectedEncoder to set this.
|
||||
type ReflectedEncoder interface {
|
||||
// Encode encodes and writes to the underlying data stream.
|
||||
Encode(interface{}) error
|
||||
}
|
||||
|
||||
func defaultReflectedEncoder(w io.Writer) ReflectedEncoder {
|
||||
enc := json.NewEncoder(w)
|
||||
// For consistency with our custom JSON encoder.
|
||||
enc.SetEscapeHTML(false)
|
||||
return enc
|
||||
}
|
|
@ -133,10 +133,21 @@ func SamplerHook(hook func(entry Entry, dec SamplingDecision)) SamplerOption {
|
|||
// each tick. If more Entries with the same level and message are seen during
|
||||
// the same interval, every Mth message is logged and the rest are dropped.
|
||||
//
|
||||
// For example,
|
||||
//
|
||||
// core = NewSamplerWithOptions(core, time.Second, 10, 5)
|
||||
//
|
||||
// This will log the first 10 log entries with the same level and message
|
||||
// in a one second interval as-is. Following that, it will allow through
|
||||
// every 5th log entry with the same level and message in that interval.
|
||||
//
|
||||
// If thereafter is zero, the Core will drop all log entries after the first N
|
||||
// in that interval.
|
||||
//
|
||||
// Sampler can be configured to report sampling decisions with the SamplerHook
|
||||
// option.
|
||||
//
|
||||
// Keep in mind that zap's sampling implementation is optimized for speed over
|
||||
// Keep in mind that Zap's sampling implementation is optimized for speed over
|
||||
// absolute precision; under load, each tick may be slightly over- or
|
||||
// under-sampled.
|
||||
func NewSamplerWithOptions(core Core, tick time.Duration, first, thereafter int, opts ...SamplerOption) Core {
|
||||
|
@ -200,7 +211,7 @@ func (s *sampler) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
|
|||
if ent.Level >= _minLevel && ent.Level <= _maxLevel {
|
||||
counter := s.counts.get(ent.Level, ent.Message)
|
||||
n := counter.IncCheckReset(ent.Time, s.tick)
|
||||
if n > s.first && (n-s.first)%s.thereafter != 0 {
|
||||
if n > s.first && (s.thereafter == 0 || (n-s.first)%s.thereafter != 0) {
|
||||
s.hook(ent, LogDropped)
|
||||
return ce
|
||||
}
|
||||
|
|
|
@ -100,7 +100,10 @@ func (p *parser) peek() yaml_event_type_t {
|
|||
if p.event.typ != yaml_NO_EVENT {
|
||||
return p.event.typ
|
||||
}
|
||||
if !yaml_parser_parse(&p.parser, &p.event) {
|
||||
// It's curious choice from the underlying API to generally return a
|
||||
// positive result on success, but on this case return true in an error
|
||||
// scenario. This was the source of bugs in the past (issue #666).
|
||||
if !yaml_parser_parse(&p.parser, &p.event) || p.parser.error != yaml_NO_ERROR {
|
||||
p.fail()
|
||||
}
|
||||
return p.event.typ
|
||||
|
@ -320,6 +323,8 @@ type decoder struct {
|
|||
decodeCount int
|
||||
aliasCount int
|
||||
aliasDepth int
|
||||
|
||||
mergedFields map[interface{}]bool
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -808,6 +813,11 @@ func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) {
|
|||
}
|
||||
}
|
||||
|
||||
mergedFields := d.mergedFields
|
||||
d.mergedFields = nil
|
||||
|
||||
var mergeNode *Node
|
||||
|
||||
mapIsNew := false
|
||||
if out.IsNil() {
|
||||
out.Set(reflect.MakeMap(outt))
|
||||
|
@ -815,11 +825,18 @@ func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) {
|
|||
}
|
||||
for i := 0; i < l; i += 2 {
|
||||
if isMerge(n.Content[i]) {
|
||||
d.merge(n.Content[i+1], out)
|
||||
mergeNode = n.Content[i+1]
|
||||
continue
|
||||
}
|
||||
k := reflect.New(kt).Elem()
|
||||
if d.unmarshal(n.Content[i], k) {
|
||||
if mergedFields != nil {
|
||||
ki := k.Interface()
|
||||
if mergedFields[ki] {
|
||||
continue
|
||||
}
|
||||
mergedFields[ki] = true
|
||||
}
|
||||
kkind := k.Kind()
|
||||
if kkind == reflect.Interface {
|
||||
kkind = k.Elem().Kind()
|
||||
|
@ -833,6 +850,12 @@ func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
d.mergedFields = mergedFields
|
||||
if mergeNode != nil {
|
||||
d.merge(n, mergeNode, out)
|
||||
}
|
||||
|
||||
d.stringMapType = stringMapType
|
||||
d.generalMapType = generalMapType
|
||||
return true
|
||||
|
@ -844,7 +867,8 @@ func isStringMap(n *Node) bool {
|
|||
}
|
||||
l := len(n.Content)
|
||||
for i := 0; i < l; i += 2 {
|
||||
if n.Content[i].ShortTag() != strTag {
|
||||
shortTag := n.Content[i].ShortTag()
|
||||
if shortTag != strTag && shortTag != mergeTag {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -861,7 +885,6 @@ func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) {
|
|||
var elemType reflect.Type
|
||||
if sinfo.InlineMap != -1 {
|
||||
inlineMap = out.Field(sinfo.InlineMap)
|
||||
inlineMap.Set(reflect.New(inlineMap.Type()).Elem())
|
||||
elemType = inlineMap.Type().Elem()
|
||||
}
|
||||
|
||||
|
@ -870,6 +893,9 @@ func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) {
|
|||
d.prepare(n, field)
|
||||
}
|
||||
|
||||
mergedFields := d.mergedFields
|
||||
d.mergedFields = nil
|
||||
var mergeNode *Node
|
||||
var doneFields []bool
|
||||
if d.uniqueKeys {
|
||||
doneFields = make([]bool, len(sinfo.FieldsList))
|
||||
|
@ -879,13 +905,20 @@ func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) {
|
|||
for i := 0; i < l; i += 2 {
|
||||
ni := n.Content[i]
|
||||
if isMerge(ni) {
|
||||
d.merge(n.Content[i+1], out)
|
||||
mergeNode = n.Content[i+1]
|
||||
continue
|
||||
}
|
||||
if !d.unmarshal(ni, name) {
|
||||
continue
|
||||
}
|
||||
if info, ok := sinfo.FieldsMap[name.String()]; ok {
|
||||
sname := name.String()
|
||||
if mergedFields != nil {
|
||||
if mergedFields[sname] {
|
||||
continue
|
||||
}
|
||||
mergedFields[sname] = true
|
||||
}
|
||||
if info, ok := sinfo.FieldsMap[sname]; ok {
|
||||
if d.uniqueKeys {
|
||||
if doneFields[info.Id] {
|
||||
d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type()))
|
||||
|
@ -911,6 +944,11 @@ func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) {
|
|||
d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type()))
|
||||
}
|
||||
}
|
||||
|
||||
d.mergedFields = mergedFields
|
||||
if mergeNode != nil {
|
||||
d.merge(n, mergeNode, out)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -918,19 +956,29 @@ func failWantMap() {
|
|||
failf("map merge requires map or sequence of maps as the value")
|
||||
}
|
||||
|
||||
func (d *decoder) merge(n *Node, out reflect.Value) {
|
||||
switch n.Kind {
|
||||
func (d *decoder) merge(parent *Node, merge *Node, out reflect.Value) {
|
||||
mergedFields := d.mergedFields
|
||||
if mergedFields == nil {
|
||||
d.mergedFields = make(map[interface{}]bool)
|
||||
for i := 0; i < len(parent.Content); i += 2 {
|
||||
k := reflect.New(ifaceType).Elem()
|
||||
if d.unmarshal(parent.Content[i], k) {
|
||||
d.mergedFields[k.Interface()] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch merge.Kind {
|
||||
case MappingNode:
|
||||
d.unmarshal(n, out)
|
||||
d.unmarshal(merge, out)
|
||||
case AliasNode:
|
||||
if n.Alias != nil && n.Alias.Kind != MappingNode {
|
||||
if merge.Alias != nil && merge.Alias.Kind != MappingNode {
|
||||
failWantMap()
|
||||
}
|
||||
d.unmarshal(n, out)
|
||||
d.unmarshal(merge, out)
|
||||
case SequenceNode:
|
||||
// Step backwards as earlier nodes take precedence.
|
||||
for i := len(n.Content) - 1; i >= 0; i-- {
|
||||
ni := n.Content[i]
|
||||
for i := 0; i < len(merge.Content); i++ {
|
||||
ni := merge.Content[i]
|
||||
if ni.Kind == AliasNode {
|
||||
if ni.Alias != nil && ni.Alias.Kind != MappingNode {
|
||||
failWantMap()
|
||||
|
@ -943,6 +991,8 @@ func (d *decoder) merge(n *Node, out reflect.Value) {
|
|||
default:
|
||||
failWantMap()
|
||||
}
|
||||
|
||||
d.mergedFields = mergedFields
|
||||
}
|
||||
|
||||
func isMerge(n *Node) bool {
|
||||
|
|
|
@ -687,6 +687,9 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i
|
|||
func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
|
||||
if first {
|
||||
token := peek_token(parser)
|
||||
if token == nil {
|
||||
return false
|
||||
}
|
||||
parser.marks = append(parser.marks, token.start_mark)
|
||||
skip_token(parser)
|
||||
}
|
||||
|
@ -786,7 +789,7 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) {
|
|||
}
|
||||
|
||||
token := peek_token(parser)
|
||||
if token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN {
|
||||
if token == nil || token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -813,6 +816,9 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) {
|
|||
func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
|
||||
if first {
|
||||
token := peek_token(parser)
|
||||
if token == nil {
|
||||
return false
|
||||
}
|
||||
parser.marks = append(parser.marks, token.start_mark)
|
||||
skip_token(parser)
|
||||
}
|
||||
|
@ -922,6 +928,9 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev
|
|||
func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
|
||||
if first {
|
||||
token := peek_token(parser)
|
||||
if token == nil {
|
||||
return false
|
||||
}
|
||||
parser.marks = append(parser.marks, token.start_mark)
|
||||
skip_token(parser)
|
||||
}
|
||||
|
|
|
@ -289,10 +289,9 @@ type UncountedTerminatedPods struct {
|
|||
Failed []types.UID `json:"failed,omitempty" protobuf:"bytes,2,rep,name=failed,casttype=k8s.io/apimachinery/pkg/types.UID"`
|
||||
}
|
||||
|
||||
// +enum
|
||||
type JobConditionType string
|
||||
|
||||
// These are valid conditions of a job.
|
||||
// These are built-in conditions of a job.
|
||||
const (
|
||||
// JobSuspended means the job has been suspended.
|
||||
JobSuspended JobConditionType = "Suspended"
|
||||
|
|
|
@ -214,7 +214,6 @@ type CertificateSigningRequestStatus struct {
|
|||
}
|
||||
|
||||
// RequestConditionType is the type of a CertificateSigningRequestCondition
|
||||
// +enum
|
||||
type RequestConditionType string
|
||||
|
||||
// Well-known condition types for certificate requests.
|
||||
|
|
|
@ -522,7 +522,6 @@ type PersistentVolumeClaimSpec struct {
|
|||
}
|
||||
|
||||
// PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type
|
||||
// +enum
|
||||
type PersistentVolumeClaimConditionType string
|
||||
|
||||
const (
|
||||
|
@ -2635,10 +2634,9 @@ const (
|
|||
)
|
||||
|
||||
// PodConditionType is a valid value for PodCondition.Type
|
||||
// +enum
|
||||
type PodConditionType string
|
||||
|
||||
// These are valid conditions of pod.
|
||||
// These are built-in conditions of pod. An application may use a custom condition not listed here.
|
||||
const (
|
||||
// ContainersReady indicates whether all containers in the pod are ready.
|
||||
ContainersReady PodConditionType = "ContainersReady"
|
||||
|
@ -5055,11 +5053,10 @@ const (
|
|||
NodeTerminated NodePhase = "Terminated"
|
||||
)
|
||||
|
||||
// +enum
|
||||
type NodeConditionType string
|
||||
|
||||
// These are valid conditions of node. Currently, we don't have enough information to decide
|
||||
// node condition. In the future, we will add more. The proposed set of conditions are:
|
||||
// These are valid but not exhaustive conditions of node. A cloud provider may set a condition not listed here.
|
||||
// The built-in set of conditions are:
|
||||
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
|
||||
const (
|
||||
// NodeReady means kubelet is healthy and ready to accept pods.
|
||||
|
@ -5094,10 +5091,9 @@ type NodeCondition struct {
|
|||
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
|
||||
}
|
||||
|
||||
// +enum
|
||||
type NodeAddressType string
|
||||
|
||||
// These are valid address type of node.
|
||||
// These are built-in addresses type of node. A cloud provider may set a type not listed here.
|
||||
const (
|
||||
// NodeHostName identifies a name of the node. Although every node can be assumed
|
||||
// to have a NodeAddress of this type, its exact syntax and semantics are not
|
||||
|
@ -5267,10 +5263,9 @@ const (
|
|||
NamespaceTerminatingCause metav1.CauseType = "NamespaceTerminating"
|
||||
)
|
||||
|
||||
// +enum
|
||||
type NamespaceConditionType string
|
||||
|
||||
// These are valid conditions of a namespace.
|
||||
// These are built-in conditions of a namespace.
|
||||
const (
|
||||
// NamespaceDeletionDiscoveryFailure contains information about namespace deleter errors during resource discovery.
|
||||
NamespaceDeletionDiscoveryFailure NamespaceConditionType = "NamespaceDeletionDiscoveryFailure"
|
||||
|
@ -5758,8 +5753,8 @@ type EventList struct {
|
|||
// List holds a list of objects, which may not be known by the server.
|
||||
type List metav1.List
|
||||
|
||||
// LimitType is a type of object that is limited
|
||||
// +enum
|
||||
// LimitType is a type of object that is limited. It can be Pod, Container, PersistentVolumeClaim or
|
||||
// a fully qualified resource name.
|
||||
type LimitType string
|
||||
|
||||
const (
|
||||
|
|
|
@ -413,6 +413,10 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
|||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
|
||||
if configShallowCopy.UserAgent == "" {
|
||||
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
// share the transport between all clients
|
||||
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
|
||||
if err != nil {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
base.go export-subst
|
|
@ -284,18 +284,15 @@ func (c *threadSafeMap) updateIndices(oldObj interface{}, newObj interface{}, ke
|
|||
c.indices[name] = index
|
||||
}
|
||||
|
||||
if len(indexValues) == 1 && len(oldIndexValues) == 1 && indexValues[0] == oldIndexValues[0] {
|
||||
// We optimize for the most common case where indexFunc returns a single value which has not been changed
|
||||
continue
|
||||
}
|
||||
|
||||
for _, value := range oldIndexValues {
|
||||
// We optimize for the most common case where index returns a single value.
|
||||
if len(indexValues) == 1 && value == indexValues[0] {
|
||||
continue
|
||||
}
|
||||
c.deleteKeyFromIndex(key, value, index)
|
||||
}
|
||||
for _, value := range indexValues {
|
||||
// We optimize for the most common case where index returns a single value.
|
||||
if len(oldIndexValues) == 1 && value == oldIndexValues[0] {
|
||||
continue
|
||||
}
|
||||
c.addKeyToIndex(key, value, index)
|
||||
}
|
||||
}
|
||||
|
|
4
vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go
generated
vendored
4
vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go
generated
vendored
|
@ -143,6 +143,10 @@ var newClientsetForConfigTemplate = `
|
|||
func NewForConfig(c *$.Config|raw$) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
|
||||
if configShallowCopy.UserAgent == "" {
|
||||
configShallowCopy.UserAgent = $.DefaultKubernetesUserAgent|raw$()
|
||||
}
|
||||
|
||||
// share the transport between all clients
|
||||
httpClient, err := $.RESTHTTPClientFor|raw$(&configShallowCopy)
|
||||
if err != nil {
|
||||
|
|
|
@ -65,6 +65,10 @@ const (
|
|||
// CertManagerCertificateClassName value for specifying Knative's Cert-Manager
|
||||
// Certificate reconciler.
|
||||
CertManagerCertificateClassName = "cert-manager.certificate.networking.knative.dev"
|
||||
|
||||
// ServingInternalCertName is the name of secret contains certificates in serving
|
||||
// system namespace.
|
||||
ServingInternalCertName = "knative-serving-certs"
|
||||
)
|
||||
|
||||
// Config Keys
|
||||
|
@ -118,27 +122,9 @@ const (
|
|||
// hostname for a Route's tag.
|
||||
TagTemplateKey = "tag-template"
|
||||
|
||||
// ActivatorCAKey is the config for the secret name, which stores CA public certificate used
|
||||
// to sign the activator TLS certificate.
|
||||
ActivatorCAKey = "activator-ca"
|
||||
|
||||
// ActivatorSANKey is the config for the SAN used to validate the activator TLS certificate.
|
||||
ActivatorSANKey = "activator-san"
|
||||
|
||||
// ActivatorCertKey is the config for the secret name, which stores certificates
|
||||
// to serve the TLS traffic from ingress to activator.
|
||||
ActivatorCertKey = "activator-cert-secret"
|
||||
|
||||
// QueueProxyCAKey is the config for the secret name, which stores CA public certificate used
|
||||
// to sign the queue-proxy TLS certificate.
|
||||
QueueProxyCAKey = "queue-proxy-ca"
|
||||
|
||||
// QueueProxySANKey is the config for the SAN used to validate the queue-proxy TLS certificate.
|
||||
QueueProxySANKey = "queue-proxy-san"
|
||||
|
||||
// QueueProxyCertKey is the config for the secret name, which stores certificates
|
||||
// to serve the TLS traffic from activator to queue-proxy.
|
||||
QueueProxyCertKey = "queue-proxy-cert-secret"
|
||||
// InternalEncryptionKey is the name of the configuration whether
|
||||
// internal traffic is encrypted or not.
|
||||
InternalEncryptionKey = "internal-encryption"
|
||||
)
|
||||
|
||||
// HTTPProtocol indicates a type of HTTP endpoint behavior
|
||||
|
@ -265,27 +251,8 @@ type Config struct {
|
|||
// not enabled. Defaults to "http".
|
||||
DefaultExternalScheme string
|
||||
|
||||
// ActivatorCA defines the secret name of the CA public certificate used to sign the activator TLS certificate.
|
||||
// The traffic is not encrypted if ActivatorCA is empty.
|
||||
ActivatorCA string
|
||||
|
||||
// ActivatorSAN defines the SAN (Subject Alt Name) used to validate the activator TLS certificate.
|
||||
// It is used only when ActivatorCA is specified.
|
||||
ActivatorSAN string
|
||||
|
||||
// ActivatorCertSecret defines the secret name of the server certificates to serve the TLS traffic from ingress to activator.
|
||||
ActivatorCertSecret string
|
||||
|
||||
// QueueProxyCA defines the secret name of the CA public certificate used to sign the queue-proxy TLS certificate.
|
||||
// The traffic to queue-proxy is not encrypted if QueueProxyCA is empty.
|
||||
QueueProxyCA string
|
||||
|
||||
// QueueProxySAN defines the SAN (Subject Alt Name) used to validate the queue-proxy TLS certificate.
|
||||
// It is used only when QueueProxyCA is specified.
|
||||
QueueProxySAN string
|
||||
|
||||
// QueueProxyCertSecret defines the secret name of the server certificates to serve the TLS traffic from activator to queue-proxy.
|
||||
QueueProxyCertSecret string
|
||||
// DefaultExternal specifies whether internal traffic is encrypted or not.
|
||||
InternalEncryption bool
|
||||
}
|
||||
|
||||
func defaultConfig() *Config {
|
||||
|
@ -300,12 +267,7 @@ func defaultConfig() *Config {
|
|||
AutocreateClusterDomainClaims: false,
|
||||
DefaultExternalScheme: "http",
|
||||
MeshCompatibilityMode: MeshCompatibilityModeAuto,
|
||||
ActivatorCA: "",
|
||||
ActivatorSAN: "",
|
||||
ActivatorCertSecret: "",
|
||||
QueueProxyCA: "",
|
||||
QueueProxySAN: "",
|
||||
QueueProxyCertSecret: "",
|
||||
InternalEncryption: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,12 +294,7 @@ func NewConfigFromMap(data map[string]string) (*Config, error) {
|
|||
cm.AsBool(AutocreateClusterDomainClaimsKey, &nc.AutocreateClusterDomainClaims),
|
||||
cm.AsBool(EnableMeshPodAddressabilityKey, &nc.EnableMeshPodAddressability),
|
||||
cm.AsString(DefaultExternalSchemeKey, &nc.DefaultExternalScheme),
|
||||
cm.AsString(ActivatorCAKey, &nc.ActivatorCA),
|
||||
cm.AsString(ActivatorSANKey, &nc.ActivatorSAN),
|
||||
cm.AsString(ActivatorCertKey, &nc.ActivatorCertSecret),
|
||||
cm.AsString(QueueProxyCAKey, &nc.QueueProxyCA),
|
||||
cm.AsString(QueueProxySANKey, &nc.QueueProxySAN),
|
||||
cm.AsString(QueueProxyCertKey, &nc.QueueProxyCertSecret),
|
||||
cm.AsBool(InternalEncryptionKey, &nc.InternalEncryption),
|
||||
asMode(MeshCompatibilityModeKey, &nc.MeshCompatibilityMode),
|
||||
asLabelSelector(NamespaceWildcardCertSelectorKey, &nc.NamespaceWildcardCertSelector),
|
||||
); err != nil {
|
||||
|
@ -394,22 +351,6 @@ func NewConfigFromMap(data map[string]string) (*Config, error) {
|
|||
return nil, fmt.Errorf("httpProtocol %s in config-network ConfigMap is not supported", data[HTTPProtocolKey])
|
||||
}
|
||||
|
||||
if nc.ActivatorCA != "" && nc.ActivatorSAN == "" {
|
||||
return nil, fmt.Errorf("%q must be set when %q was set", ActivatorSANKey, ActivatorCAKey)
|
||||
}
|
||||
|
||||
if nc.ActivatorCA == "" && nc.ActivatorSAN != "" {
|
||||
return nil, fmt.Errorf("%q must be set when %q was set", ActivatorCAKey, ActivatorSANKey)
|
||||
}
|
||||
|
||||
if nc.QueueProxyCA != "" && nc.QueueProxySAN == "" {
|
||||
return nil, fmt.Errorf("%q must be set when %q was set", QueueProxySANKey, QueueProxyCAKey)
|
||||
}
|
||||
|
||||
if nc.QueueProxyCA == "" && nc.QueueProxySAN != "" {
|
||||
return nil, fmt.Errorf("%q must be set when %q was set", QueueProxyCAKey, QueueProxySANKey)
|
||||
}
|
||||
|
||||
return nc, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -123,40 +123,6 @@ const (
|
|||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.DefaultExternalSchemeKey
|
||||
DefaultExternalSchemeKey = config.DefaultExternalSchemeKey
|
||||
|
||||
// ActivatorCAKey is the config for the secret name, which stores CA public certificate used
|
||||
// to sign the activator TLS certificate.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.ActivatorCAKey
|
||||
ActivatorCAKey = config.ActivatorCAKey
|
||||
|
||||
// ActivatorSANKey is the config for the SAN used to validate the activator TLS certificate.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.ActivatorSANKey
|
||||
ActivatorSANKey = config.ActivatorSANKey
|
||||
|
||||
// ActivatorCertKey is the config for the secret name, which stores certificates
|
||||
// to serve the TLS traffic from ingress to activator.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.ActivatorCertKey
|
||||
ActivatorCertKey = config.ActivatorCertKey
|
||||
|
||||
// QueueProxyCAKey is the config for the secret name, which stores CA public certificate used
|
||||
// to sign the queue-proxy TLS certificate.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.QueueProxyCAKey
|
||||
QueueProxyCAKey = config.QueueProxyCAKey
|
||||
|
||||
// QueueProxySANKey is the config for the SAN used to validate the queue-proxy TLS certificate.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.QueueProxySANKey
|
||||
QueueProxySANKey = config.QueueProxySANKey
|
||||
|
||||
// QueueProxyCertKey is the config for the secret name, which stores certificates
|
||||
// to serve the TLS traffic from activator to queue-proxy.
|
||||
//
|
||||
// Deprecated: use knative.dev/networking/pkg/config.QueueProxyCertKey
|
||||
QueueProxyCertKey = config.QueueProxyCertKey
|
||||
)
|
||||
|
||||
// DomainTemplateValues are the available properties people can choose from
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
// PodAutoscaler is a Knative abstraction that encapsulates the interface by which Knative
|
||||
// components instantiate autoscalers. This definition is an abstraction that may be backed
|
||||
// by multiple definitions. For more information, see the Knative Pluggability presentation:
|
||||
// https://docs.google.com/presentation/d/10KWynvAJYuOEWy69VBa6bHJVCqIsz1TNdEKosNvcpPY/edit
|
||||
// https://docs.google.com/presentation/d/19vW9HFZ6Puxt31biNZF3uLRejDmu82rxJIk1cWmxF7w/edit
|
||||
type PodAutoscaler struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
|
|
|
@ -61,7 +61,7 @@ github.com/cloudevents/sdk-go/sql/v2/gen
|
|||
github.com/cloudevents/sdk-go/sql/v2/parser
|
||||
github.com/cloudevents/sdk-go/sql/v2/runtime
|
||||
github.com/cloudevents/sdk-go/sql/v2/utils
|
||||
# github.com/cloudevents/sdk-go/v2 v2.8.0
|
||||
# github.com/cloudevents/sdk-go/v2 v2.10.1
|
||||
## explicit; go 1.14
|
||||
github.com/cloudevents/sdk-go/v2
|
||||
github.com/cloudevents/sdk-go/v2/binding
|
||||
|
@ -354,10 +354,10 @@ go.starlark.net/syntax
|
|||
# go.uber.org/atomic v1.9.0
|
||||
## explicit; go 1.13
|
||||
go.uber.org/atomic
|
||||
# go.uber.org/multierr v1.6.0
|
||||
## explicit; go 1.12
|
||||
# go.uber.org/multierr v1.8.0
|
||||
## explicit; go 1.14
|
||||
go.uber.org/multierr
|
||||
# go.uber.org/zap v1.19.1
|
||||
# go.uber.org/zap v1.21.0
|
||||
## explicit; go 1.13
|
||||
go.uber.org/zap
|
||||
go.uber.org/zap/buffer
|
||||
|
@ -562,7 +562,7 @@ gopkg.in/ini.v1
|
|||
# gopkg.in/yaml.v2 v2.4.0
|
||||
## explicit; go 1.15
|
||||
gopkg.in/yaml.v2
|
||||
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
# gopkg.in/yaml.v3 v3.0.1
|
||||
## explicit
|
||||
gopkg.in/yaml.v3
|
||||
# gotest.tools/v3 v3.1.0
|
||||
|
@ -573,7 +573,7 @@ gotest.tools/v3/internal/assert
|
|||
gotest.tools/v3/internal/difflib
|
||||
gotest.tools/v3/internal/format
|
||||
gotest.tools/v3/internal/source
|
||||
# k8s.io/api v0.23.5
|
||||
# k8s.io/api v0.23.8
|
||||
## explicit; go 1.16
|
||||
k8s.io/api/admissionregistration/v1
|
||||
k8s.io/api/admissionregistration/v1beta1
|
||||
|
@ -620,14 +620,14 @@ k8s.io/api/scheduling/v1beta1
|
|||
k8s.io/api/storage/v1
|
||||
k8s.io/api/storage/v1alpha1
|
||||
k8s.io/api/storage/v1beta1
|
||||
# k8s.io/apiextensions-apiserver v0.23.4
|
||||
# k8s.io/apiextensions-apiserver v0.23.8
|
||||
## explicit; go 1.16
|
||||
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
|
||||
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
|
||||
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1
|
||||
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
|
||||
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1
|
||||
# k8s.io/apimachinery v0.23.5
|
||||
# k8s.io/apimachinery v0.23.8
|
||||
## explicit; go 1.16
|
||||
k8s.io/apimachinery/pkg/api/equality
|
||||
k8s.io/apimachinery/pkg/api/errors
|
||||
|
@ -684,7 +684,7 @@ k8s.io/apimachinery/third_party/forked/golang/reflect
|
|||
k8s.io/cli-runtime/pkg/genericclioptions
|
||||
k8s.io/cli-runtime/pkg/printers
|
||||
k8s.io/cli-runtime/pkg/resource
|
||||
# k8s.io/client-go v0.23.5
|
||||
# k8s.io/client-go v0.23.8
|
||||
## explicit; go 1.16
|
||||
k8s.io/client-go/applyconfigurations/admissionregistration/v1
|
||||
k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1
|
||||
|
@ -819,7 +819,7 @@ k8s.io/client-go/util/jsonpath
|
|||
k8s.io/client-go/util/keyutil
|
||||
k8s.io/client-go/util/retry
|
||||
k8s.io/client-go/util/workqueue
|
||||
# k8s.io/code-generator v0.23.5
|
||||
# k8s.io/code-generator v0.23.8
|
||||
## explicit; go 1.16
|
||||
k8s.io/code-generator
|
||||
k8s.io/code-generator/cmd/client-gen
|
||||
|
@ -894,7 +894,7 @@ k8s.io/utils/lru
|
|||
k8s.io/utils/net
|
||||
k8s.io/utils/pointer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/eventing v0.32.1-0.20220610013825-f488f4670727
|
||||
# knative.dev/eventing v0.32.1-0.20220614135415-c1b0ea692715
|
||||
## explicit; go 1.16
|
||||
knative.dev/eventing/pkg/apis/config
|
||||
knative.dev/eventing/pkg/apis/duck
|
||||
|
@ -925,7 +925,7 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake
|
|||
# knative.dev/hack v0.0.0-20220610014127-dc6c287516dc
|
||||
## explicit; go 1.14
|
||||
knative.dev/hack
|
||||
# knative.dev/networking v0.0.0-20220610013825-3103f3a72792
|
||||
# knative.dev/networking v0.0.0-20220614203516-07c9d7614c61
|
||||
## explicit; go 1.17
|
||||
knative.dev/networking/pkg
|
||||
knative.dev/networking/pkg/apis/networking
|
||||
|
@ -940,7 +940,7 @@ knative.dev/networking/pkg/http/probe
|
|||
knative.dev/networking/pkg/http/proxy
|
||||
knative.dev/networking/pkg/http/stats
|
||||
knative.dev/networking/pkg/k8s
|
||||
# knative.dev/pkg v0.0.0-20220610014025-7d607d643ee2
|
||||
# knative.dev/pkg v0.0.0-20220621173822-9c5a7317fa9d
|
||||
## explicit; go 1.17
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
@ -990,7 +990,7 @@ knative.dev/pkg/tracing/config
|
|||
knative.dev/pkg/tracing/propagation
|
||||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||
knative.dev/pkg/tracker
|
||||
# knative.dev/serving v0.32.1-0.20220610185625-2f7b6dbeaf25
|
||||
# knative.dev/serving v0.32.1-0.20220621141822-357316355d00
|
||||
## explicit; go 1.17
|
||||
knative.dev/serving/pkg/apis/autoscaling
|
||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
|
|
Loading…
Reference in New Issue