Skip to content

Commit

Permalink
Added support for go1.23, bumped the minimum version to 1.22 (#10869)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Aug 13, 2024
1 parent ce608ba commit 76acd37
Show file tree
Hide file tree
Showing 81 changed files with 130 additions and 104 deletions.
27 changes: 27 additions & 0 deletions .chloggen/codeboten_go-1.23.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Added support for go1.23, bumped the minimum version to 1.22

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [10869]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
3 changes: 1 addition & 2 deletions .github/workflows/api-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
steps:

- name: Checkout-Main
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
Expand All @@ -35,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6

# Generate apidiff states of Main
- name: Generate-States
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "~1.22.4"
go-version: "~1.22.6"
cache: false
- name: Cache Go
id: go-cache
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: build-and-test-windows
on:
push:
branches: [ main ]
branches: [main]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:

concurrency:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -94,7 +94,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
strategy:
matrix:
runner: [ubuntu-latest]
go-version: ["~1.22", "~1.21.13"] # 1.20 needs quotes otherwise it's interpreted as 1.2
go-version: ["~1.23", "~1.22"] # 1.20 needs quotes otherwise it's interpreted as 1.2
runs-on: ${{ matrix.runner }}
needs: [setup-environment]
steps:
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/builder-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Builder - Integration tests
on:
# on changes to the main branch touching the builder
push:
branches: [ main ]
branches: [main]

# on PRs touching the builder
pull_request:
branches: [ main ]
branches: [main]

# once a day at 6:17 AM UTC
schedule:
- cron: '17 6 * * *'
- cron: "17 6 * * *"

# manual execution
workflow_dispatch:
Expand All @@ -33,6 +33,6 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
- name: Test
run: make builder-integration-test
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
- name: Cache Go
id: go-cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "CodeQL Analysis"
on:
push:
branches: [ main ]
branches: [main]
pull_request:

concurrency:
Expand All @@ -14,9 +14,9 @@ permissions:
jobs:
CodeQL-Build:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/autobuild to send a status report
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/autobuild to send a status report
runs-on: ubuntu-latest

steps:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: contrib-tests
on:
push:
branches: [ main ]
branches: [main]
tags:
- v[0-9]+.[0-9]+.[0-9]+.*
pull_request:
types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled]
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
Expand Down Expand Up @@ -43,18 +43,18 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Run Contrib Tests
run: |
contrib_path=/tmp/opentelemetry-collector-contrib
git clone --depth=1 https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path
make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib
make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib
contrib_tests:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }}
needs: [ contrib-tests-matrix ]
needs: [contrib-tests-matrix]
steps:
- name: Print result
run: echo ${{ needs.contrib-tests-matrix.result }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6

- name: Run benchmark
run: make gobenchmark
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
# Releasing opentelemetry-collector
prepare-release:
needs:
needs:
- validate-versions
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
# Prepare Core for release.
# - Update CHANGELOG.md file, this is done via chloggen
# - Run make prepare-release PREVIOUS_VERSION=1.0.0 RELEASE_CANDIDATE=1.1.0 MODSET=stable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tidy-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.13
go-version: ~1.22.6
cache: false
- name: Cache Go
id: go-cache
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ section of the general project contributing guide.
Working with the project sources requires the following tools:

1. [git](https://git-scm.com/)
2. [go](https://golang.org/) (version 1.21 and up)
2. [go](https://golang.org/) (version 1.22 and up)
3. [make](https://www.gnu.org/software/make/)
4. [docker](https://www.docker.com/)

Expand Down Expand Up @@ -218,7 +218,7 @@ before merging (but see the above paragraph about writing good commit messages i

## General Notes

This project uses Go 1.21.* and [Github Actions.](https://github.com/features/actions)
This project uses Go 1.22.* and [Github Actions.](https://github.com/features/actions)

It is recommended to run `make gofmt all` before submitting your PR.

Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fmt: $(GOIMPORTS)
.PHONY: tidy
tidy:
rm -fr go.sum
$(GOCMD) mod tidy -compat=1.21.0
$(GOCMD) mod tidy -compat=1.22.0

.PHONY: lint
lint: $(LINT)
Expand Down
2 changes: 1 addition & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/collector/client

go 1.21.0
go 1.22.0

require (
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module go.opentelemetry.io/collector/cmd/builder

go 1.21.0
go 1.22.0

require (
github.com/hashicorp/go-version v1.7.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func GetModules(cfg Config) error {
return nil
}

if _, err := runGoCommand(cfg, "mod", "tidy", "-compat=1.21"); err != nil {
if _, err := runGoCommand(cfg, "mod", "tidy", "-compat=1.22"); err != nil {
return fmt.Errorf("failed to update go.mod: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/templates/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module {{.Distribution.Module}}

go 1.21
go 1.22

require (
{{if .Distribution.SupportsConfmapFactories -}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/collector/cmd/mdatagen

go 1.21.0
go 1.22.0

require (
github.com/google/go-cmp v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module go.opentelemetry.io/collector/cmd/otelcorecol

go 1.21.0
go 1.22.0

toolchain go1.21.13
toolchain go1.22.6

require (
go.opentelemetry.io/collector/component v0.107.0
Expand Down
2 changes: 1 addition & 1 deletion component/componentprofiles/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/collector/component/componentprofiles

go 1.21.0
go 1.22.0

require go.opentelemetry.io/collector/component v0.107.0

Expand Down
2 changes: 1 addition & 1 deletion component/componentstatus/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/collector/component/componentstatus

go 1.21.0
go 1.22.0

require (
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion component/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/collector/component

go 1.21.0
go 1.22.0

require (
github.com/prometheus/client_golang v1.19.1
Expand Down
Loading

0 comments on commit 76acd37

Please sign in to comment.