Skip to content

Commit 82aa982

Browse files
committed
updated upgrade go instructions
1 parent d47b048 commit 82aa982

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,50 @@ git add .
1818
git commit -m "Update libkflow to $LATEST_VERSION"
1919
```
2020
- Push the changes to github, and the builder will take care of the rest.
21-
- One can find the built libraries in the output of the github action.
21+
- One can find the built libraries in the output of the github action.
22+
23+
24+
## Upgrading the Go version
25+
26+
Upgrading the Go version in use can be done through the following steps:
27+
28+
### Update the base go version
29+
- Identify the commit hash of the desired Go version from the [Go repository](https://github.com/golang/go/tags)
30+
- Checkout that commit locally:
31+
- `cd $REPO_ROOT/go && git checkout $COMMIT_HASH`
32+
- Update the go version specified in the golang job in [github workflow](./.github/workflows/build.yml)
33+
- (Optional) Checkpoint commit:
34+
- `git add . && git commit -m "Update Go to $COMMIT_HASH"`
35+
- See if the patch still applies cleanly:
36+
- `patch -d go -p1 < go-runtime.patch`
37+
- if yes, you're good to go. Push the changes and the builder will take care of the rest.
38+
- if no, see updating the patch below.
39+
40+
#### Updating the go-runtime patch
41+
42+
From what I can tell, the patch mitigates an issue with CGO and static linking where argv (as seen by the go runtime)
43+
is a nil pointer but argc is non-zero. This causes a panic in the go runtime. Fortunately, we don't care about
44+
arguments as we are building a static library that is configured through other means.
45+
46+
The patch updates the runtime to effectively skip further configuration when argv is nil. This is done by updating
47+
two files in the go runtime: `$GO_ROOT/src/runtime/os_linux.go ` and `$GO_ROOT/src/runtime/runtime1.go`. The goal of
48+
the patch is to ensure that the created `auxvp` pointer is only accessed if argv and argc are set correctly.
49+
50+
The current approach can be seen in [the patch file](./go-runtime.patch).
51+
52+
To create a new patch, checkout the desired version of go following the instructions above and then modify the two
53+
files in place to include the desired checks.
54+
55+
A new diff can be created by running the following command from the root of the go submodule:
56+
```shell
57+
git diff > $REPO_ROOT/go-runtime.patch
58+
```
59+
60+
Ensure that the patch applies cleanly by running:
61+
```shell
62+
patch -d go -p1 < go-runtime.patch
63+
```
64+
65+
and commit.
66+
67+

0 commit comments

Comments
 (0)