loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.74k stars 328 forks source link

fix: trim v from semver #1080

Closed anbraten closed 4 months ago

anbraten commented 4 months ago

Fixing 11:48:19 info Invalid character(s) found in major number "v2" error received from semver package as my docker compose version is v2.2.3

89luca89 commented 4 months ago

Hi @anbraten thanks for the PR!

This never has given problems, could it be a problem with newer compose version (that introduced the v?) Maybe we can do a fallback instead, in case of error, then trim the V and try again?

anbraten commented 4 months ago

Hi @89luca89

I think this might have been a bug in the docker-compose plugin. It works for the latest 2.27.0 version for me, but some previous had issues when testing.

However I still think the fix is worth it as strings.TrimPrefix will only remove the v prefix if it exists otherwise it will just pass the string to semver.Parse which therefore will work in both cases.