Skip to content

Commit c1680fb

Browse files
upgrade to go 1.21
1 parent a9665c9 commit c1680fb

File tree

4 files changed

+76
-20
lines changed

4 files changed

+76
-20
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
working_directory: ~/go/src/github.com/Clever/kinesis-alerts-consumer
55
docker:
6-
- image: cimg/go:1.16
6+
- image: cimg/go:1.21
77
environment:
88
GOPRIVATE: github.com/Clever/*
99
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts

go.mod

+38-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
11
module github.com/Clever/kinesis-alerts-consumer
22

3-
go 1.16
3+
go 1.21
44

55
require (
66
github.com/Clever/amazon-kinesis-client-go v1.0.0
77
github.com/Clever/kayvee-go/v7 v7.4.1
8-
github.com/Clever/syslogparser v0.0.0-20170816194131-fb28ad3e4340 // indirect
98
github.com/DataDog/datadog-api-client-go v1.14.0
10-
github.com/a8m/kinesis-producer v0.2.0 // indirect
119
github.com/aws/aws-sdk-go v1.38.68
12-
github.com/davecgh/go-spew v1.1.1 // indirect
1310
github.com/eapache/go-resiliency v1.2.0
14-
github.com/jeromer/syslogparser v0.0.0-20160906132035-0e4ae46ea3f0 // indirect
15-
github.com/jpillora/backoff v1.0.0 // indirect
1611
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
17-
github.com/kr/text v0.2.0 // indirect
1812
github.com/stretchr/testify v1.7.0
1913
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
14+
)
15+
16+
require (
17+
github.com/Clever/syslogparser v0.0.0-20170816194131-fb28ad3e4340 // indirect
18+
github.com/a8m/kinesis-producer v0.2.0 // indirect
19+
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
20+
github.com/davecgh/go-spew v1.1.1 // indirect
21+
github.com/go-logr/logr v1.2.1 // indirect
22+
github.com/go-logr/stdr v1.2.0 // indirect
23+
github.com/golang/protobuf v1.5.2 // indirect
24+
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
25+
github.com/jeromer/syslogparser v0.0.0-20160906132035-0e4ae46ea3f0 // indirect
26+
github.com/jmespath/go-jmespath v0.4.0 // indirect
27+
github.com/jpillora/backoff v1.0.0 // indirect
28+
github.com/kr/text v0.2.0 // indirect
29+
github.com/pmezard/go-difflib v1.0.0 // indirect
30+
github.com/xeipuuv/gojsonpointer v0.0.0-20170225233418-6fe8760cad35 // indirect
31+
github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c // indirect
32+
github.com/xeipuuv/gojsonschema v0.0.0-20171025060643-212d8a0df7ac // indirect
33+
go.opentelemetry.io/otel v1.3.0 // indirect
34+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 // indirect
35+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.26.0 // indirect
36+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.26.0 // indirect
37+
go.opentelemetry.io/otel/internal/metric v0.26.0 // indirect
38+
go.opentelemetry.io/otel/metric v0.26.0 // indirect
39+
go.opentelemetry.io/otel/sdk v1.3.0 // indirect
40+
go.opentelemetry.io/otel/sdk/export/metric v0.26.0 // indirect
41+
go.opentelemetry.io/otel/sdk/metric v0.26.0 // indirect
42+
go.opentelemetry.io/otel/trace v1.3.0 // indirect
43+
go.opentelemetry.io/proto/otlp v0.11.0 // indirect
44+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
45+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
46+
golang.org/x/text v0.3.6 // indirect
2047
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
48+
google.golang.org/appengine v1.4.0 // indirect
49+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
50+
google.golang.org/grpc v1.42.0 // indirect
51+
google.golang.org/protobuf v1.27.1 // indirect
2152
gopkg.in/Clever/kayvee-go.v6 v6.27.0 // indirect
2253
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2354
gopkg.in/yaml.v2 v2.4.0 // indirect

go.sum

-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
167167
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
168168
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
169169
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
170-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
171170
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
172171
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
173172
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

golang.mk

+37-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This is the default Clever Golang Makefile.
22
# It is stored in the dev-handbook repo, github.com/Clever/dev-handbook
33
# Please do not alter this file directly.
4-
GOLANG_MK_VERSION := 1.0.1
4+
GOLANG_MK_VERSION := 1.2.1
55

66
SHELL := /bin/bash
77
SYSTEM := $(shell uname -a | cut -d" " -f1 | tr '[:upper:]' '[:lower:]')
@@ -47,6 +47,8 @@ golang-ensure-curl-installed:
4747
# Golint is a tool for linting Golang code for common errors.
4848
# We pin its version because an update could add a new lint check which would make
4949
# previously passing tests start failing without changing our code.
50+
# this package is deprecated and frozen
51+
# Infra recomendation is to eventaully move to https://github.com/golangci/golangci-lint so don't fail on linting error for now
5052
GOLINT := $(GOPATH)/bin/golint
5153
$(GOLINT):
5254
go install -mod=readonly golang.org/x/lint/golint@738671d3881b9731cc63024d5d88cf28db875626
@@ -74,14 +76,6 @@ endef
7476
# golang-lint-deps-strict requires the golint tool for golang linting.
7577
golang-lint-deps-strict: $(GOLINT) $(FGT)
7678

77-
# golang-lint-strict calls golint on all golang files in the pkg and fails if any lint
78-
# errors are found.
79-
# arg1: pkg path
80-
define golang-lint-strict
81-
@echo "LINTING $(1)..."
82-
@PKG_PATH=$$(go list -f '{{.Dir}}' $(1)); find $${PKG_PATH}/*.go -type f | grep -v gen_ | xargs $(FGT) $(GOLINT)
83-
endef
84-
8579
# golang-test-deps is here for consistency
8680
golang-test-deps:
8781

@@ -102,6 +96,21 @@ define golang-test-strict
10296
@go test -v -race $(1)
10397
endef
10498

99+
# golang-test-strict-cover-deps is here for consistency
100+
golang-test-strict-cover-deps:
101+
102+
# golang-test-strict-cover uses the Go toolchain to run all tests in the pkg with the race and cover flag.
103+
# appends coverage results to coverage.txt
104+
# arg1: pkg path
105+
define golang-test-strict-cover
106+
@echo "TESTING $(1)..."
107+
@go test -v -race -cover -coverprofile=profile.tmp -covermode=atomic $(1)
108+
@if [ -f profile.tmp ]; then \
109+
cat profile.tmp | tail -n +2 >> coverage.txt; \
110+
rm profile.tmp; \
111+
fi;
112+
endef
113+
105114
# golang-vet-deps is here for consistency
106115
golang-vet-deps:
107116

@@ -132,16 +141,29 @@ golang-test-all-strict-deps: golang-fmt-deps golang-lint-deps-strict golang-test
132141
# arg1: pkg path
133142
define golang-test-all-strict
134143
$(call golang-fmt,$(1))
135-
$(call golang-lint-strict,$(1))
144+
$(call golang-lint,$(1))
136145
$(call golang-vet,$(1))
137146
$(call golang-test-strict,$(1))
138147
endef
139148

149+
# golang-test-all-strict-cover-deps: installs all dependencies needed for different test cases.
150+
golang-test-all-strict-cover-deps: golang-fmt-deps golang-lint-deps-strict golang-test-strict-cover-deps golang-vet-deps
151+
152+
# golang-test-all-strict-cover calls fmt, lint, vet and test on the specified pkg with strict and cover
153+
# requirements that no errors are thrown while linting.
154+
# arg1: pkg path
155+
define golang-test-all-strict-cover
156+
$(call golang-fmt,$(1))
157+
$(call golang-lint,$(1))
158+
$(call golang-vet,$(1))
159+
$(call golang-test-strict-cover,$(1))
160+
endef
161+
140162
# golang-build: builds a golang binary. ensures CGO build is done during CI. This is needed to make a binary that works with a Docker alpine image.
141163
# arg1: pkg path
142164
# arg2: executable name
143165
define golang-build
144-
@echo "BUILDING..."
166+
@echo "BUILDING $(2)..."
145167
@if [ -z "$$CI" ]; then \
146168
go build -o bin/$(2) $(1); \
147169
else \
@@ -150,6 +172,10 @@ else \
150172
fi;
151173
endef
152174

175+
# golang-setup-coverage: set up the coverage file
176+
golang-setup-coverage:
177+
@echo "mode: atomic" > coverage.txt
178+
153179
# golang-update-makefile downloads latest version of golang.mk
154180
golang-update-makefile:
155181
@wget https://raw.githubusercontent.com/Clever/dev-handbook/master/make/golang-v1.mk -O /tmp/golang.mk 2>/dev/null

0 commit comments

Comments
 (0)