Skip to content

Commit

Permalink
chore: go 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Sep 9, 2024
1 parent c9c86ca commit 81d159a
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 120 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
strategy:
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -38,8 +38,8 @@ jobs:
strategy:
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -65,8 +65,8 @@ jobs:
fail-fast: false
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down Expand Up @@ -98,8 +98,8 @@ jobs:
fail-fast: true
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
environment:
- development
- staging
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
strategy:
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -35,8 +35,8 @@ jobs:
strategy:
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down Expand Up @@ -64,8 +64,8 @@ jobs:
fail-fast: true
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
environment:
- development
- staging
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/server_regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
strategy:
matrix:
go:
- "1.21"
- "1.22"
- "1.23"
environment:
- development
- staging
Expand Down
9 changes: 6 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
run:
modules-download-mode: readonly
timeout: 5m
build-tags:
- integration

linters:
disable-all: true
enable:
- bodyclose
- copyloopvar
- dogsled
- dupl
- errcheck
- exhaustive
- exportloopref
- goconst
- gofmt
- goimports
Expand Down Expand Up @@ -50,3 +48,8 @@ issues:
- .github
- .vscode
- dist
exclude-rules:
- linters:
- gosec
text: "G115: integer overflow conversion"
path: _test\.go
3 changes: 3 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ version: 2

project_name: axiom-go

git:
prerelease_suffix: "-"

