Skip to content

Commit

Permalink
package_managers: gomod: Bump the max supported version of Go to 1.22
Browse files Browse the repository at this point in the history
This commit introduces just preliminary support of 1.22, i.e. without
vendored workspaces support. That work is planned in the future but
requires more changes and considerations with regards to the vendored
workspaces.

Signed-off-by: Erik Skultety <[email protected]>
  • Loading branch information
eskultety committed Aug 8, 2024
1 parent 8913237 commit 3a55e98
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cachi2/core/package_managers/gomod.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
from typing_extensions import Self

from cachi2.core.config import get_config
from cachi2.core.errors import FetchError, PackageManagerError, PackageRejected, UnexpectedFormat
from cachi2.core.errors import (
FetchError,
PackageManagerError,
PackageRejected,
UnexpectedFormat,
UnsupportedFeature,
)
from cachi2.core.models.input import Request
from cachi2.core.models.output import EnvironmentVariable, RequestOutput
from cachi2.core.models.property_semantics import PropertySet
Expand Down Expand Up @@ -761,7 +767,7 @@ def _setup_go_toolchain(go_mod_file: RootedPath) -> Go:
GO_121 = version.Version("1.21")
go = Go()
target_version = None
go_max_version = version.Version("1.21")
go_max_version = version.Version("1.22")
go_base_version = go.version
go_mod_version_msg = "go.mod reported versions: '%s'[go], '%s'[toolchain]"

Expand Down Expand Up @@ -876,6 +882,12 @@ def _resolve_gomod(
flags, app_dir, config.gomod_strict_vendor
)
if should_vendor:
if go_work_path and go_work_path.join_within_root("vendor").path.is_dir():
# NOTE: the same error will be reported even for 1.21 which doesn't support workspace
# vendoring, but given it's an invalid configuration and that we plan full 1.22 support
# in the foreseeable future, a not so user friendly error should be fine
raise UnsupportedFeature("Go workspace vendoring is not supported")

downloaded_modules = _vendor_deps(go, app_dir, can_make_changes, run_params)
else:
log.info("Downloading the gomod dependencies")
Expand Down

0 comments on commit 3a55e98

Please sign in to comment.