mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Changes to accommodate client-go changes and kube vendor update
to v1.18.0 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
4c96ad3c85
commit
34fc1d847e
5
vendor/go.uber.org/atomic/CHANGELOG.md
generated
vendored
5
vendor/go.uber.org/atomic/CHANGELOG.md
generated
vendored
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.6.0] - 2020-02-24
|
||||
### Changed
|
||||
- Drop library dependency on `golang.org/x/{lint, tools}`.
|
||||
|
||||
## [1.5.1] - 2019-11-19
|
||||
- Fix bug where `Bool.CAS` and `Bool.Toggle` do work correctly together
|
||||
causing `CAS` to fail even though the old value matches.
|
||||
@ -48,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Initial release.
|
||||
|
||||
[1.6.0]: https://github.com/uber-go/atomic/compare/v1.5.1...v1.6.0
|
||||
[1.5.1]: https://github.com/uber-go/atomic/compare/v1.5.0...v1.5.1
|
||||
[1.5.0]: https://github.com/uber-go/atomic/compare/v1.4.0...v1.5.0
|
||||
[1.4.0]: https://github.com/uber-go/atomic/compare/v1.3.2...v1.4.0
|
||||
|
6
vendor/go.uber.org/multierr/CHANGELOG.md
generated
vendored
6
vendor/go.uber.org/multierr/CHANGELOG.md
generated
vendored
@ -1,6 +1,12 @@
|
||||
Releases
|
||||
========
|
||||
|
||||
v1.5.0 (2020-02-24)
|
||||
===================
|
||||
|
||||
- Drop library dependency on development-time tooling.
|
||||
|
||||
|
||||
v1.4.0 (2019-11-04)
|
||||
===================
|
||||
|
||||
|
2
vendor/go.uber.org/multierr/error.go
generated
vendored
2
vendor/go.uber.org/multierr/error.go
generated
vendored
@ -130,7 +130,7 @@ type errorGroup interface {
|
||||
}
|
||||
|
||||
// Errors returns a slice containing zero or more errors that the supplied
|
||||
// error is composed of. If the error is nil, the returned slice is empty.
|
||||
// error is composed of. If the error is nil, a nil slice is returned.
|
||||
//
|
||||
// err := multierr.Append(r.Close(), w.Close())
|
||||
// errors := multierr.Errors(err)
|
||||
|
2
vendor/go.uber.org/multierr/go.mod
generated
vendored
2
vendor/go.uber.org/multierr/go.mod
generated
vendored
@ -4,7 +4,7 @@ go 1.12
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.3.0
|
||||
go.uber.org/atomic v1.5.0
|
||||
go.uber.org/atomic v1.6.0
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 // indirect
|
||||
|
4
vendor/go.uber.org/multierr/go.sum
generated
vendored
4
vendor/go.uber.org/multierr/go.sum
generated
vendored
@ -15,8 +15,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
|
30
vendor/go.uber.org/multierr/tools.go
generated
vendored
30
vendor/go.uber.org/multierr/tools.go
generated
vendored
@ -1,30 +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 tools
|
||||
|
||||
package multierr
|
||||
|
||||
import (
|
||||
// Tools we use during development.
|
||||
_ "go.uber.org/tools/update-license"
|
||||
_ "golang.org/x/lint/golint"
|
||||
_ "honnef.co/go/tools/cmd/staticcheck"
|
||||
)
|
19
vendor/go.uber.org/tools/LICENSE
generated
vendored
19
vendor/go.uber.org/tools/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2017 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.
|
1
vendor/go.uber.org/tools/update-license/.gitignore
generated
vendored
1
vendor/go.uber.org/tools/update-license/.gitignore
generated
vendored
@ -1 +0,0 @@
|
||||
update-license
|
24
vendor/go.uber.org/tools/update-license/README.md
generated
vendored
24
vendor/go.uber.org/tools/update-license/README.md
generated
vendored
@ -1,24 +0,0 @@
|
||||
# update-license
|
||||
|
||||
This is a small tool that updates the license header for Uber's open source Golang files.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
go get go.uber.org/tools/update-license
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
update-license go_files...
|
||||
```
|
||||
|
||||
## Further Work
|
||||
|
||||
* Support more licenses by name (MIT, Apache 2.0, etc), file path, url (http GET)
|
||||
* Support custom owner (not just "Uber Technologies, Inc.")
|
||||
* Support more languages than go (cover go, java, js, py to start, along with LICENSE, LICENSE.txt)
|
||||
* Talk about removing custom logic for header comments (ie `@generated`, `Code generated by`), it probably makes more sense just to put the license at the top
|
||||
* Better detection support for existing licenses so they can be removed
|
||||
* Verbose, dry run support
|
56
vendor/go.uber.org/tools/update-license/licenses.go
generated
vendored
56
vendor/go.uber.org/tools/update-license/licenses.go
generated
vendored
@ -1,56 +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.
|
||||
|
||||
package main
|
||||
|
||||
var licenseTemplates = map[string]string{
|
||||
"Apache-2.0": `// Copyright {{.Year}} {{.Owner}}
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.`,
|
||||
"MIT": `// Copyright (c) {{.Year}} {{.Owner}}
|
||||
//
|
||||
// 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.`,
|
||||
}
|
228
vendor/go.uber.org/tools/update-license/main.go
generated
vendored
228
vendor/go.uber.org/tools/update-license/main.go
generated
vendored
@ -1,228 +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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// how many lines to check for an existing copyright
|
||||
// this logic is not great and we should probably do something else
|
||||
// but this was copied from the python script
|
||||
copyrightLineLimit = 5
|
||||
headerPrefix = "// Copyright"
|
||||
)
|
||||
|
||||
var (
|
||||
flagDryRun = flag.Bool("dry", false, "Do not edit files and just print out what files would be edited")
|
||||
flagOwner = flag.String("owner", "Uber Technologies, Inc.", "Copyright owner")
|
||||
flagLicense = flag.String(
|
||||
"license",
|
||||
"MIT",
|
||||
fmt.Sprintf(
|
||||
"Type of license to use [%s]",
|
||||
strings.Join(validLicenses(), ", "),
|
||||
),
|
||||
)
|
||||
|
||||
lineSkipPrefixes = []string{
|
||||
"// Code generated by",
|
||||
"// @generated",
|
||||
}
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetOutput(os.Stdout)
|
||||
log.SetPrefix("")
|
||||
if err := do(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func do() error {
|
||||
flag.Parse()
|
||||
|
||||
if len(flag.Args()) < 1 {
|
||||
return fmt.Errorf("usage: %s GO_FILES", os.Args[0])
|
||||
}
|
||||
|
||||
return updateFiles(
|
||||
flag.Args(),
|
||||
time.Now().UTC().Year(),
|
||||
*flagLicense,
|
||||
*flagOwner,
|
||||
*flagDryRun,
|
||||
)
|
||||
}
|
||||
|
||||
func fullLicense(ts string, year int, owner string) string {
|
||||
var buf bytes.Buffer
|
||||
t, err := template.New("").Parse(ts)
|
||||
if err != nil {
|
||||
log.Panic("failed to parse license template", err)
|
||||
}
|
||||
|
||||
data := struct {
|
||||
Year int
|
||||
Owner string
|
||||
}{year, owner}
|
||||
if err := t.Execute(&buf, data); err != nil {
|
||||
log.Panic("failed to execture license template", err)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(buf.String())
|
||||
}
|
||||
|
||||
// validLicenses grabs all the license templates from the folder
|
||||
func validLicenses() []string {
|
||||
res := make([]string, 0, len(licenseTemplates))
|
||||
|
||||
for k := range licenseTemplates {
|
||||
res = append(res, k)
|
||||
}
|
||||
|
||||
sort.Strings(res)
|
||||
return res
|
||||
}
|
||||
|
||||
func updateFiles(
|
||||
filePaths []string,
|
||||
year int,
|
||||
license string,
|
||||
owner string,
|
||||
dryRun bool,
|
||||
) error {
|
||||
if err := checkFilePaths(filePaths); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, filePath := range filePaths {
|
||||
if err := updateFile(filePath, year, license, owner, dryRun); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkFilePaths(filePaths []string) error {
|
||||
for _, filePath := range filePaths {
|
||||
if filepath.Ext(filePath) != ".go" {
|
||||
return fmt.Errorf("%s is not a go file", filePath)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateFile(
|
||||
filePath string,
|
||||
year int,
|
||||
license string,
|
||||
owner string,
|
||||
dryRun bool,
|
||||
) error {
|
||||
data, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newData := updateData(data, year, license, owner)
|
||||
if !bytes.Equal(data, newData) {
|
||||
if dryRun {
|
||||
log.Print(filePath)
|
||||
return nil
|
||||
}
|
||||
// we could do something more complicated so that we do not
|
||||
// need to pass 0644 as the file mode, but in this case it should
|
||||
// never actually be used to create a file since we know the file
|
||||
// already exists, and it's easier to use the ReadFile/WriteFile
|
||||
// logic as it is right now, and since this is just a generation
|
||||
// program, this should be acceptable
|
||||
return ioutil.WriteFile(filePath, newData, 0644)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateData(
|
||||
data []byte,
|
||||
year int,
|
||||
license string,
|
||||
owner string,
|
||||
) []byte {
|
||||
licenseText := fullLicense(string(licenseTemplates[license]), year, owner)
|
||||
|
||||
return []byte(
|
||||
strings.Join(
|
||||
updateLines(strings.Split(string(data), "\n"), licenseText),
|
||||
"\n",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
// a value in the returned slice may contain newlines itself
|
||||
func updateLines(lines []string, license string) []string {
|
||||
for i, line := range lines {
|
||||
if i >= copyrightLineLimit {
|
||||
break
|
||||
}
|
||||
if strings.HasPrefix(line, headerPrefix) {
|
||||
// assume that the new license text always starts with the copyright
|
||||
// string. Pretty safe to assume, right? RIGHT?
|
||||
lines[i] = strings.Split(license, "\n")[0]
|
||||
return lines
|
||||
}
|
||||
}
|
||||
return addToLines(lines, license)
|
||||
}
|
||||
|
||||
// a value in the returned slice may contain newlines itself
|
||||
func addToLines(lines []string, license string) []string {
|
||||
i := 0
|
||||
for len(lines) > i && lineContainsSkipPrefix(lines[i]) {
|
||||
i++
|
||||
// skip comments under the generated line too
|
||||
for strings.HasPrefix(lines[i], "//") {
|
||||
i++
|
||||
}
|
||||
}
|
||||
if i == 0 {
|
||||
return append([]string{license, ""}, lines...)
|
||||
}
|
||||
return append(lines[0:i], append([]string{"", license}, lines[i:]...)...)
|
||||
}
|
||||
|
||||
func lineContainsSkipPrefix(line string) bool {
|
||||
for _, skipPrefix := range lineSkipPrefixes {
|
||||
if strings.HasPrefix(line, skipPrefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
29
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
29
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
@ -1,5 +1,27 @@
|
||||
# Changelog
|
||||
|
||||
## 1.14.1 (14 Mar 2020)
|
||||
|
||||
Bugfixes:
|
||||
* [#791][]: Fix panic on attempting to build a logger with an invalid Config.
|
||||
* [#795][]: Vendoring Zap with `go mod vendor` no longer includes Zap's
|
||||
development-time dependencies.
|
||||
* [#799][]: Fix issue introduced in 1.14.0 that caused invalid JSON output to
|
||||
be generated for arrays of `time.Time` objects when using string-based time
|
||||
formats.
|
||||
|
||||
Thanks to @YashishDua for their contributions to this release.
|
||||
|
||||
## 1.14.0 (20 Feb 2020)
|
||||
|
||||
Enhancements:
|
||||
* [#771][]: Optimize calls for disabled log levels.
|
||||
* [#773][]: Add millisecond duration encoder.
|
||||
* [#775][]: Add option to increase the level of a logger.
|
||||
* [#786][]: Optimize time formatters using `Time.AppendFormat` where possible.
|
||||
|
||||
Thanks to @caibirdme for their contributions to this release.
|
||||
|
||||
## 1.13.0 (13 Nov 2019)
|
||||
|
||||
Enhancements:
|
||||
@ -350,3 +372,10 @@ upgrade to the upcoming stable release.
|
||||
[#736]: https://github.com/uber-go/zap/pull/736
|
||||
[#751]: https://github.com/uber-go/zap/pull/751
|
||||
[#758]: https://github.com/uber-go/zap/pull/758
|
||||
[#771]: https://github.com/uber-go/zap/pull/771
|
||||
[#773]: https://github.com/uber-go/zap/pull/773
|
||||
[#775]: https://github.com/uber-go/zap/pull/775
|
||||
[#786]: https://github.com/uber-go/zap/pull/786
|
||||
[#791]: https://github.com/uber-go/zap/pull/791
|
||||
[#795]: https://github.com/uber-go/zap/pull/795
|
||||
[#799]: https://github.com/uber-go/zap/pull/799
|
||||
|
8
vendor/go.uber.org/zap/Makefile
generated
vendored
8
vendor/go.uber.org/zap/Makefile
generated
vendored
@ -1,6 +1,7 @@
|
||||
export GOBIN ?= $(shell pwd)/bin
|
||||
|
||||
GOLINT = $(GOBIN)/golint
|
||||
STATICCHECK = $(GOBIN)/staticcheck
|
||||
BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem
|
||||
|
||||
# Directories containing independent Go modules.
|
||||
@ -17,7 +18,7 @@ GO_FILES := $(shell \
|
||||
all: lint test
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(GOLINT)
|
||||
lint: $(GOLINT) $(STATICCHECK)
|
||||
@rm -rf lint.log
|
||||
@echo "Checking formatting..."
|
||||
@gofmt -d -s $(GO_FILES) 2>&1 | tee lint.log
|
||||
@ -25,6 +26,8 @@ lint: $(GOLINT)
|
||||
@$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go vet ./... 2>&1) &&) true | tee -a lint.log
|
||||
@echo "Checking lint..."
|
||||
@$(foreach dir,$(MODULE_DIRS),(cd $(dir) && $(GOLINT) ./... 2>&1) &&) true | tee -a lint.log
|
||||
@echo "Checking staticcheck..."
|
||||
@$(foreach dir,$(MODULE_DIRS),(cd $(dir) && $(STATICCHECK) ./... 2>&1) &&) true | tee -a lint.log
|
||||
@echo "Checking for unresolved FIXMEs..."
|
||||
@git grep -i fixme | grep -v -e Makefile | tee -a lint.log
|
||||
@echo "Checking for license headers..."
|
||||
@ -34,6 +37,9 @@ lint: $(GOLINT)
|
||||
$(GOLINT):
|
||||
go install golang.org/x/lint/golint
|
||||
|
||||
$(STATICCHECK):
|
||||
go install honnef.co/go/tools/cmd/staticcheck
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go test -race ./...) &&) true
|
||||
|
10
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
10
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
@ -23,7 +23,10 @@
|
||||
// package's zero-allocation formatters.
|
||||
package buffer // import "go.uber.org/zap/buffer"
|
||||
|
||||
import "strconv"
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
const _size = 1024 // by default, create 1 KiB buffers
|
||||
|
||||
@ -49,6 +52,11 @@ func (b *Buffer) AppendInt(i int64) {
|
||||
b.bs = strconv.AppendInt(b.bs, i, 10)
|
||||
}
|
||||
|
||||
// AppendTime appends the time formatted using the specified layout.
|
||||
func (b *Buffer) AppendTime(t time.Time, layout string) {
|
||||
b.bs = t.AppendFormat(b.bs, layout)
|
||||
}
|
||||
|
||||
// AppendUint appends an unsigned integer to the underlying buffer (assuming
|
||||
// base 10).
|
||||
func (b *Buffer) AppendUint(i uint64) {
|
||||
|
5
vendor/go.uber.org/zap/config.go
generated
vendored
5
vendor/go.uber.org/zap/config.go
generated
vendored
@ -21,6 +21,7 @@
|
||||
package zap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
@ -174,6 +175,10 @@ func (cfg Config) Build(opts ...Option) (*Logger, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if cfg.Level == (AtomicLevel{}) {
|
||||
return nil, fmt.Errorf("missing Level")
|
||||
}
|
||||
|
||||
log := New(
|
||||
zapcore.NewCore(enc, sink, cfg.Level),
|
||||
cfg.buildOptions(errSink)...,
|
||||
|
4
vendor/go.uber.org/zap/encoder.go
generated
vendored
4
vendor/go.uber.org/zap/encoder.go
generated
vendored
@ -62,6 +62,10 @@ func RegisterEncoder(name string, constructor func(zapcore.EncoderConfig) (zapco
|
||||
}
|
||||
|
||||
func newEncoder(name string, encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) {
|
||||
if encoderConfig.TimeKey != "" && encoderConfig.EncodeTime == nil {
|
||||
return nil, fmt.Errorf("missing EncodeTime in EncoderConfig")
|
||||
}
|
||||
|
||||
_encoderMutex.RLock()
|
||||
defer _encoderMutex.RUnlock()
|
||||
if name == "" {
|
||||
|
5
vendor/go.uber.org/zap/go.mod
generated
vendored
5
vendor/go.uber.org/zap/go.mod
generated
vendored
@ -5,7 +5,8 @@ go 1.13
|
||||
require (
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/stretchr/testify v1.4.0
|
||||
go.uber.org/atomic v1.5.0
|
||||
go.uber.org/multierr v1.3.0
|
||||
go.uber.org/atomic v1.6.0
|
||||
go.uber.org/multierr v1.5.0
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de
|
||||
honnef.co/go/tools v0.0.1-2019.2.3
|
||||
)
|
||||
|
8
vendor/go.uber.org/zap/go.sum
generated
vendored
8
vendor/go.uber.org/zap/go.sum
generated
vendored
@ -20,10 +20,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc=
|
||||
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
|
6
vendor/go.uber.org/zap/logger.go
generated
vendored
6
vendor/go.uber.org/zap/logger.go
generated
vendored
@ -258,6 +258,12 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
// (e.g., Check, Info, Fatal).
|
||||
const callerSkipOffset = 2
|
||||
|
||||
// Check the level first to reduce the cost of disabled log calls.
|
||||
// Since Panic and higher may exit, we skip the optimization for those levels.
|
||||
if lvl < zapcore.DPanicLevel && !log.core.Enabled(lvl) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create basic checked entry thru the core; this will be non-nil if the
|
||||
// log message will actually be written somewhere.
|
||||
ent := zapcore.Entry{
|
||||
|
19
vendor/go.uber.org/zap/options.go
generated
vendored
19
vendor/go.uber.org/zap/options.go
generated
vendored
@ -20,7 +20,11 @@
|
||||
|
||||
package zap
|
||||
|
||||
import "go.uber.org/zap/zapcore"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
// An Option configures a Logger.
|
||||
type Option interface {
|
||||
@ -107,3 +111,16 @@ func AddStacktrace(lvl zapcore.LevelEnabler) Option {
|
||||
log.addStack = lvl
|
||||
})
|
||||
}
|
||||
|
||||
// IncreaseLevel increase the level of the logger. It has no effect if
|
||||
// the passed in level tries to decrease the level of the logger.
|
||||
func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
|
||||
return optionFunc(func(log *Logger) {
|
||||
core, err := zapcore.NewIncreaseLevelCore(log.core, lvl)
|
||||
if err != nil {
|
||||
fmt.Fprintf(log.errorOutput, "failed to IncreaseLevel: %v", err)
|
||||
} else {
|
||||
log.core = core
|
||||
}
|
||||
})
|
||||
}
|
||||
|
28
vendor/go.uber.org/zap/tools.go
generated
vendored
28
vendor/go.uber.org/zap/tools.go
generated
vendored
@ -1,28 +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 tools
|
||||
|
||||
package zap
|
||||
|
||||
import (
|
||||
// Tools we use during development.
|
||||
_ "golang.org/x/lint/golint"
|
||||
)
|
36
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
36
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
@ -112,21 +112,43 @@ func EpochNanosTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendInt64(t.UnixNano())
|
||||
}
|
||||
|
||||
func encodeTimeLayout(t time.Time, layout string, enc PrimitiveArrayEncoder) {
|
||||
type appendTimeEncoder interface {
|
||||
AppendTimeLayout(time.Time, string)
|
||||
}
|
||||
|
||||
if enc, ok := enc.(appendTimeEncoder); ok {
|
||||
enc.AppendTimeLayout(t, layout)
|
||||
return
|
||||
}
|
||||
|
||||
enc.AppendString(t.Format(layout))
|
||||
}
|
||||
|
||||
// ISO8601TimeEncoder serializes a time.Time to an ISO8601-formatted string
|
||||
// with millisecond precision.
|
||||
//
|
||||
// If enc supports AppendTimeLayout(t time.Time,layout string), it's used
|
||||
// instead of appending a pre-formatted string value.
|
||||
func ISO8601TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendString(t.Format("2006-01-02T15:04:05.000Z0700"))
|
||||
encodeTimeLayout(t, "2006-01-02T15:04:05.000Z0700", enc)
|
||||
}
|
||||
|
||||
// RFC3339TimeEncoder serializes a time.Time to an RFC3339-formatted string.
|
||||
//
|
||||
// If enc supports AppendTimeLayout(t time.Time,layout string), it's used
|
||||
// instead of appending a pre-formatted string value.
|
||||
func RFC3339TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendString(t.Format(time.RFC3339))
|
||||
encodeTimeLayout(t, time.RFC3339, enc)
|
||||
}
|
||||
|
||||
// RFC3339NanoTimeEncoder serializes a time.Time to an RFC3339-formatted string
|
||||
// with nanosecond precision.
|
||||
//
|
||||
// If enc supports AppendTimeLayout(t time.Time,layout string), it's used
|
||||
// instead of appending a pre-formatted string value.
|
||||
func RFC3339NanoTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendString(t.Format(time.RFC3339Nano))
|
||||
encodeTimeLayout(t, time.RFC3339Nano, enc)
|
||||
}
|
||||
|
||||
// UnmarshalText unmarshals text to a TimeEncoder.
|
||||
@ -168,6 +190,12 @@ func NanosDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendInt64(int64(d))
|
||||
}
|
||||
|
||||
// MillisDurationEncoder serializes a time.Duration to an integer number of
|
||||
// milliseconds elapsed.
|
||||
func MillisDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) {
|
||||
enc.AppendInt64(d.Nanoseconds() / 1e6)
|
||||
}
|
||||
|
||||
// StringDurationEncoder serializes a time.Duration using its built-in String
|
||||
// method.
|
||||
func StringDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) {
|
||||
@ -183,6 +211,8 @@ func (e *DurationEncoder) UnmarshalText(text []byte) error {
|
||||
*e = StringDurationEncoder
|
||||
case "nanos":
|
||||
*e = NanosDurationEncoder
|
||||
case "ms":
|
||||
*e = MillisDurationEncoder
|
||||
default:
|
||||
*e = SecondsDurationEncoder
|
||||
}
|
||||
|
5
vendor/go.uber.org/zap/zapcore/error.go
generated
vendored
5
vendor/go.uber.org/zap/zapcore/error.go
generated
vendored
@ -66,11 +66,6 @@ type errorGroup interface {
|
||||
Errors() []error
|
||||
}
|
||||
|
||||
type causer interface {
|
||||
// Provides access to the error that caused this error.
|
||||
Cause() error
|
||||
}
|
||||
|
||||
// Note that errArry and errArrayElem are very similar to the version
|
||||
// implemented in the top-level error.go file. We can't re-use this because
|
||||
// that would require exporting errArray as part of the zapcore API.
|
||||
|
41
vendor/go.uber.org/atomic/tools.go → vendor/go.uber.org/zap/zapcore/increase_level.go
generated
vendored
41
vendor/go.uber.org/atomic/tools.go → vendor/go.uber.org/zap/zapcore/increase_level.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019 Uber Technologies, Inc.
|
||||
// Copyright (c) 2020 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,11 +18,38 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
// +build tools
|
||||
package zapcore
|
||||
|
||||
package atomic
|
||||
import "fmt"
|
||||
|
||||
import (
|
||||
// Tools used during development.
|
||||
_ "golang.org/x/lint/golint"
|
||||
)
|
||||
type levelFilterCore struct {
|
||||
Core
|
||||
|
||||
level LevelEnabler
|
||||
}
|
||||
|
||||
// NewIncreaseLevelCore creates a core that can be used to increase the level of
|
||||
// an existing Core. It cannot be used to decrease the logging level, as it acts
|
||||
// as a filter before calling the underlying core. If level decreases the log level,
|
||||
// an error is returned.
|
||||
func NewIncreaseLevelCore(core Core, level LevelEnabler) (Core, error) {
|
||||
for l := _maxLevel; l >= _minLevel; l-- {
|
||||
if !core.Enabled(l) && level.Enabled(l) {
|
||||
return nil, fmt.Errorf("invalid increase level, as level %q is allowed by increased level, but not by existing core", l)
|
||||
}
|
||||
}
|
||||
|
||||
return &levelFilterCore{core, level}, nil
|
||||
}
|
||||
|
||||
func (c *levelFilterCore) Enabled(lvl Level) bool {
|
||||
return c.level.Enabled(lvl)
|
||||
}
|
||||
|
||||
func (c *levelFilterCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
|
||||
if !c.Enabled(ent.Level) {
|
||||
return ce
|
||||
}
|
||||
|
||||
return c.Core.Check(ent, ce)
|
||||
}
|
7
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
7
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
@ -266,6 +266,13 @@ func (enc *jsonEncoder) AppendString(val string) {
|
||||
enc.buf.AppendByte('"')
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AppendTimeLayout(time time.Time, layout string) {
|
||||
enc.addElementSeparator()
|
||||
enc.buf.AppendByte('"')
|
||||
enc.buf.AppendTime(time, layout)
|
||||
enc.buf.AppendByte('"')
|
||||
}
|
||||
|
||||
func (enc *jsonEncoder) AppendTime(val time.Time) {
|
||||
cur := enc.buf.Len()
|
||||
enc.EncodeTime(val, enc)
|
||||
|
Reference in New Issue
Block a user