builds:
- skip: true

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ dep-clean: ## Remove obsolete dependencies
.PHONY: dep-upgrade
dep-upgrade: ## Upgrade all direct dependencies to their latest version
@echo ">> upgrading dependencies"
@$(GO) get -d $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
@$(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
@make dep

.PHONY: dep-upgrade-tools
dep-upgrade-tools: ## Upgrade all tool dependencies to their latest version
@echo ">> upgrading tool dependencies"
@$(GO) get -d $(GOTOOLS)
@$(GO) get $(GOTOOLS)
@make dep

.PHONY: dep
Expand Down
4 changes: 2 additions & 2 deletions adapters/slog/slog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func TestHandler(t *testing.T) {
_, _ = w.Write([]byte("{}"))
}

logger, flush := adapters.Setup(t, hf, setup(t))
logger, closeHandler := adapters.Setup(t, hf, setup(t))

logger.
With("key", "value").
Info("my message")

flush()
closeHandler()

assert.EqualValues(t, 1, atomic.LoadUint64(&hasRun))
}
Expand Down
2 changes: 1 addition & 1 deletion adapters/zerolog/zerolog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestHook_FlushFullBatch(t *testing.T) {

logger, _ := adapters.Setup(t, hf, setup(t))

for i := 0; i <= 10_000; i++ {
for range 10_001 {
logger.Info().Str("key", "value").Msg("my message")
}

Expand Down
10 changes: 5 additions & 5 deletions axiom/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestAnnotationService_Create(t *testing.T) {
assert.NoError(t, err)
}

client := setup(t, "/v2/annotations", hf)
client := setup(t, "POST /v2/annotations", hf)

res, err := client.Annotations.Create(context.Background(), exp)
require.NoError(t, err)
Expand All @@ -55,7 +55,7 @@ func TestAnnotationService_Get(t *testing.T) {
assert.NoError(t, err)
}

client := setup(t, "/v2/annotations/ann_test", hf)
client := setup(t, "GET /v2/annotations/ann_test", hf)

res, err := client.Annotations.Get(context.Background(), "ann_test")
require.NoError(t, err)
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestAnnotationService_List(t *testing.T) {
assert.NoError(t, err)
}

client := setup(t, "/v2/annotations", hf)
client := setup(t, "GET /v2/annotations", hf)

res, err := client.Annotations.List(context.Background(), nil)
require.NoError(t, err)
Expand All @@ -113,7 +113,7 @@ func TestAnnotationService_Update(t *testing.T) {
assert.NoError(t, err)
}

client := setup(t, "/v2/annotations/ann_test", hf)
client := setup(t, "PUT /v2/annotations/ann_test", hf)

res, err := client.Annotations.Update(context.Background(), "ann_test", exp)
require.NoError(t, err)
Expand All @@ -129,7 +129,7 @@ func TestAnnotationService_Delete(t *testing.T) {
w.Header().Set("Content-Type", mediaTypeJSON)
}

client := setup(t, "/v2/annotations/ann_test", hf)
client := setup(t, "DELETE /v2/annotations/ann_test", hf)

err := client.Annotations.Delete(context.Background(), "ann_test")
require.NoError(t, err)
Expand Down
20 changes: 10 additions & 10 deletions axiom/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func TestClient_do(t *testing.T) {
_, _ = fmt.Fprint(w, `{"A":"a"}`)
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

type foo struct {
A string
Expand All @@ -382,7 +382,7 @@ func TestClient_do_ioWriter(t *testing.T) {
_, _ = fmt.Fprint(w, content)
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand All @@ -401,7 +401,7 @@ func TestClient_do_HTTPError(t *testing.T) {
_, _ = w.Write([]byte(http.StatusText(http.StatusBadRequest)))
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand All @@ -421,7 +421,7 @@ func TestClient_do_HTTPError_Typed(t *testing.T) {
_, _ = w.Write([]byte(http.StatusText(http.StatusForbidden)))
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand All @@ -442,7 +442,7 @@ func TestClient_do_HTTPError_JSON(t *testing.T) {
}))
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand All @@ -466,7 +466,7 @@ func TestClient_do_HTTPError_Unauthenticated(t *testing.T) {
}))
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand Down Expand Up @@ -511,7 +511,7 @@ func TestClient_do_RateLimit(t *testing.T) {
}))
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand All @@ -531,7 +531,7 @@ func TestClient_do_RedirectLoop(t *testing.T) {
http.Redirect(w, r, "/", http.StatusFound)
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand Down Expand Up @@ -593,7 +593,7 @@ func TestClient_do_Backoff(t *testing.T) {
w.WriteHeader(header)
}

client := setup(t, "/", hf)
client := setup(t, "POST /", hf)

// Wrap with an io.TeeReader as http.NewRequest checks for some special
// readers it can read in full to optimize the request.
Expand Down Expand Up @@ -626,7 +626,7 @@ func TestClient_do_Backoff_NoRetryOn400(t *testing.T) {
w.WriteHeader(http.StatusBadRequest)
}

client := setup(t, "/", hf)
client := setup(t, "GET /", hf)

req, err := client.NewRequest(context.Background(), http.MethodGet, "/", nil)
require.NoError(t, err)
Expand Down
18 changes: 9 additions & 9 deletions axiom/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ func setIngestResultOnSpan(span trace.Span, res ingest.Status) {

span.SetAttributes(
attribute.String("axiom.result.trace_id", res.TraceID),
attribute.Int64("axiom.events.ingested", int64(res.Ingested)),
attribute.Int64("axiom.events.failed", int64(res.Failed)),
attribute.Int64("axiom.events.processed_bytes", int64(res.ProcessedBytes)),
attribute.Int64("axiom.events.ingested", int64(res.Ingested)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.events.failed", int64(res.Failed)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.events.processed_bytes", int64(res.ProcessedBytes)), //nolint:gosec // Fine for this use case.
)
}

Expand All @@ -753,9 +753,9 @@ func setQueryResultOnSpan(span trace.Span, res query.Result) {
span.SetAttributes(
attribute.String("axiom.result.trace_id", res.TraceID),
attribute.String("axiom.result.status.elapsed_time", res.Status.ElapsedTime.String()),
attribute.Int64("axiom.result.status.blocks_examined", int64(res.Status.BlocksExamined)),
attribute.Int64("axiom.result.status.rows_examined", int64(res.Status.RowsExamined)),
attribute.Int64("axiom.result.status.rows_matched", int64(res.Status.RowsMatched)),
attribute.Int64("axiom.result.status.blocks_examined", int64(res.Status.BlocksExamined)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.rows_examined", int64(res.Status.RowsExamined)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.rows_matched", int64(res.Status.RowsMatched)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.num_groups", int64(res.Status.NumGroups)),
attribute.Bool("axiom.result.status.is_partial", res.Status.IsPartial),
attribute.Bool("axiom.result.status.is_estimate", res.Status.IsEstimate),
Expand All @@ -775,9 +775,9 @@ func setLegacyQueryResultOnSpan(span trace.Span, res querylegacy.Result) {
span.SetAttributes(
attribute.String("axiom.result.trace_id", res.TraceID),
attribute.String("axiom.result.status.elapsed_time", res.Status.ElapsedTime.String()),
attribute.Int64("axiom.result.status.blocks_examined", int64(res.Status.BlocksExamined)),
attribute.Int64("axiom.result.status.rows_examined", int64(res.Status.RowsExamined)),
attribute.Int64("axiom.result.status.rows_matched", int64(res.Status.RowsMatched)),
attribute.Int64("axiom.result.status.blocks_examined", int64(res.Status.BlocksExamined)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.rows_examined", int64(res.Status.RowsExamined)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.rows_matched", int64(res.Status.RowsMatched)), //nolint:gosec // Fine for this use case.
attribute.Int64("axiom.result.status.num_groups", int64(res.Status.NumGroups)),
attribute.Bool("axiom.result.status.is_partial", res.Status.IsPartial),
attribute.Bool("axiom.result.status.is_estimate", res.Status.IsEstimate),
Expand Down
Loading

0 comments on commit 81d159a

Please sign in to comment.