Skip to content

Commit

Permalink
Bump go + fasthttp + lint (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxday authored Apr 18, 2022
1 parent a929bf5 commit 11ed98d
Show file tree
Hide file tree
Showing 23 changed files with 1,389 additions and 134 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ jobs:
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v1
with:
go-version: 1.13

- name: Install Golint
run: go install golang.org/x/lint/golint

- name: Lint
run: golint
go-version: '1.17'

- name: golangci-lint
uses: golangci/golangci-lint-action@v2

unit-test:
runs-on: ubuntu-latest
Expand All @@ -31,7 +28,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: '1.17'

- name: Run tests
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
Expand All @@ -54,7 +51,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: '1.17'

- name: Cache Node modules
id: cache-node-modules
Expand Down
6 changes: 3 additions & 3 deletions ddlambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ type (
DDTraceEnabled bool
// MergeXrayTraces will cause Datadog traces to be merged with traces from AWS X-Ray.
MergeXrayTraces bool
// HttpClientTimeout specifies a time limit for requests to the API. It defaults to 5s.
HttpClientTimeout time.Duration
// HTTPClientTimeout specifies a time limit for requests to the API. It defaults to 5s.
HTTPClientTimeout time.Duration
// CircuitBreakerInterval is the cyclic period of the closed state
// for the CircuitBreaker to clear the internal Counts.
// default: 30s
Expand Down Expand Up @@ -237,7 +237,7 @@ func (cfg *Config) toMetricsConfig(isExtensionRunning bool) metrics.Config {
mc.KMSAPIKey = cfg.KMSAPIKey
mc.Site = cfg.Site
mc.ShouldUseLogForwarder = cfg.ShouldUseLogForwarder
mc.HttpClientTimeout = cfg.HttpClientTimeout
mc.HTTPClientTimeout = cfg.HTTPClientTimeout
}

if mc.Site == "" {
Expand Down
6 changes: 4 additions & 2 deletions ddlambda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (

func TestInvokeDryRun(t *testing.T) {
called := false
InvokeDryRun(func(ctx context.Context) {
_, err := InvokeDryRun(func(ctx context.Context) {
called = true
globalCtx := GetContext()
assert.Equal(t, globalCtx, ctx)
}, nil)
assert.NoError(t, err)
assert.True(t, called)
}

Expand All @@ -38,11 +39,12 @@ func TestMetricsSubmitWithWrapper(t *testing.T) {
}))
defer server.Close()

InvokeDryRun(func(ctx context.Context) {
_, err := InvokeDryRun(func(ctx context.Context) {
Metric("my-metric", 100, "my:tag")
}, &Config{
APIKey: "abc-123",
Site: server.URL,
})
assert.NoError(t, err)
assert.True(t, called)
}
51 changes: 39 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
module github.com/DataDog/datadog-lambda-go

go 1.13
go 1.17

require (
github.com/DATA-DOG/go-sqlmock v1.5.0 // indirect
github.com/DataDog/datadog-go v4.4.0+incompatible
github.com/Microsoft/go-winio v0.4.19 // indirect
github.com/aws/aws-lambda-go v1.25.0
github.com/aws/aws-sdk-go v1.40.2
github.com/DataDog/datadog-go v4.8.3+incompatible
github.com/aws/aws-lambda-go v1.29.0
github.com/aws/aws-sdk-go v1.43.37
github.com/aws/aws-xray-sdk-go v1.6.0
github.com/cenkalti/backoff v2.1.1+incompatible
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/philhofer/fwd v1.0.0 // indirect
github.com/sony/gobreaker v0.4.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/sony/gobreaker v0.5.0
github.com/stretchr/testify v1.7.0
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.37.1
)

require (
github.com/DATA-DOG/go-sqlmock v1.5.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.35.0 // indirect
github.com/DataDog/datadog-go/v5 v5.1.0 // indirect
github.com/DataDog/sketches-go v1.4.1 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.35.0 // indirect
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3 // indirect
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.30.0
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 11ed98d

Please sign in to comment.