From 0b8961175e091ea609c91f126781ea18a66345e8 Mon Sep 17 00:00:00 2001 From: Zaba505 Date: Sat, 9 Dec 2023 19:23:15 -0500 Subject: [PATCH 1/3] build(issue-2): add workflow for build and testing --- .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..97a85b1 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Lint Go Code + uses: golangci/golangci-lint-action@v3 + with: + version: latest + skip-cache: false + skip-pkg-cache: false + skip-build-cache: false + args: --timeout 3m --verbose --print-issued-lines=true + + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Build + run: go build ./... + + - name: Test + run: go test -race -cover ./... \ No newline at end of file From 5930e0e7ebeb699990b75c2e7baecbcb8088d06d Mon Sep 17 00:00:00 2001 From: Zaba505 Date: Sat, 9 Dec 2023 19:26:07 -0500 Subject: [PATCH 2/3] build(issue-2): set up go before linting --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 97a85b1..eaf5e63 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,6 +13,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + - name: Lint Go Code uses: golangci/golangci-lint-action@v3 with: @@ -22,10 +26,6 @@ jobs: skip-build-cache: false args: --timeout 3m --verbose --print-issued-lines=true - - uses: actions/setup-go@v4 - with: - go-version: '1.21' - - name: Build run: go build ./... From b0407bce757cbe9358b64915aa7e0b820cdf5a2f Mon Sep 17 00:00:00 2001 From: Zaba505 Date: Sat, 9 Dec 2023 19:35:51 -0500 Subject: [PATCH 3/3] build(issue-2): ignore tests and examples when linting --- .github/workflows/build.yaml | 2 +- go.mod | 5 ----- go.sum | 10 ---------- grpc/grpc.go | 2 +- http/http.go | 2 +- queue/sqs/delete.go | 34 -------------------------------- queue/sqs/queue.go | 38 ------------------------------------ 7 files changed, 3 insertions(+), 90 deletions(-) delete mode 100644 queue/sqs/delete.go delete mode 100644 queue/sqs/queue.go diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eaf5e63..f7bef2e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: skip-cache: false skip-pkg-cache: false skip-build-cache: false - args: --timeout 3m --verbose --print-issued-lines=true + args: --timeout 3m --verbose --print-issued-lines=true --skip-dirs example --skip-files ".*_test.go" - name: Build run: go build ./... diff --git a/go.mod b/go.mod index baa6c98..866f513 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.20 require ( github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.21.0 - github.com/aws/aws-sdk-go-v2/service/sqs v1.29.5 github.com/hashicorp/go-retryablehttp v0.7.5 github.com/mitchellh/mapstructure v1.5.0 github.com/sony/gobreaker v0.5.0 @@ -29,10 +28,6 @@ require ( cloud.google.com/go/trace v1.10.4 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.21.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.45.0 // indirect - github.com/aws/aws-sdk-go-v2 v1.24.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 // indirect - github.com/aws/smithy-go v1.19.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect diff --git a/go.sum b/go.sum index 6a37312..598d2a5 100644 --- a/go.sum +++ b/go.sum @@ -17,16 +17,6 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.21. github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.45.0 h1:/BF7rO6PYcmFoyJrq6HA3LqQpFSQei9aNuO1fvV3OqU= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.45.0 h1:o/Nf55GfyLwGDaHkVAkRGgBXeExce73L6N9w2PZTB3k= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.45.0/go.mod h1:qkFPtMouQjW5ugdHIOthiTbweVHUTqbS0Qsu55KqXks= -github.com/aws/aws-sdk-go-v2 v1.24.0 h1:890+mqQ+hTpNuw0gGP6/4akolQkSToDJgHfQE7AwGuk= -github.com/aws/aws-sdk-go-v2 v1.24.0/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 h1:v+HbZaCGmOwnTTVS86Fleq0vPzOd7tnJGbFhP0stNLs= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9/go.mod h1:Xjqy+Nyj7VDLBtCMkQYOw1QYfAEZCVLrfI0ezve8wd4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 h1:N94sVhRACtXyVcjXxrwK1SKFIJrA9pOJ5yu2eSHnmls= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9/go.mod h1:hqamLz7g1/4EJP+GH5NBhcUMLjW+gKLQabgyz6/7WAU= -github.com/aws/aws-sdk-go-v2/service/sqs v1.29.5 h1:cJb4I498c1mrOVrRqYTcnLD65AFqUuseHfzHdNZHL9U= -github.com/aws/aws-sdk-go-v2/service/sqs v1.29.5/go.mod h1:mCUv04gd/7g+/HNzDB4X6dzJuygji0ckvB3Lg/TdG5Y= -github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= -github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 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= diff --git a/grpc/grpc.go b/grpc/grpc.go index e479e6d..b3ac58e 100644 --- a/grpc/grpc.go +++ b/grpc/grpc.go @@ -129,7 +129,7 @@ func (rt *Runtime) Run(ctx context.Context) error { return } rt.log.Info("shutting down tracer provider") - stp.Shutdown(context.Background()) + _ = stp.Shutdown(context.Background()) }() rt.log.Info("shutting down service") diff --git a/http/http.go b/http/http.go index 3f52b1b..1088af1 100644 --- a/http/http.go +++ b/http/http.go @@ -167,7 +167,7 @@ func (rt *Runtime) Run(ctx context.Context) error { return } rt.log.Info("shutting down tracer provider") - stp.Shutdown(context.Background()) + _ = stp.Shutdown(context.Background()) }() ctx, cancel := context.WithCancel(context.Background()) diff --git a/queue/sqs/delete.go b/queue/sqs/delete.go deleted file mode 100644 index 4ebf7a7..0000000 --- a/queue/sqs/delete.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2023 Z5Labs and Contributors -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -package sqs - -import ( - "context" - - "github.com/z5labs/app/queue" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/aws/aws-sdk-go-v2/service/sqs/types" -) - -type batchDeleter interface { - DeleteMessageBatch(context.Context, *sqs.DeleteMessageBatchInput, ...func(*sqs.Options)) (*sqs.DeleteMessageBatchOutput, error) -} - -// BatchDeleteProcessor -type BatchDeleteProcessor struct { - batchDeleter batchDeleter -} - -// BatchDelete -func BatchDelete(url string, p queue.BatchProcessor[types.Message]) *BatchDeleteProcessor { - return nil -} - -// ProcessBatch -func (p *BatchDeleteProcessor) ProcessBatch(ctx context.Context, msgs []types.Message) []queue.BatchResult { - return nil -} diff --git a/queue/sqs/queue.go b/queue/sqs/queue.go deleted file mode 100644 index aa12d33..0000000 --- a/queue/sqs/queue.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2023 Z5Labs and Contributors -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -package sqs - -import ( - "context" - - "github.com/aws/aws-sdk-go-v2/service/sqs" -) - -// QueueConfig -type QueueConfig struct { - URL string `config:"queue_url"` - MaxNumberOfMessages int32 `config:"max_number_of_messages"` - WaitTimeSeconds int32 `config:"wait_time_seconds"` - VisibilityTimeout int32 `config:"visibility_timeout"` -} - -type receiver interface { - ReceiveMessage(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error) -} - -// Queue -type Queue struct { - receiver receiver - queueURL string - maxNumberOfMessages int32 - waitTimeSeconds int32 - visibilityTimeout int32 -} - -// Dial -func Dial(url string) *Queue { - return nil -}