|
| 1 | +# Maintenance: Upgrading Golang |
| 2 | + |
| 3 | +This document details the files to change and the necessary steps when upgrading Golang. At the time of the writing, we only upgrade on minor version changes to Golang, not patch changes. If that changes, please update this document. |
| 4 | + |
| 5 | +## Step 1 - Change the Runtime Version in webapp's app.staging.yaml and app.yaml files |
| 6 | + |
| 7 | +Ensure that the desired version is available. Go to the [Golang standard runtime docs](https://cloud.google.com/appengine/docs/standard/go/runtime) to see the latest versions available. |
| 8 | + |
| 9 | +Once you have confirmed that the desired version is available: |
| 10 | +- Open [app.yaml](../webapp/web/app.yaml) and [app.staging.yaml](../webapp/web/app.staging.yaml) |
| 11 | +- Change the `runtime` line to match the new version of Golang seen in the App Engine documentation. |
| 12 | + |
| 13 | + |
| 14 | +## Step 2 - Change the version in the Dockerfiles |
| 15 | +- tooling [Dockerfile](../Dockerfile) at the root of the repo |
| 16 | +- searchcache [Dockerfile](../api/query/cache/service/Dockerfile) |
| 17 | + |
| 18 | +The tooling image and the first stage of searchcache use the same Golang image. Check out the Golang [page](https://hub.docker.com/_/golang?tab=tags) on Docker Hub for the latest tags. Currently, we are using the `buster` [release](https://wiki.debian.org/DebianReleases) of Debian. As a result pick the `golang:<latest stable version>-buster` tag. If buster is superseded by a new version, you should change that as well. |
| 19 | + |
| 20 | +## Step 3 - Change the version in go.mod |
| 21 | + |
| 22 | +There is a line with the Golang version in the [go.mod](../go.mod) file. Change it to the latest major and minor version. |
| 23 | + |
| 24 | +## Step 4 - Run go mod tidy |
| 25 | + |
| 26 | +*Expand section for directions* |
| 27 | +<!-- TODO add more instructions for setups like local and docker compose --> |
| 28 | + |
| 29 | +<details> |
| 30 | + <summary>Running "go mod tidy" in webplatformtests/wpt.fyi Docker container</summary> |
| 31 | + |
| 32 | + ### Terminal 1 |
| 33 | + |
| 34 | + You need to run `go mod tidy` **but** `webplatformtests/wpt.fyi:latest` won't have the changes for the latest version of Golang from your changes to the tooling image in step 2. As a result, you will need to build the tooling image locally. |
| 35 | + |
| 36 | + ```sh |
| 37 | + # From the root of the repository |
| 38 | + docker build --tag webplatformtests/wpt.fyi:latest . |
| 39 | + ``` |
| 40 | + |
| 41 | + Follow the steps in the main [README.md](../README.md) to start up the instance. It will use this locally built version of Dockerfile |
| 42 | + |
| 43 | + ### Terminal 2 |
| 44 | + ```sh |
| 45 | + docker exec wptd-dev-instance go mod tidy |
| 46 | + ``` |
| 47 | + This will update your go.mod and go.sum. |
| 48 | + |
| 49 | +</details> |
0 commit comments