diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index dd920abe..d4af3cce 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,7 +13,7 @@ To ensure that all developers follow the same guidelines for development, we hav - Clone this repository to your Go workspace: ```sh -# Make sure you are running go 1.21 or later +# Make sure you are running go 1.22 or later # Clone the project git clone git@github.com:target/flottbot.git somepath/flottbot diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b9e53a77..c6f4a0f6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/init@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/autobuild@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/analyze@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3 diff --git a/.golangci.yml b/.golangci.yml index 103d5538..e93547d9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,43 +27,42 @@ output: linters: disable-all: true enable: - - bidichk # checks for dangerous unicode character sequences - - bodyclose # checks whether HTTP response body is closed successfully - - contextcheck # check the function whether use a non-inherited context - - dupl # code clone detection - - errcheck # checks for unchecked errors - - errorlint # find misuses of errors - - exportloopref # check for exported loop vars - - funlen # detects long functions - - gci # consistent import order - - goconst # finds repeated strings that could be replaced by a constant - - gocyclo # computes and checks the cyclomatic complexity of functions - - godot # checks if comments end in a period - - gofmt # checks whether code was gofmt-ed - - goheader # checks is file header matches to pattern - - goimports # fixes imports and formats code in same style as gofmt - - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod - - goprintffuncname # checks that printf-like functions are named with f at the end - - gosec # inspects code for security problems - - gosimple # linter that specializes in simplifying a code - - govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string - - ineffassign # detects when assignments to existing variables aren't used - - makezero # finds slice declarations with non-zero initial length - - misspell # finds commonly misspelled English words in comments - - nakedret # finds naked returns in functions greater than a specified function length - - nilerr # finds the code that returns nil even if it checks that the error is not nil - - noctx # noctx finds sending http request without context.Context - - nolintlint # reports ill-formed or insufficient nolint directives - - revive # linter for go - - staticcheck # applies static analysis checks, go vet on steroids - - stylecheck # replacement for golint - - tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 - - typecheck # parses and type-checks go code, like the front-end of a go compiler - - unconvert # remove unnecessary type conversions - - unparam # reports unused function parameters - - unused # checks for unused constants, variables, functions and types - - whitespace # detects leading and trailing whitespace - - wsl # forces code to use empty lines + - bidichk # checks for dangerous unicode character sequences + - bodyclose # checks whether HTTP response body is closed successfully + - contextcheck # check the function whether use a non-inherited context + - dupl # code clone detection + - errcheck # checks for unchecked errors + - errorlint # find misuses of errors + - exportloopref # check for exported loop vars + - funlen # detects long functions + - gci # consistent import order + - goconst # finds repeated strings that could be replaced by a constant + - gocyclo # computes and checks the cyclomatic complexity of functions + - godot # checks if comments end in a period + - gofmt # checks whether code was gofmt-ed + - goheader # checks is file header matches to pattern + - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod + - goprintffuncname # checks that printf-like functions are named with f at the end + - gosec # inspects code for security problems + - gosimple # linter that specializes in simplifying a code + - govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string + - ineffassign # detects when assignments to existing variables aren't used + - makezero # finds slice declarations with non-zero initial length + - misspell # finds commonly misspelled English words in comments + - nakedret # finds naked returns in functions greater than a specified function length + - nilerr # finds the code that returns nil even if it checks that the error is not nil + - noctx # noctx finds sending http request without context.Context + - nolintlint # reports ill-formed or insufficient nolint directives + - revive # linter for go + - staticcheck # applies static analysis checks, go vet on steroids + - stylecheck # replacement for golint + - tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 + - typecheck # parses and type-checks go code, like the front-end of a go compiler + - unconvert # remove unnecessary type conversions + - unparam # reports unused function parameters + - unused # checks for unused constants, variables, functions and types + - whitespace # detects leading and trailing whitespace + - wsl # forces code to use empty lines # static list of linters we know golangci can run but we've # chosen to leave disabled for now @@ -78,13 +77,13 @@ linters: # - exhaustivestruct - style preference # - forbidigo - unused # - forcetypeassert - unused - # - gci - use goimports # - gochecknoinits - unused # - gochecknoglobals - global variables allowed - # - gocognit - unused complexity metric + # - gocognit - unused complexity metric # - gocritic - style preference # - godox - to be used in the future # - goerr113 - to be used in the future + # - goimports - use gci instead # - golint - archived, replaced with revive # - gofumpt - use gofmt # - gomnd - get too many false-positives @@ -92,7 +91,7 @@ linters: # - ifshort - use both styles # - ireturn - allow interfaces to be returned # - importas - want flexibility with naming - # - lll - not too concerned about line length + # - lll - not too concerned about line length # - interfacer - archived # - nestif - non-critical # - nilnil - style preference @@ -101,7 +100,7 @@ linters: # - paralleltest - false-positives # - prealloc - don't use # - predeclared - unused - # - promlinter - style preference + # - promlinter - style preference # - rowserrcheck - unused # - scopelint - deprecated - replaced with exportloopref # - sqlclosecheck - unused @@ -128,6 +127,7 @@ linters-settings: statements: 70 # https://github.com/daixiang0/gci + # gci write --skip-generated -s standard -s default -s prefix(github.com/target/flottbot) gci: sections: - standard @@ -140,16 +140,14 @@ linters-settings: # https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint nolintlint: - allow-unused: false # allow nolint directives that don't address a linting issue - require-explanation: true # require an explanation for nolint directives - require-specific: true # require nolint directives to be specific about which linter is being skipped + allow-unused: false # allow nolint directives that don't address a linting issue + require-explanation: true # require an explanation for nolint directives + require-specific: true # require nolint directives to be specific about which linter is being skipped # https://github.com/denis-tingaikin/go-header goheader: template: |- - Copyright (c) {{ YEAR }} Target Brands, Inc. All rights reserved. - - Use of this source code is governed by the LICENSE file in this repository. + SPDX-License-Identifier: Apache-2.0 # This section provides the configuration for how golangci # will report the issues it finds. diff --git a/Makefile b/Makefile index 54a2ce74..4719f616 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ GOARCH := $(shell go env GOARCH) GOOS := $(shell go env GOOS) BUILD_LDFLAGS := -s -w BUILD_LDFLAGS += -X github.com/target/flottbot/version.Version=${VERSION} -GOLANGCI_LINT_VERSION := "v1.55.2" +GOLANGCI_LINT_VERSION := "v1.56.1" PACKAGES := $(shell go list ./... | grep -v /config-example/) PLATFORM := "linux/amd64,linux/arm64" diff --git a/README.md b/README.md index faf220bf..8f0f84b8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ We currently provide a few Docker images: [target/flottbot:ruby](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and ruby v3.2 installed -[target/flottbot:golang](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and golang v1.21 installed +[target/flottbot:golang](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and golang v1.22 installed [target/flottbot:python](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and python v3.11 installed diff --git a/cmd/flottbot/main.go b/cmd/flottbot/main.go index 1766b49d..3152be92 100644 --- a/cmd/flottbot/main.go +++ b/cmd/flottbot/main.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package main diff --git a/config-example/scripts/main.go b/config-example/scripts/main.go index 08a4367d..a17bb3c7 100644 --- a/config-example/scripts/main.go +++ b/config-example/scripts/main.go @@ -1,7 +1,3 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. - package main import "fmt" diff --git a/core/configure.go b/core/configure.go index c1ca3077..a9745d8c 100644 --- a/core/configure.go +++ b/core/configure.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core diff --git a/core/configure_test.go b/core/configure_test.go index 1deaec2c..3a4c8c48 100644 --- a/core/configure_test.go +++ b/core/configure_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core @@ -138,6 +136,7 @@ func Test_configureChatApplication(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { configureChatApplication(tt.args.bot) + if tt.shouldRunChat != tt.args.bot.RunChat { t.Errorf("configureChatApplication() wanted RunChat set to %v, but got %v", tt.shouldRunChat, tt.args.bot.RunChat) } @@ -162,12 +161,15 @@ func Test_setSlackListenerPort(t *testing.T) { t.Run("slack listener port reads from env var config", func(t *testing.T) { bot := baseBot() bot.SlackListenerPort = "${TEST_SLACK_LISTENER_PORT}" + t.Setenv("TEST_SLACK_LISTENER_PORT", "TESTPORT") + validateRemoteSetup(bot) configureChatApplication(bot) expected := "TESTPORT" actual := bot.SlackListenerPort + if expected != actual { t.Errorf("configureChatApplication() wanted SlackListenerPort set to %v, but got %v", expected, actual) } @@ -180,6 +182,7 @@ func Test_setSlackListenerPort(t *testing.T) { expected := defaultSlackListenerPort actual := bot.SlackListenerPort + if expected != actual { t.Errorf("configureChatApplication() wanted SlackListenerUnsetPortVar set to %v, but got %v", expected, actual) } @@ -193,6 +196,7 @@ func Test_setSlackListenerPort(t *testing.T) { expected := defaultSlackListenerPort actual := bot.SlackListenerPort + if expected != actual { t.Errorf("configureChatApplication() wanted SlackListenerNoPort set to %v, but got %v", expected, actual) } @@ -254,6 +258,7 @@ func Test_validateRemoteSetup(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { validateRemoteSetup(tt.args.bot) + if tt.shouldRunChat != tt.args.bot.RunChat { t.Errorf("validateRemoteSetup() wanted RunChat set to %v, but got %v", tt.shouldRunChat, tt.args.bot.RunChat) } diff --git a/core/matcher.go b/core/matcher.go index bf445710..237ab7cf 100644 --- a/core/matcher.go +++ b/core/matcher.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core diff --git a/core/matcher_test.go b/core/matcher_test.go index 59456042..e7c1d71d 100644 --- a/core/matcher_test.go +++ b/core/matcher_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core @@ -133,6 +131,7 @@ func TestCraftResponse(t *testing.T) { t.Errorf("craftResponse() error = \"%v\", wantErr %v", err, tt.wantErr) return } + if !tt.wantErr { // all happy paths (i.e. no errors) go here if got != tt.wantOutput { t.Errorf("craftResponse() got = \"%s\", wantOutput %s", got, tt.wantOutput) @@ -198,10 +197,12 @@ func TestHandleExec(t *testing.T) { t.Errorf("handleExec() error = \"%v\", wantErr %v", err, tt.wantErr) return } + if !tt.wantErr { // all happy paths (i.e. no errors) go here if tt.args.msg.Vars["_exec_output"] != tt.wantScriptResponse.Output { t.Errorf("handleExec() = \"%s\", want \"%v\"", tt.args.msg.Vars["_exec_output"], tt.wantScriptResponse.Output) } + if tt.args.msg.Vars["_exec_status"] != strconv.Itoa(tt.wantScriptResponse.Status) { t.Errorf("handleExec() = %s, want %v", tt.args.msg.Vars["_exec_status"], tt.wantScriptResponse.Status) } @@ -217,7 +218,7 @@ func TestHandleHTTP(t *testing.T) { } // Init test variables - tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte("hello")) @@ -227,7 +228,7 @@ func TestHandleHTTP(t *testing.T) { })) defer tsOK.Close() - tsError := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsError := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNotFound) _, err := w.Write([]byte("not found")) @@ -237,7 +238,7 @@ func TestHandleHTTP(t *testing.T) { })) defer tsError.Close() - tsOKJSON := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsOKJSON := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"test": "value"}`)) @@ -315,10 +316,12 @@ func TestHandleHTTP(t *testing.T) { t.Errorf("handleHTTP() error = \"%v\", wantErr %v", err, tt.wantErr) return } + if !tt.wantErr { // all happy paths (i.e. no errors) go here if tt.args.msg.Vars["_raw_http_output"] != tt.wantResponse.Raw { t.Errorf("handleHTTP() = \"%s\", want \"%v\"", tt.args.msg.Vars["_raw_http_output"], tt.wantResponse.Raw) } + if tt.args.msg.Vars["_raw_http_status"] != strconv.Itoa(tt.wantResponse.Status) { t.Errorf("handleHTTP() = %s, want %v", tt.args.msg.Vars["_raw_http_status"], tt.wantResponse.Status) } @@ -436,11 +439,14 @@ func TestHandleMessage(t *testing.T) { t.Run(tt.name, func(t *testing.T) { // Set test variables var testOutputMsgs chan models.Message + var testHitRule chan models.Rule + tt.args.action.LimitToRooms = tt.wantLimitToRooms tt.args.action.Message = tt.wantActionMessage tt.args.msg.OutputToRooms = tt.wantOutputToRooms tt.args.msg.Output = tt.wantOutputMessage + if !tt.wantErr { // all happy paths (i.e. no errors) go here testOutputMsgs = make(chan models.Message, 1) testHitRule = make(chan models.Rule, 1) @@ -454,6 +460,7 @@ func TestHandleMessage(t *testing.T) { } else if (err == nil) == tt.wantErr { t.Errorf("handleMessage() error = %v, wantErr %v", err, tt.wantErr) } + if !tt.wantErr { // all happy paths (i.e. no errors) go here // this is actually pretty dangerous - this could cause a blocking wait and a panic... maybe look to test this better resultMsg := <-testOutputMsgs if tt.wantOutputMessage != resultMsg.Output { @@ -495,11 +502,14 @@ func TestHandleReaction(t *testing.T) { test.args.rule.Name = test.wantRuleName // Do test handleReaction(test.args.outputMsgs, test.args.msg, test.args.hitRule, test.args.rule) + resultMsg := <-testOutputMsgs resultRule := <-testHitRule + if test.wantMessage != resultMsg.Output { t.Errorf("handReaction() wanted message \"%s\", but got \"%s\"", test.wantMessage, resultMsg.Output) } + if test.wantRuleName != resultRule.Name { t.Errorf("handReaction() wanted rule %#q, but got %#q", test.wantRuleName, resultRule.Name) } @@ -559,9 +569,12 @@ func TestUpdateReaction(t *testing.T) { default: break } + tt.args.rule.Reaction = tt.reaction tt.args.action.Reaction = tt.updateReaction + updateReaction(tt.args.action, tt.args.rule, tt.args.vars) + if tt.args.rule.Reaction != tt.want { t.Errorf("updateReaction() wanted %s, but got %s", tt.want, tt.args.rule.Reaction) } @@ -594,6 +607,7 @@ func Test_getProccessedInputAndHitValue(t *testing.T) { if got != tt.want { t.Errorf("getProccessedInputAndHitValue() got = %v, want %v", got, tt.want) } + if got1 != tt.want1 { t.Errorf("getProccessedInputAndHitValue() got1 = %v, want %v", got1, tt.want1) } @@ -817,9 +831,11 @@ func Test_handleChatServiceRule(t *testing.T) { if tt.expectMsg != output.Output { t.Errorf("Output message didn't match, got = %v, want %v", output.Output, tt.expectMsg) } + if got != tt.want { t.Errorf("handleChatServiceRule() got = %v, want %v", got, tt.want) } + if got1 != tt.want1 { t.Errorf("handleChatServiceRule() got1 = %v, want %v", got1, tt.want1) } @@ -827,9 +843,11 @@ func Test_handleChatServiceRule(t *testing.T) { if got != tt.want { t.Errorf("handleChatServiceRule() got = %v, want %v", got, tt.want) } + if got1 != tt.want1 { t.Errorf("handleChatServiceRule() got1 = %v, want %v", got1, tt.want1) } + for argk, argv := range tt.expectedVars { if tt.args.message.Vars[argk] != argv { t.Errorf("handleChatServiceRules() did not extract argument %v. got = %v, want %v", argk, tt.args.message.Vars[argk], argv) @@ -881,6 +899,7 @@ func Test_handleSchedulerServiceRule(t *testing.T) { if got != tt.want { t.Errorf("handleSchedulerServiceRule() got = %v, want %v", got, tt.want) } + if got1 != tt.want1 { t.Errorf("handleSchedulerServiceRule() got1 = %v, want %v", got1, tt.want1) } @@ -1011,7 +1030,7 @@ func Test_doRuleActions(t *testing.T) { FormatOutput: "boo", } - tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte("OK")) @@ -1088,6 +1107,7 @@ func Test_doRuleActions(t *testing.T) { tt.args.outputMsgs = testOutput doRuleActions(tt.args.message, tt.args.outputMsgs, tt.args.rule, tt.args.hitRule, tt.args.bot) + output := <-testOutput if output.Output != tt.expectedMessage { diff --git a/core/outputs.go b/core/outputs.go index 1c1f2d15..216a79f5 100644 --- a/core/outputs.go +++ b/core/outputs.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core diff --git a/core/prommetric.go b/core/prommetric.go index 14126258..4486b4aa 100644 --- a/core/prommetric.go +++ b/core/prommetric.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core diff --git a/core/remotes.go b/core/remotes.go index 0858291f..e3a04ee7 100644 --- a/core/remotes.go +++ b/core/remotes.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core diff --git a/core/rules.go b/core/rules.go index 3765a8d5..30b40294 100644 --- a/core/rules.go +++ b/core/rules.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package core @@ -43,7 +41,7 @@ func Rules(rules *map[string]models.Rule, bot *models.Bot) { fileList := []string{} - err = filepath.Walk(rulesDir, func(path string, f os.FileInfo, err error) error { + err = filepath.Walk(rulesDir, func(path string, f os.FileInfo, _ error) error { if f != nil && !f.IsDir() { fileList = append(fileList, path) } diff --git a/docker/Dockerfile b/docker/Dockerfile index c7a0f467..d4bf85ab 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21.5-alpine@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b AS build +FROM --platform=${BUILDPLATFORM} docker.io/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 AS build ARG TARGETOS ARG TARGETARCH @@ -19,7 +19,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -a -ldflags "-s -w -X github.com/target/flottbot/version.Version=${VERSION}" \ -o flottbot ./cmd/flottbot -FROM docker.io/alpine:3.19.0@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 +FROM docker.io/alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b ENV USERNAME=flottbot ENV GROUP=flottbot diff --git a/docker/Dockerfile.golang b/docker/Dockerfile.golang index 2499459e..af075830 100644 --- a/docker/Dockerfile.golang +++ b/docker/Dockerfile.golang @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21.5-alpine@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b AS build +FROM --platform=${BUILDPLATFORM} docker.io/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 AS build ARG TARGETOS ARG TARGETARCH @@ -19,7 +19,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -a -ldflags "-s -w -X github.com/target/flottbot/version.Version=${VERSION}" \ -o flottbot ./cmd/flottbot -FROM docker.io/golang:1.21.5-alpine@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b +FROM docker.io/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 ENV USERNAME=flottbot ENV GROUP=flottbot diff --git a/docker/Dockerfile.python b/docker/Dockerfile.python index cf18b5fd..5824b5b6 100644 --- a/docker/Dockerfile.python +++ b/docker/Dockerfile.python @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21.5-alpine@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b AS build +FROM --platform=${BUILDPLATFORM} docker.io/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 AS build ARG TARGETOS ARG TARGETARCH @@ -19,7 +19,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -a -ldflags "-s -w -X github.com/target/flottbot/version.Version=${VERSION}" \ -o flottbot ./cmd/flottbot -FROM docker.io/python:3.12.1-alpine@sha256:c793b92fd9e0e2a0b611756788a033d569ca864b733461c8fb30cfd14847dbcf +FROM docker.io/python:3.12.2-alpine@sha256:1a0501213b470de000d8432b3caab9d8de5489e9443c2cc7ccaa6b0aa5c3148e ENV USERNAME=flottbot ENV GROUP=flottbot diff --git a/docker/Dockerfile.ruby b/docker/Dockerfile.ruby index db5256c5..0584866a 100644 --- a/docker/Dockerfile.ruby +++ b/docker/Dockerfile.ruby @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21.5-alpine@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b AS build +FROM --platform=${BUILDPLATFORM} docker.io/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 AS build ARG TARGETOS ARG TARGETARCH @@ -19,7 +19,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -a -ldflags "-s -w -X github.com/target/flottbot/version.Version=${VERSION}" \ -o flottbot ./cmd/flottbot -FROM docker.io/ruby:3.3.0-alpine@sha256:203b3087530e9cb117d8aab9b49bb766253fd8a6606a0d7520a591c7a3d992f7 +FROM docker.io/ruby:3.3.0-alpine@sha256:0373d59706f995ef31c528c3962b2c27481eeaeb87f90caca8aba16e7ecbac8f ENV USERNAME=flottbot ENV GROUP=flottbot diff --git a/go.mod b/go.mod index 6b464a0b..405dab1e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/target/flottbot go 1.21 require ( - cloud.google.com/go/pubsub v1.33.0 + cloud.google.com/go/pubsub v1.36.1 github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/sprig/v3 v3.2.3 github.com/bwmarrin/discordgo v0.27.1 @@ -13,14 +13,14 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/robfig/cron/v3 v3.0.1 github.com/rs/xid v1.5.0 - github.com/rs/zerolog v1.31.0 + github.com/rs/zerolog v1.32.0 github.com/slack-go/slack v0.12.3 github.com/spf13/viper v1.18.2 - google.golang.org/api v0.154.0 + google.golang.org/api v0.163.0 ) require ( - cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect @@ -29,12 +29,12 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect @@ -61,27 +61,27 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + google.golang.org/grpc v1.61.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 601979a2..69f1f36d 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= @@ -9,8 +9,8 @@ cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/kms v1.15.5 h1:pj1sRfut2eRbD9pFRjNnPNg/CzJPuQAzUujMIM1vVeM= cloud.google.com/go/kms v1.15.5/go.mod h1:cU2H5jnp6G2TDpUGZyqTCoy1n16fbubHZjmVXSMtwDI= -cloud.google.com/go/pubsub v1.33.0 h1:6SPCPvWav64tj0sVX/+npCBKhUi/UjJehy9op/V3p2g= -cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= +cloud.google.com/go/pubsub v1.36.1 h1:dfEPuGCHGbWUhaMCTHUFjfroILEkx55iUmKBZTP5f+Y= +cloud.google.com/go/pubsub v1.36.1/go.mod h1:iYjCa9EzWOoBiTdd4ps7QoMtMln5NwaZQpK1hbRfBDE= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= @@ -28,8 +28,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -48,8 +48,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc= @@ -63,7 +63,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -73,6 +72,7 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -89,8 +89,8 @@ github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= @@ -150,8 +150,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= -github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -186,18 +186,22 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.einride.tech/aip v0.66.0 h1:XfV+NQX6L7EOYK11yoHHFtndeaWh3KbD9/cN/6iWEt8= +go.einride.tech/aip v0.66.0/go.mod h1:qAhMsfT7plxBX+Oy7Huol6YUvZ0ZzdUz26yZsQwfl1M= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= @@ -207,8 +211,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= @@ -221,23 +225,22 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -250,15 +253,15 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= @@ -273,28 +276,28 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.154.0 h1:X7QkVKZBskztmpPKWQXgjJRPA2dJYrL6r+sYPRLj050= -google.golang.org/api v0.154.0/go.mod h1:qhSMkM85hgqiokIYsrRyKxrjfBeIhgl4Z2JmeRkYylc= +google.golang.org/api v0.163.0 h1:4BBDpPaSH+H28NhnX+WwjXxbRLQ7TWuEKp4BQyEjxvk= +google.golang.org/api v0.163.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY= -google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= +google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg= +google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe h1:0poefMBYvYbs7g5UkjS6HcxBPaTRAmznle9jnxYoAI8= +google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -306,8 +309,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/handlers/http.go b/handlers/http.go index 99ddc4bd..bf7de747 100644 --- a/handlers/http.go +++ b/handlers/http.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package handlers diff --git a/handlers/http_test.go b/handlers/http_test.go index 24661972..ba7472f7 100644 --- a/handlers/http_test.go +++ b/handlers/http_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package handlers @@ -51,12 +49,12 @@ func TestHTTPReq(t *testing.T) { msg *models.Message } - tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsOK := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })) defer tsOK.Close() - tsError := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + tsError := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusBadGateway) })) defer tsError.Close() @@ -130,6 +128,7 @@ func TestHTTPReq(t *testing.T) { t.Errorf("HTTPReq() error = %v, wantErr %v", err, tt.wantErr) return } + if !reflect.DeepEqual(got, tt.want) { t.Errorf("HTTPReq() = %v, want %v", got, tt.want) } @@ -162,9 +161,11 @@ func Test_prepRequestData(t *testing.T) { t.Errorf("prepRequestData() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("prepRequestData() got = %v, want %v", got, tt.want) } + if !reflect.DeepEqual(got1, tt.want1) { t.Errorf("prepRequestData() got1 = %v, want %v", got1, tt.want1) } @@ -196,6 +197,7 @@ func Test_createGetQuery(t *testing.T) { t.Errorf("createGetQuery() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("createGetQuery() = %v, want %v", got, tt.want) } @@ -232,6 +234,7 @@ func Test_createJSONPayload(t *testing.T) { t.Errorf("createJSONPayload() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("createJSONPayload() = %v, want %v", got, tt.want) } diff --git a/handlers/script.go b/handlers/script.go index d2a3f7a3..bb7d995a 100644 --- a/handlers/script.go +++ b/handlers/script.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package handlers diff --git a/handlers/script_test.go b/handlers/script_test.go index 97adc6d3..9414a012 100644 --- a/handlers/script_test.go +++ b/handlers/script_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package handlers diff --git a/models/action.go b/models/action.go index 11910ba5..4334b369 100644 --- a/models/action.go +++ b/models/action.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/models/bot.go b/models/bot.go index 0bba65fe..ca8cc5ad 100644 --- a/models/bot.go +++ b/models/bot.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/models/http.go b/models/http.go index c6f5736a..ea598f69 100644 --- a/models/http.go +++ b/models/http.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/models/message.go b/models/message.go index 975bb9b3..b75f1e05 100644 --- a/models/message.go +++ b/models/message.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/models/remotes.go b/models/remotes.go index 51f9f725..1d0cc62f 100644 --- a/models/remotes.go +++ b/models/remotes.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/models/rule.go b/models/rule.go index e8eded90..5aadbef7 100644 --- a/models/rule.go +++ b/models/rule.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models @@ -15,7 +13,7 @@ type Rule struct { OutputToRooms []string `mapstructure:"output_to_rooms" binding:"omitempty"` OutputToUsers []string `mapstructure:"output_to_users" binding:"omitempty"` AllowUsers []string `mapstructure:"allow_users" binding:"omitempty"` - AllowUserIds []string `mapstructure:"allow_userids" binding:"omitempty"` + AllowUserIDs []string `mapstructure:"allow_userids" binding:"omitempty"` AllowUserGroups []string `mapstructure:"allow_usergroups" binding:"omitempty"` IgnoreUsers []string `mapstructure:"ignore_users" binding:"omitempty"` IgnoreUserGroups []string `mapstructure:"ignore_usergroups" binding:"omitempty"` diff --git a/models/script.go b/models/script.go index 58955cd6..dec30b43 100644 --- a/models/script.go +++ b/models/script.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package models diff --git a/remote/cli/remote.go b/remote/cli/remote.go index 5a6af605..12e00c11 100644 --- a/remote/cli/remote.go +++ b/remote/cli/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package cli diff --git a/remote/context.go b/remote/context.go index 15cd9a55..6eb76282 100644 --- a/remote/context.go +++ b/remote/context.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package remote diff --git a/remote/discord/helper.go b/remote/discord/helper.go index 1c255041..8b2cb51a 100644 --- a/remote/discord/helper.go +++ b/remote/discord/helper.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package discord diff --git a/remote/discord/remote.go b/remote/discord/remote.go index 9ae6baf7..1ee63924 100644 --- a/remote/discord/remote.go +++ b/remote/discord/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package discord diff --git a/remote/discord/util.go b/remote/discord/util.go index 1d19f258..43be8a44 100644 --- a/remote/discord/util.go +++ b/remote/discord/util.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package discord diff --git a/remote/gchat/configure.go b/remote/gchat/configure.go index 9de97342..463abcfd 100644 --- a/remote/gchat/configure.go +++ b/remote/gchat/configure.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package gchat diff --git a/remote/gchat/helper.go b/remote/gchat/helper.go index e2309301..5e143a29 100644 --- a/remote/gchat/helper.go +++ b/remote/gchat/helper.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package gchat diff --git a/remote/gchat/remote.go b/remote/gchat/remote.go index 818d1c74..fe921508 100644 --- a/remote/gchat/remote.go +++ b/remote/gchat/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package gchat @@ -59,7 +57,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, sub := client.Subscription(c.SubscriptionID) - err := sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + err := sub.Receive(ctx, func(_ context.Context, m *pubsub.Message) { defer m.Ack() // Convert Google Chat Message to Flottbot Message diff --git a/remote/gchat/util.go b/remote/gchat/util.go index 6ca4a47d..0187148b 100644 --- a/remote/gchat/util.go +++ b/remote/gchat/util.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package gchat diff --git a/remote/remote.go b/remote/remote.go index 5977b3ce..cfb9a5bc 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package remote diff --git a/remote/scheduler/remote.go b/remote/scheduler/remote.go index a6b0f6d3..31433088 100644 --- a/remote/scheduler/remote.go +++ b/remote/scheduler/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package scheduler diff --git a/remote/slack/helper.go b/remote/slack/helper.go index 8fac2adf..bc44a426 100644 --- a/remote/slack/helper.go +++ b/remote/slack/helper.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package slack diff --git a/remote/slack/remote.go b/remote/slack/remote.go index bc0d6e87..af065c70 100644 --- a/remote/slack/remote.go +++ b/remote/slack/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package slack diff --git a/remote/slack/util.go b/remote/slack/util.go index 65a4445c..f73642c1 100644 --- a/remote/slack/util.go +++ b/remote/slack/util.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package slack diff --git a/remote/telegram/remote.go b/remote/telegram/remote.go index c79e29bc..4315c502 100644 --- a/remote/telegram/remote.go +++ b/remote/telegram/remote.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package telegram diff --git a/remote/telegram/util.go b/remote/telegram/util.go index 61e03c59..fdbd0488 100644 --- a/remote/telegram/util.go +++ b/remote/telegram/util.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package telegram diff --git a/utils/access_check.go b/utils/access_check.go index a1b14c1b..ed101268 100644 --- a/utils/access_check.go +++ b/utils/access_check.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils @@ -19,7 +17,7 @@ func CanTrigger(currentUserName string, currentUserID string, rule models.Rule, var canRunRule bool // no restriction were given for this rule, allow to proceed - if len(rule.AllowUsers)+len(rule.AllowUserGroups)+len(rule.AllowUserIds)+len(rule.IgnoreUsers)+len(rule.IgnoreUserGroups) == 0 { + if len(rule.AllowUsers)+len(rule.AllowUserGroups)+len(rule.AllowUserIDs)+len(rule.IgnoreUsers)+len(rule.IgnoreUserGroups) == 0 { return true } @@ -45,7 +43,7 @@ func CanTrigger(currentUserName string, currentUserID string, rule models.Rule, } // if they didn't get denied at this point and no 'allow' rules are set, let them through - if len(rule.AllowUsers)+len(rule.AllowUserGroups)+len(rule.AllowUserIds) == 0 { + if len(rule.AllowUsers)+len(rule.AllowUserGroups)+len(rule.AllowUserIDs) == 0 { return true } @@ -58,7 +56,7 @@ func CanTrigger(currentUserName string, currentUserID string, rule models.Rule, } // check if they are part of the allow users ids list - for _, userID := range rule.AllowUserIds { + for _, userID := range rule.AllowUserIDs { if userID == currentUserID { canRunRule = true break @@ -83,9 +81,9 @@ func CanTrigger(currentUserName string, currentUserID string, rule models.Rule, Msgf("%#q is not part of allow_users: %#q", currentUserName, strings.Join(rule.AllowUsers, ", ")) } - if len(rule.AllowUserIds) > 0 { + if len(rule.AllowUserIDs) > 0 { log.Info(). - Msgf("%#q is not part of allow_userids: %#q", currentUserID, strings.Join(rule.AllowUserIds, ", ")) + Msgf("%#q is not part of allow_userids: %#q", currentUserID, strings.Join(rule.AllowUserIDs, ", ")) } if len(rule.AllowUserGroups) > 0 { diff --git a/utils/access_check_test.go b/utils/access_check_test.go index ccd3e7da..5f7b0eab 100644 --- a/utils/access_check_test.go +++ b/utils/access_check_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils @@ -34,9 +32,9 @@ func TestCanTrigger(t *testing.T) { }{ {"No restrictions", args{"jane.doe", "F123456", models.Rule{}, testBot}, true}, {"User is allowed", args{"jane.doe", "F123456", models.Rule{AllowUsers: []string{"john.doe", "jane.doe"}}, testBot}, true}, - {"User is allowed by Id", args{"jane.doe", "F123456", models.Rule{AllowUserIds: []string{"F123456", "G123456"}}, testBot}, true}, + {"User is allowed by Id", args{"jane.doe", "F123456", models.Rule{AllowUserIDs: []string{"F123456", "G123456"}}, testBot}, true}, {"User not allowed", args{"jane.doe", "F123456", models.Rule{AllowUsers: []string{"john.doe", "jack.jill"}}, testBot}, false}, - {"User not allowed by Id", args{"jane.doe", "F123456", models.Rule{AllowUserIds: []string{"H123456", "I123456"}}, testBot}, false}, + {"User not allowed by Id", args{"jane.doe", "F123456", models.Rule{AllowUserIDs: []string{"H123456", "I123456"}}, testBot}, false}, {"User is ignored", args{"jane.doe", "F123456", models.Rule{IgnoreUsers: []string{"jane.doe", "jack.jill"}}, testBot}, false}, {"User not in ignore list", args{"jane.doe", "F123456", models.Rule{IgnoreUsers: []string{"john.doe", "jack.jill"}}, testBot}, true}, {"User is allowed but ignored", args{"jane.doe", "F123456", models.Rule{AllowUsers: []string{"jane.doe"}, IgnoreUsers: []string{"jane.doe", "jack.jill"}}, testBot}, false}, diff --git a/utils/is_set.go b/utils/is_set.go index b9b2d4a6..43ac3424 100644 --- a/utils/is_set.go +++ b/utils/is_set.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/is_set_test.go b/utils/is_set_test.go index 439ad3e1..8c9598be 100644 --- a/utils/is_set_test.go +++ b/utils/is_set_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/json.go b/utils/json.go index 47840cae..cf41fa63 100644 --- a/utils/json.go +++ b/utils/json.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/json_test.go b/utils/json_test.go index ff1b1baf..e1fa8a6e 100644 --- a/utils/json_test.go +++ b/utils/json_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/parse.go b/utils/parse.go index ad91453e..2a9dfbb3 100644 --- a/utils/parse.go +++ b/utils/parse.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/parse_test.go b/utils/parse_test.go index c6f3231a..077a1399 100644 --- a/utils/parse_test.go +++ b/utils/parse_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils @@ -40,6 +38,7 @@ func TestMatch(t *testing.T) { if got != tt.want { t.Errorf("Match() got = %v, want %v", got, tt.want) } + if got1 != tt.want1 { t.Errorf("Match() got1 = %v, want %v", got1, tt.want1) } @@ -74,6 +73,7 @@ func TestSubstitute(t *testing.T) { t.Errorf("Substitute() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("Substitute() = %v, want %v", got, tt.want) } diff --git a/utils/rooms.go b/utils/rooms.go index a805cccb..0c616b8a 100644 --- a/utils/rooms.go +++ b/utils/rooms.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/utils/rooms_test.go b/utils/rooms_test.go index 4db90351..aa2e4868 100644 --- a/utils/rooms_test.go +++ b/utils/rooms_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package utils diff --git a/version/version.go b/version/version.go index 54607912..9ca8aba0 100644 --- a/version/version.go +++ b/version/version.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package version diff --git a/version/version_test.go b/version/version_test.go index 53f7444c..dff49ebf 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -1,6 +1,4 @@ -// Copyright (c) 2023 Target Brands, Inc. All rights reserved. -// -// Use of this source code is governed by the LICENSE file in this repository. +// SPDX-License-Identifier: Apache-2.0 package version @@ -18,6 +16,7 @@ func TestString(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { Version = tt.version + if got := String(); got != tt.want { t.Errorf("String() = %v, want %v", got, tt.want) }