Skip to content

Commit 3f7de9e

Browse files
authored
chore: Migrate to go 1.21 (#89)
1 parent de11972 commit 3f7de9e

File tree

17 files changed

+91
-103
lines changed

17 files changed

+91
-103
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ updates:
1414
prefix: "chore"
1515
include: "scope"
1616

17-
- package-ecosystem: "gomod"
18-
directory: "/tools/"
17+
- package-ecosystem: "github-actions"
18+
directory: "/"
1919
schedule:
20-
interval: "daily"
20+
interval: "weekly"
2121
labels:
2222
- "dependencies"
2323
assignees:
@@ -27,11 +27,11 @@ updates:
2727
commit-message:
2828
prefix: "chore"
2929
include: "scope"
30-
31-
- package-ecosystem: "github-actions"
32-
directory: "/"
30+
31+
- package-ecosystem: "docker"
32+
directory: "/build/docker/go-tools"
3333
schedule:
34-
interval: "weekly"
34+
interval: "daily"
3535
labels:
3636
- "dependencies"
3737
assignees:

.github/workflows/codeql-analysis.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ${{ matrix.os }}
2727
permissions:
2828
actions: read
2929
contents: read
@@ -33,13 +33,23 @@ jobs:
3333
fail-fast: true
3434
matrix:
3535
language: [ 'go' ]
36+
os: [ 'ubuntu-22.04' ]
37+
go: [ '1.21' ]
3638
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3739
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3840

3941
steps:
4042
- name: Checkout repository
4143
uses: actions/checkout@v3
4244

45+
- name: Set up go
46+
uses: actions/setup-go@v4.1.0
47+
with:
48+
go-version: ${{ matrix.go }}
49+
- run: |
50+
go version
51+
shell: bash
52+
4353
# Initializes the CodeQL tools for scanning.
4454
- name: Initialize CodeQL
4555
uses: github/codeql-action/init@v2

.github/workflows/go.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
max-parallel: 3
4343
matrix:
4444
os: [ 'ubuntu-22.04' ]
45-
go: [ '1.20' ]
45+
go: [ '1.21' ]
4646
runs-on: ${{ matrix.os }}
4747
name: Build
4848
steps:
@@ -89,7 +89,7 @@ jobs:
8989
max-parallel: 2
9090
matrix:
9191
os: [ 'ubuntu-22.04' ]
92-
go: [ '1.20' ]
92+
go: [ '1.21' ]
9393
runs-on: ${{ matrix.os }}
9494
name: Run Tests
9595
steps:
@@ -136,7 +136,7 @@ jobs:
136136
max-parallel: 2
137137
matrix:
138138
os: [ 'ubuntu-22.04' ]
139-
go: [ '1.20' ]
139+
go: [ '1.21' ]
140140
runs-on: ${{ matrix.os }}
141141
name: Run linters
142142
steps:
@@ -188,7 +188,7 @@ jobs:
188188
max-parallel: 1
189189
matrix:
190190
os: [ 'ubuntu-22.04' ]
191-
go: [ '1.20' ]
191+
go: [ '1.21' ]
192192
runs-on: ${{ matrix.os }}
193193
name: Quality reports
194194
steps:

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
max-parallel: 2
1414
matrix:
1515
os: [ 'ubuntu-22.04' ]
16-
go: [ '1.20' ]
16+
go: [ '1.21' ]
1717
runs-on: ${{ matrix.os }}
1818
name: Regression tests
1919
steps:
@@ -62,7 +62,7 @@ jobs:
6262
max-parallel: 1
6363
matrix:
6464
os: [ 'ubuntu-22.04' ]
65-
go: [ '1.20' ]
65+
go: [ '1.21' ]
6666
runs-on: ${{ matrix.os }}
6767
name: Lint
6868
steps:
@@ -115,7 +115,7 @@ jobs:
115115
max-parallel: 1
116116
matrix:
117117
os: [ 'ubuntu-22.04' ]
118-
go: [ '1.20' ]
118+
go: [ '1.21' ]
119119
runs-on: ${{ matrix.os }}
120120
name: Release
121121
steps:

Makefile

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ VERSION ?= $(shell git describe --tags $(git rev-list --tags --max-count=1))
66
APP_NAME?=logger
77
SHELL := env APP_NAME=$(APP_NAME) $(SHELL)
88

9-
GOTOOLS_IMAGE_TAG?=v0.12.1
10-
SHELL := env GOTOOLS_IMAGE_TAG=$(GOTOOLS_IMAGE_TAG) $(SHELL)
11-
129
COMPOSE_TOOLS_FILE=deployments/docker-compose/go-tools-docker-compose.yml
1310
COMPOSE_TOOLS_CMD_BASE=docker compose -f $(COMPOSE_TOOLS_FILE)
14-
COMPOSE_TOOLS_CMD_UP=$(COMPOSE_TOOLS_CMD_BASE) up --exit-code-from
15-
COMPOSE_TOOLS_CMD_PULL=$(COMPOSE_TOOLS_CMD_BASE) pull
11+
COMPOSE_TOOLS_CMD_UP=$(COMPOSE_TOOLS_CMD_BASE) up --remove-orphans --exit-code-from
12+
COMPOSE_TOOLS_CMD_PULL=$(COMPOSE_TOOLS_CMD_BASE) build
1613

1714
TARGET_MAX_CHAR_NUM=20
1815

@@ -86,13 +83,12 @@ format-project: fmt imports
8683

8784
## Installs vendored tools.
8885
install-tools:
89-
echo "Installing ${GOTOOLS_IMAGE_TAG}"
9086
$(COMPOSE_TOOLS_CMD_PULL)
9187
.PHONY: install-tools
9288

9389
## vet project
9490
vet:
95-
./scripts/linting/run-vet.sh
91+
$(COMPOSE_TOOLS_CMD_UP) vet vet
9692
.PHONY: vet
9793

9894
## Run full linting
@@ -121,23 +117,22 @@ generate: codegen format-project vet
121117

122118
## Release
123119
release:
124-
./scripts/release/release.sh
120+
$(COMPOSE_TOOLS_CMD_UP) release release
125121
.PHONY: release
126122

127123
## Release local snapshot
128124
release-local-snapshot:
129-
./scripts/release/local-snapshot-release.sh
125+
$(COMPOSE_TOOLS_CMD_UP) release-local-snapshot release-local-snapshot
130126
.PHONY: release-local-snapshot
131127

132128
## Check goreleaser config.
133129
check-releaser:
134-
./scripts/release/check.sh
130+
$(COMPOSE_TOOLS_CMD_UP) release-check-config release-check-config
135131
.PHONY: check-releaser
136132

137133
## Issue new release.
138-
new-version: vet test-regression
134+
new-version: vet test-regression build
139135
./scripts/release/new-version.sh
140136
.PHONY: new-release
141137

142138
.DEFAULT_GOAL := help
143-

build/docker/go-tools/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/obalunenko/go-tools:v1.0.0 AS builder
2+
3+
CMD ["/bin/sh", "-c", ""]

deployments/docker-compose/go-tools-docker-compose.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,38 @@ version: '3'
22

33
services:
44
tools:
5-
image: ghcr.io/obalunenko/go-tools:${GOTOOLS_IMAGE_TAG:-latest}
5+
build:
6+
context: .
7+
dockerfile: ../../build/docker/go-tools/Dockerfile
68
working_dir: /app/
79
volumes:
810
- ../../:/app/
911
command: /bin/sh -c ''
1012

13+
vet:
14+
extends:
15+
service: tools
16+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/linting/run-vet.sh'
17+
1118
fix-imports:
1219
extends:
1320
service: tools
14-
entrypoint: /bin/sh -c './scripts/style/fix-imports.sh'
21+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/style/fix-imports.sh'
1522

1623
fix-fmt:
1724
extends:
1825
service: tools
19-
entrypoint: /bin/sh -c './scripts/style/fmt.sh'
26+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/style/fmt.sh'
2027

2128
run-tests:
2229
extends:
2330
service: tools
24-
entrypoint: /bin/sh -c './scripts/tests/run.sh'
31+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/tests/run.sh'
2532

2633
run-tests-coverage:
2734
extends:
2835
service: tools
29-
entrypoint: /bin/sh -c './scripts/tests/coverage.sh'
36+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/tests/coverage.sh'
3037

3138
prepare-cover-report:
3239
extends:
@@ -36,12 +43,12 @@ services:
3643
update-readme-coverage:
3744
extends:
3845
service: tools
39-
entrypoint: /bin/sh -c './scripts/update-readme-coverage.sh'
46+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/update-readme-coverage.sh'
4047

4148
lint-full:
4249
extends:
4350
service: tools
44-
entrypoint: /bin/sh -c './scripts/linting/run-linters.sh'
51+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/linting/run-linters.sh'
4552

4653
lint-pipeline:
4754
extends:
@@ -56,4 +63,30 @@ services:
5663
go-generate:
5764
extends:
5865
service: tools
59-
entrypoint: /bin/sh -c './scripts/codegen/go-generate.sh'
66+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/codegen/go-generate.sh'
67+
68+
release-local-snapshot:
69+
extends:
70+
service: tools
71+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/release/local-snapshot-release.sh'
72+
environment:
73+
APP_NAME: ${APP_NAME}
74+
GOOS: ${GOOS}
75+
GOARCH: ${GOARCH}
76+
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
77+
78+
release-check-config:
79+
extends:
80+
service: tools
81+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/release/check.sh'
82+
environment:
83+
APP_NAME: ${APP_NAME}
84+
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
85+
86+
release:
87+
extends:
88+
service: tools
89+
entrypoint: /bin/sh -c 'git config --global --add safe.directory /app && ./scripts/release/release.sh'
90+
environment:
91+
APP_NAME: ${APP_NAME}
92+
GITHUB_TOKEN: ${GITHUB_TOKEN:-}

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/obalunenko/logger
22

3-
go 1.20
3+
go 1.21
4+
5+
toolchain go1.21.0
46

57
require (
68
github.com/evalphobia/logrus_sentry v0.8.2

logger.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
"github.com/sirupsen/logrus" //nolint:depguard // this is the only place where logrus should be imported.
1010
)
1111

12-
var (
13-
logInstance *logrus.Logger
14-
)
12+
var logInstance *logrus.Logger
1513

1614
func init() {
1715
logInstance = logrus.New()

scripts/install/vendored-tools.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)