From d65fc5d4826c642093b13a2ec7a9a6960ad4988e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:54:51 +0400 Subject: [PATCH] chore(deps): Bump github.com/obalunenko/logger from 0.6.0 to 0.7.1 (#75) * chore(deps): Bump github.com/obalunenko/logger from 0.6.0 to 0.7.1 Bumps [github.com/obalunenko/logger](https://github.com/obalunenko/logger) from 0.6.0 to 0.7.1. - [Release notes](https://github.com/obalunenko/logger/releases) - [Changelog](https://github.com/obalunenko/logger/blob/master/.goreleaser.yml) - [Commits](https://github.com/obalunenko/logger/compare/v0.6.0...v0.7.1) --- updated-dependencies: - dependency-name: github.com/obalunenko/logger dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * fix: Use mod vendor for build --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oleg Balunenko --- .goreleaser.yml | 24 ++++++------- go.mod | 4 +-- go.sum | 8 ++--- vendor/github.com/obalunenko/logger/Makefile | 19 ++++------- vendor/github.com/obalunenko/logger/logger.go | 4 +-- vendor/github.com/sirupsen/logrus/README.md | 8 +++-- vendor/github.com/sirupsen/logrus/writer.go | 34 ++++++++++++++++++- vendor/modules.txt | 6 ++-- 8 files changed, 67 insertions(+), 40 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index b454725b..be15e43c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,7 +6,7 @@ release: **Full Changelog**: https://github.com/obalunenko/georgia-tax-calculator/compare/{{ .PreviousTag }}...{{ .Tag }} gomod: - proxy: true + proxy: false # If proxy is true, use these environment variables when running `go mod` commands (namely, `go mod tidy`). # Defaults to `os.Environ()`. env: @@ -16,24 +16,24 @@ gomod: - CGO_ENABLED=0 # Which Go binary to use. # Defaults to `go`. + mod: vendor gobinary: go -before: - hooks: - - go mod verify - builds: - id: cli binary: ge-tax-calc goos: - - linux - - darwin - - windows + - 'linux' + - 'darwin' + - 'windows' goarch: - - 386 - - amd64 - - arm - - arm64 + - 'amd64' + - 'arm' + - 'arm64' + ignore: + - goos: darwin + goarch: 'arm' + mod_timestamp: '{{ .CommitTimestamp }}' env: - CGO_ENABLED=0 diff --git a/go.mod b/go.mod index 89c8a6ee..d8aa53d6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/briandowns/spinner v1.23.0 - github.com/obalunenko/logger v0.6.0 + github.com/obalunenko/logger v0.7.1 github.com/obalunenko/version v1.1.0 github.com/savioxavier/termlink v1.3.0 github.com/shopspring/decimal v1.3.1 @@ -27,7 +27,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/term v0.6.0 // indirect diff --git a/go.sum b/go.sum index e572883e..b15abece 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/obalunenko/logger v0.6.0 h1:Sif4MYn6aGUA5pBTcKkMtJXTZNRZ52EiP4KLiFgMEkI= -github.com/obalunenko/logger v0.6.0/go.mod h1:AOThqVHT+qlG5yMVarmVYPP37yytKxL89HfY8S56a1s= +github.com/obalunenko/logger v0.7.1 h1:mhKjyScCj8ppBtdggxzcusIiod4w+GAJrEtsePjGahI= +github.com/obalunenko/logger v0.7.1/go.mod h1:YDhNeUCMxbCkZ6Kb84OjG4cgkegkHQFSVP5SXuVa4fM= github.com/obalunenko/version v1.1.0 h1:yVua7OHnK3+MJpendeMmAlfzVmq7R1h8MO3Ufz7HEec= github.com/obalunenko/version v1.1.0/go.mod h1:Or267aCQxNcAtgOeWA7yOe/RqJS4XDaMfcFwk3ohbOg= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -49,8 +49,8 @@ github.com/savioxavier/termlink v1.3.0 h1:3Gl4FzQjUyiHzmoEDfmWEhgIwDiJY4poOQHP+k github.com/savioxavier/termlink v1.3.0/go.mod h1:5T5ePUlWbxCHIwyF8/Ez1qufOoGM89RCg9NvG+3G3gc= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/vendor/github.com/obalunenko/logger/Makefile b/vendor/github.com/obalunenko/logger/Makefile index cbac5c42..48569eb4 100644 --- a/vendor/github.com/obalunenko/logger/Makefile +++ b/vendor/github.com/obalunenko/logger/Makefile @@ -6,13 +6,10 @@ VERSION ?= $(shell git describe --tags $(git rev-list --tags --max-count=1)) APP_NAME?=logger SHELL := env APP_NAME=$(APP_NAME) $(SHELL) -GOTOOLS_IMAGE_TAG?=v0.4.3 -SHELL := env GOTOOLS_IMAGE_TAG=$(GOTOOLS_IMAGE_TAG) $(SHELL) - COMPOSE_TOOLS_FILE=deployments/docker-compose/go-tools-docker-compose.yml COMPOSE_TOOLS_CMD_BASE=docker compose -f $(COMPOSE_TOOLS_FILE) -COMPOSE_TOOLS_CMD_UP=$(COMPOSE_TOOLS_CMD_BASE) up --exit-code-from -COMPOSE_TOOLS_CMD_PULL=$(COMPOSE_TOOLS_CMD_BASE) pull +COMPOSE_TOOLS_CMD_UP=$(COMPOSE_TOOLS_CMD_BASE) up --remove-orphans --exit-code-from +COMPOSE_TOOLS_CMD_PULL=$(COMPOSE_TOOLS_CMD_BASE) build TARGET_MAX_CHAR_NUM=20 @@ -86,13 +83,12 @@ format-project: fmt imports ## Installs vendored tools. install-tools: - echo "Installing ${GOTOOLS_IMAGE_TAG}" $(COMPOSE_TOOLS_CMD_PULL) .PHONY: install-tools ## vet project vet: - ./scripts/linting/run-vet.sh + $(COMPOSE_TOOLS_CMD_UP) vet vet .PHONY: vet ## Run full linting @@ -121,23 +117,22 @@ generate: codegen format-project vet ## Release release: - ./scripts/release/release.sh + $(COMPOSE_TOOLS_CMD_UP) release release .PHONY: release ## Release local snapshot release-local-snapshot: - ./scripts/release/local-snapshot-release.sh + $(COMPOSE_TOOLS_CMD_UP) release-local-snapshot release-local-snapshot .PHONY: release-local-snapshot ## Check goreleaser config. check-releaser: - ./scripts/release/check.sh + $(COMPOSE_TOOLS_CMD_UP) release-check-config release-check-config .PHONY: check-releaser ## Issue new release. -new-version: vet test-regression +new-version: vet test-regression build ./scripts/release/new-version.sh .PHONY: new-release .DEFAULT_GOAL := help - diff --git a/vendor/github.com/obalunenko/logger/logger.go b/vendor/github.com/obalunenko/logger/logger.go index e01ff2d3..7a24bd24 100644 --- a/vendor/github.com/obalunenko/logger/logger.go +++ b/vendor/github.com/obalunenko/logger/logger.go @@ -9,9 +9,7 @@ import ( "github.com/sirupsen/logrus" //nolint:depguard // this is the only place where logrus should be imported. ) -var ( - logInstance *logrus.Logger -) +var logInstance *logrus.Logger func init() { logInstance = logrus.New() diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md index b042c896..d1d4a85f 100644 --- a/vendor/github.com/sirupsen/logrus/README.md +++ b/vendor/github.com/sirupsen/logrus/README.md @@ -9,7 +9,7 @@ the last thing you want from your Logging library (again...). This does not mean Logrus is dead. Logrus will continue to be maintained for security, (backwards compatible) bug fixes, and performance (where we are -limited by the interface). +limited by the interface). I believe Logrus' biggest contribution is to have played a part in today's widespread use of structured logging in Golang. There doesn't seem to be a @@ -43,7 +43,7 @@ plain text): With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash or Splunk: -```json +```text {"animal":"walrus","level":"info","msg":"A group of walrus emerges from the ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"} @@ -99,7 +99,7 @@ time="2015-03-26T01:27:38-04:00" level=fatal method=github.com/sirupsen/arcticcr ``` Note that this does add measurable overhead - the cost will depend on the version of Go, but is between 20 and 40% in recent tests with 1.6 and 1.7. You can validate this in your -environment via benchmarks: +environment via benchmarks: ``` go test -bench=.*CallerTracing ``` @@ -317,6 +317,8 @@ log.SetLevel(log.InfoLevel) It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose environment if your application has that. +Note: If you want different log levels for global (`log.SetLevel(...)`) and syslog logging, please check the [syslog hook README](hooks/syslog/README.md#different-log-levels-for-local-and-remote-logging). + #### Entries Besides the fields added with `WithField` or `WithFields` some fields are diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go index 72e8e3a1..074fd4b8 100644 --- a/vendor/github.com/sirupsen/logrus/writer.go +++ b/vendor/github.com/sirupsen/logrus/writer.go @@ -4,6 +4,7 @@ import ( "bufio" "io" "runtime" + "strings" ) // Writer at INFO level. See WriterLevel for details. @@ -20,15 +21,18 @@ func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { return NewEntry(logger).WriterLevel(level) } +// Writer returns an io.Writer that writes to the logger at the info log level func (entry *Entry) Writer() *io.PipeWriter { return entry.WriterLevel(InfoLevel) } +// WriterLevel returns an io.Writer that writes to the logger at the given log level func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { reader, writer := io.Pipe() var printFunc func(args ...interface{}) + // Determine which log function to use based on the specified log level switch level { case TraceLevel: printFunc = entry.Trace @@ -48,23 +52,51 @@ func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { printFunc = entry.Print } + // Start a new goroutine to scan the input and write it to the logger using the specified print function. + // It splits the input into chunks of up to 64KB to avoid buffer overflows. go entry.writerScanner(reader, printFunc) + + // Set a finalizer function to close the writer when it is garbage collected runtime.SetFinalizer(writer, writerFinalizer) return writer } +// writerScanner scans the input from the reader and writes it to the logger func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { scanner := bufio.NewScanner(reader) + + // Set the buffer size to the maximum token size to avoid buffer overflows + scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize) + + // Define a split function to split the input into chunks of up to 64KB + chunkSize := bufio.MaxScanTokenSize // 64KB + splitFunc := func(data []byte, atEOF bool) (int, []byte, error) { + if len(data) >= chunkSize { + return chunkSize, data[:chunkSize], nil + } + + return bufio.ScanLines(data, atEOF) + } + + // Use the custom split function to split the input + scanner.Split(splitFunc) + + // Scan the input and write it to the logger using the specified print function for scanner.Scan() { - printFunc(scanner.Text()) + printFunc(strings.TrimRight(scanner.Text(), "\r\n")) } + + // If there was an error while scanning the input, log an error if err := scanner.Err(); err != nil { entry.Errorf("Error while reading from Writer: %s", err) } + + // Close the reader when we are done reader.Close() } +// WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected func writerFinalizer(writer *io.PipeWriter) { writer.Close() } diff --git a/vendor/modules.txt b/vendor/modules.txt index e831c975..c502bed3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -36,8 +36,8 @@ github.com/mattn/go-isatty # github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d ## explicit github.com/mgutz/ansi -# github.com/obalunenko/logger v0.6.0 -## explicit; go 1.20 +# github.com/obalunenko/logger v0.7.1 +## explicit; go 1.21 github.com/obalunenko/logger # github.com/obalunenko/version v1.1.0 ## explicit; go 1.17 @@ -57,7 +57,7 @@ github.com/savioxavier/termlink # github.com/shopspring/decimal v1.3.1 ## explicit; go 1.13 github.com/shopspring/decimal -# github.com/sirupsen/logrus v1.9.0 +# github.com/sirupsen/logrus v1.9.3 ## explicit; go 1.13 github.com/sirupsen/logrus # github.com/stretchr/testify v1.8.4