Skip to content

Commit

Permalink
refact: centralize Go version retrieval in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Mughees2001 authored and alegrey91 committed Feb 11, 2025
1 parent 22ebe1a commit 27b18be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Get Go version from go.mod
id: get_go_version
run: |
go_version=$(grep '^toolchain' go.mod | awk '{print $2}' | sed 's/go//')
go_version=$(make go-version)
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- name: Get Go version from go.mod
- name: Get Go version from Makefile
id: get_go_version
run: |
go_version=$(grep '^toolchain' go.mod | awk '{print $2}' | sed 's/go//')
go_version=$(make go-version)
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- name: Get Go version from go.mod
- name: Get Go version from Make file
id: get_go_version
run: |
go_version=$(grep '^toolchain' go.mod | awk '{print $2}' | sed 's/go//')
go_version=$(make go-version)
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
with:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Get Go version from go.mod
id: get_go_version
run: |
go_version=$(grep '^toolchain' go.mod | awk '{print $2}' | sed 's/go//')
go_version=$(make go-version)
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
- name: Get Go version from go.mod
id: get_go_version
run: |
go_version=$(grep '^toolchain' go.mod | awk '{print $2}' | sed 's/go//')
go_version=$(make go-version)
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,7 @@ install:
clean:
rm -rf ${OUTPUT_DIR}
rm -rf ${BINARY_DIR}
rm -rf ./libbpfgo
rm -rf ./libbpfgo

go-version:
@grep '^toolchain' go.mod | awk '{print $$2}' | sed 's/go//'

0 comments on commit 27b18be

Please sign in to comment.