Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce minimum go version when runnign cmake if go is not disabled #1580

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmake/go.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ endif()

if(NOT GO_EXECUTABLE AND NOT DISABLE_GO)
message(FATAL_ERROR "Could not find Go")
elseif(NOT DISABLE_GO)
execute_process(
COMMAND ${GO_EXECUTABLE} version
OUTPUT_VARIABLE go_version_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Example: 'go version go1.21.3 darwin/arm64' match any number of '#.' and one '#'
string(REGEX MATCH "([0-9]+\\.)*[0-9]+" go_version ${go_version_output})

# This should track /go.mod and /BUILDING.md
set(minimum_go_version "1.18")
if(go_version VERSION_LESS minimum_go_version)
message(FATAL_ERROR "Go compiler version must be at least ${minimum_go_version}. Found version ${go_version}")
else()
message(STATUS "Go compiler ${go_version} found")
endif()
endif()

function(go_executable dest package)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module boringssl.googlesource.com/boringssl

// When this changes update /cmake/go.cmake minimum_go_version and /BUILDING.md
go 1.18

require (
Expand Down
Loading