diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c3a12b0d..cbaa07f56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ env: ASAN_OPTIONS: leak_check_at_exit=0 LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 - GO_INSTALL_VERSION: ">=1.20.0" permissions: contents: read # to fetch code (actions/checkout) @@ -58,7 +57,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ env.GO_INSTALL_VERSION }} + go-version-file: go.mod - name: Build kitty run: python .github/workflows/ci.py build @@ -88,7 +87,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ env.GO_INSTALL_VERSION }} + go-version-file: go.mod - name: Install build-only deps run: python -m pip install -r docs/requirements.txt ruff mypy types-requests types-docutils @@ -137,7 +136,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ env.GO_INSTALL_VERSION }} + go-version-file: go.mod - name: Build kitty run: which python3 && python3 .github/workflows/ci.py build @@ -162,7 +161,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ env.GO_INSTALL_VERSION }} + go-version-file: go.mod - name: Build kitty run: python3 .github/workflows/ci.py build diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fa9055d9c..0fb2fc373 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,7 +26,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ">=1.20.0" + go-version-file: go.mod - name: Checkout repository uses: actions/checkout@v3 diff --git a/docs/build.rst b/docs/build.rst index b00dbd92a..37f762ad5 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -46,7 +46,7 @@ Run-time dependencies: Build-time dependencies: * ``gcc`` or ``clang`` -* ``go >= 1.20`` (see :file:`go.mod` for go packages used during building) +* ``go`` >= _build_go_version (see :file:`go.mod` for go packages used during building) * ``pkg-config`` * For building on Linux in addition to the above dependencies you might also need to install the following packages, if they are not already installed by diff --git a/docs/conf.py b/docs/conf.py index 07dee1ba1..2755b60fa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -106,8 +106,17 @@ rst_prolog = ''' '''.replace('VERSION', str_version) smartquotes_action = 'qe' # educate quotes and ellipses but not dashes +def go_version(go_mod_path: str) -> str: # {{{ + with open(go_mod_path) as f: + for line in f: + if line.startswith('go '): + return line.strip().split()[1] + raise SystemExit(f'No Go version in {go_mod_path}') +# }}} + string_replacements = { '_kitty_install_cmd': 'curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin', + '_build_go_version': go_version('../go.mod'), }