Skip to content

Commit 02bb44d

Browse files
thomas-tacquetbene2k1nerda-codes
authored
feat(functions):troubleshoot go version (#4909)
* feat(functions):troubleshoot go version * Apply suggestions from code review Co-authored-by: Benedikt Rollik <[email protected]> * Apply suggestions from code review Co-authored-by: Néda <[email protected]> --------- Co-authored-by: Benedikt Rollik <[email protected]> Co-authored-by: Néda <[email protected]>
1 parent 8762c25 commit 02bb44d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
meta:
3+
title: Go function build fails due to Go version
4+
description: Troubleshoot issues with Scaleway Serverless Functions Go build not working due to version error.
5+
content:
6+
h1: Go function build fails due to Go version
7+
paragraph: Troubleshoot issues with Scaleway Serverless Functions Go build not working due to version error.
8+
tags: serverless functions troubleshooting issue error go version build
9+
dates:
10+
validation: 2025-04-30
11+
posted: 2025-04-30
12+
categories:
13+
- serverless
14+
---
15+
16+
## Problem
17+
18+
My Go Serverless Function build failed with an error message mentioning a wrong version.
19+
20+
## Cause
21+
22+
Go function deployment may fail during the build step with a version mismatch error, even if the runtime version appears to be correct.
23+
24+
This is due to the `go.mod` directive that specifies an `X.Y.Z` version where the `Z` patch version does not match the version of the selected runtime.
25+
26+
This happens by default because the `go mod init` command includes the full Go version (including the patch version), which can lead to this mismatch if your runtime only supports a different patch version.
27+
28+
## Possible solution
29+
30+
Remove the `Z` version from the `go.mod` file. In the example below, `X` corresponds to `1`, `Y` to `24`, and `Z` to `1`.
31+
32+
Content of a `go.mod` file with an incorrect `X.Y.Z` (`1.24.1`) version.
33+
34+
```
35+
go 1.24.1
36+
```
37+
38+
The example below shows the content of the `go.mod` file after we have remove the incorrect `Z` version:
39+
40+
```
41+
go 1.24
42+
````

0 commit comments

Comments
 (0)