Skip to content

Commit

Permalink
Bump go version to 1.20 (#2079)
Browse files Browse the repository at this point in the history
* Bump go version to 1.20

* Replace rand.Rand to crypto/rand.Rand
  • Loading branch information
scalalang2 authored Feb 10, 2023
1 parent 0c1eb27 commit 79f0b27
Show file tree
Hide file tree
Showing 30 changed files with 122 additions and 88 deletions.
10 changes: 5 additions & 5 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ local image_tag_for_cd() = {

local build_binaries(arch) = {
name: 'build-tempo-binaries',
image: 'golang:1.19-alpine',
image: 'golang:1.20-alpine',
commands: [
'apk add make git',
] + [
Expand Down Expand Up @@ -226,7 +226,7 @@ local deploy_to_dev() = {
steps+: [
{
name: 'build-tempo-serverless',
image: 'golang:1.19-alpine',
image: 'golang:1.20-alpine',
commands: [
'apk add make git zip bash',
'./tools/image-tag | cut -d, -f 1 | tr A-Z a-z > .tags', // values in .tags are used by the next step when pushing the image
Expand Down Expand Up @@ -323,7 +323,7 @@ local deploy_to_dev() = {
},
{
name: 'write-key',
image: 'golang:1.19',
image: 'golang:1.20',
commands: ['printf "%s" "$NFPM_SIGNING_KEY" > $NFPM_SIGNING_KEY_FILE'],
environment: {
NFPM_SIGNING_KEY: { from_secret: gpg_private_key.name },
Expand All @@ -332,7 +332,7 @@ local deploy_to_dev() = {
},
{
name: 'test release',
image: 'golang:1.19',
image: 'golang:1.20',
commands: ['make release-snapshot'],
environment: {
NFPM_DEFAULT_PASSPHRASE: { from_secret: gpg_passphrase.name },
Expand Down Expand Up @@ -365,7 +365,7 @@ local deploy_to_dev() = {
},
{
name: 'release',
image: 'golang:1.19',
image: 'golang:1.20',
commands: ['make release'],
environment: {
GITHUB_TOKEN: { from_secret: gh_token_secret.name },
Expand Down
12 changes: 6 additions & 6 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
- COMPONENT=tempo GOARCH=amd64 make exe
- COMPONENT=tempo-vulture GOARCH=amd64 make exe
- COMPONENT=tempo-query GOARCH=amd64 make exe
image: golang:1.19-alpine
image: golang:1.20-alpine
name: build-tempo-binaries
- image: plugins/docker
name: build-tempo-image
Expand Down Expand Up @@ -77,7 +77,7 @@ steps:
- COMPONENT=tempo GOARCH=arm64 make exe
- COMPONENT=tempo-vulture GOARCH=arm64 make exe
- COMPONENT=tempo-query GOARCH=arm64 make exe
image: golang:1.19-alpine
image: golang:1.20-alpine
name: build-tempo-binaries
- image: plugins/docker
name: build-tempo-image
Expand Down Expand Up @@ -235,7 +235,7 @@ steps:
- cd ./cmd/tempo-serverless
- make build-docker-gcr-binary
- make build-lambda-zip
image: golang:1.19-alpine
image: golang:1.20-alpine
name: build-tempo-serverless
- image: plugins/gcr
name: deploy-tempo-serverless-gcr
Expand Down Expand Up @@ -304,15 +304,15 @@ steps:
NFPM_SIGNING_KEY:
from_secret: gpg_private_key
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: golang:1.19
image: golang:1.20
name: write-key
- commands:
- make release-snapshot
environment:
NFPM_DEFAULT_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: golang:1.19
image: golang:1.20
name: test release
- commands:
- ./tools/packaging/verify-deb-install.sh
Expand All @@ -338,7 +338,7 @@ steps:
NFPM_DEFAULT_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: golang:1.19
image: golang:1.20
name: release
when:
event:
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Install jsonnetfmt and goimports
run: |
Expand All @@ -46,17 +46,17 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
version: v1.51.0


unit-tests:
name: Test packages
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -68,10 +68,10 @@ jobs:
name: Test integration e2e suite
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -83,10 +83,10 @@ jobs:
name: Test serverless integration e2e suite
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -98,10 +98,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -122,10 +122,10 @@ jobs:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -137,10 +137,10 @@ jobs:
name: Vendor check
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand All @@ -158,10 +158,10 @@ jobs:
name: Check jsonnet & tempo-mixin
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Install jsonnet, jsonnet-bundler & tanka
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependabot_serverless_gomod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.x

- name: Check out code
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [BUGFIX] Error more gracefully while reading some blocks written by an interim commit between 1.5 and 2.0 [#2055](https://github.com/grafana/tempo/pull/2055) (@mdisibio)
* [BUGFIX] Apply `rate()` to bytes/s panel in tenant's dashboard. [#2081](https://github.com/grafana/tempo/pull/2081) (@mapno)
* [BUGFIX] Correctly coalesce trace level data when combining Parquet traces. [#2095](https://github.com/grafana/tempo/pull/2095) (@joe-elliott)
* [CHANGE] Update Go to 1.20 [#2079](https://github.com/grafana/tempo/pull/2079) (@scalalang2)

## v2.0.0 / 2023-01-31

Expand Down
2 changes: 1 addition & 1 deletion cmd/tempo-cli/cmd-list-block.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func dumpBlock(r tempodb_backend.Reader, c tempodb_backend.Compactor, tenantID s
}

// Print stats on ctrl+c
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
// nolint:govet
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tempo-serverless/cloud-run/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/grafana/tempo/cmd/tempo-serverless/cloud-run

go 1.19
go 1.20

require (
github.com/gogo/protobuf v1.3.2
Expand Down
2 changes: 1 addition & 1 deletion cmd/tempo-serverless/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# build the lambda and retrive the lambda-local-proxy
#
FROM golang:1.19-buster AS build
FROM golang:1.20-buster AS build

# copy in the lambda. todo: build in container
COPY lambda /
Expand Down
2 changes: 1 addition & 1 deletion cmd/tempo-serverless/lambda/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/grafana/tempo/cmd/tempo-serverless/lambda

go 1.19
go 1.20

require (
github.com/aws/aws-lambda-go v1.28.0
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/grafana/tempo

go 1.19
go 1.20

require (
cloud.google.com/go/storage v1.27.0
Expand Down
4 changes: 2 additions & 2 deletions integration/e2e/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package e2e

import (
"context"
"math/rand"
crand "crypto/rand"
"testing"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter"
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestReceivers(t *testing.T) {

// make request
traceID := make([]byte, 16)
_, err = rand.Read(traceID)
_, err = crand.Read(traceID)
require.NoError(t, err)
req := test.MakeTrace(20, traceID)

Expand Down
2 changes: 1 addition & 1 deletion modules/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ingester

import (
"context"
"math/rand"
"crypto/rand"
"os"
"testing"
"time"
Expand Down
11 changes: 7 additions & 4 deletions modules/ingester/instance_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ingester
import (
"bytes"
"context"
crand "crypto/rand"
"fmt"
"math/rand"
"sort"
"strconv"
"testing"
Expand Down Expand Up @@ -275,7 +275,8 @@ func writeTracesWithSearchData(t *testing.T, i *instance, tagKey string, tagValu

for j := 0; j < numTraces; j++ {
id := make([]byte, 16)
rand.Read(id)
_, err := crand.Read(id)
require.NoError(t, err)

tv := tagValue
if postFixValue {
Expand Down Expand Up @@ -350,7 +351,8 @@ func TestInstanceSearchDoesNotRace(t *testing.T) {

go concurrent(func() {
id := make([]byte, 16)
rand.Read(id)
_, err := crand.Read(id)
require.NoError(t, err)

trace := test.MakeTrace(10, id)
traceBytes, err := dec.PrepareForWrite(trace, 0, 0)
Expand Down Expand Up @@ -445,7 +447,8 @@ func TestWALBlockDeletedDuringSearch(t *testing.T) {

for j := 0; j < 500; j++ {
id := make([]byte, 16)
rand.Read(id)
_, err := crand.Read(id)
require.NoError(t, err)

trace := test.MakeTrace(10, id)
traceBytes, err := dec.PrepareForWrite(trace, 0, 0)
Expand Down
14 changes: 10 additions & 4 deletions modules/ingester/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ingester

import (
"context"
crand "crypto/rand"
"encoding/binary"
"math/rand"
"testing"
Expand Down Expand Up @@ -127,7 +128,8 @@ func pushTracesToInstance(t *testing.T, i *instance, numTraces int) ([]*tempopb.

for j := 0; j < numTraces; j++ {
id := make([]byte, 16)
rand.Read(id)
_, err := crand.Read(id)
require.NoError(t, err)

testTrace := test.MakeTrace(10, id)
trace.SortTrace(testTrace)
Expand Down Expand Up @@ -307,14 +309,18 @@ func TestInstanceLimits(t *testing.T) {

func TestInstanceCutCompleteTraces(t *testing.T) {
id := make([]byte, 16)
rand.Read(id)
_, err := crand.Read(id)
require.NoError(t, err)

pastTrace := &liveTrace{
traceID: id,
lastAppend: time.Now().Add(-time.Hour),
}

id = make([]byte, 16)
rand.Read(id)
_, err = crand.Read(id)
require.NoError(t, err)

nowTrace := &liveTrace{
traceID: id,
lastAppend: time.Now().Add(time.Hour),
Expand Down Expand Up @@ -543,7 +549,7 @@ func TestSortByteSlices(t *testing.T) {
}
for i := range traceBytes.Traces {
traceBytes.Traces[i] = make([]byte, rand.Intn(10))
_, err := rand.Read(traceBytes.Traces[i])
_, err := crand.Read(traceBytes.Traces[i])
require.NoError(t, err)
}

Expand Down
Loading

0 comments on commit 79f0b27

Please sign in to comment.