pkl icon indicating copy to clipboard operation
pkl copied to clipboard

Support Go semver convention

Open jjuliano opened this issue 1 year ago • 1 comments

When running go mod tidy, the version must be prefixed with a 'v'. However, the file at https://github.com/apple/pkl/blob/0.25.2/stdlib/Project.pkl#L276 expects the version without the 'v'. Since I've placed the generated Go files in a separate repository, the default behavior of go mod tidy will fail to locate the package if the version is not prefixed with the 'v'.

jjuliano avatar Aug 10 '24 05:08 jjuliano

I have resolved it by defining a regexp on the PklProject

version =  read?("env:VERSION").replaceFirst(Regex("^v(\\d+\\.\\d+\\.\\d+)(-[\\w\\.]+)?(\\+[\\w\\.]+)?$"), "$1")

jjuliano avatar Aug 10 '24 10:08 jjuliano

I don't think we will support a leading v, because that leads to ambiguous situations (what do you do if there is both v1.0.0 and 1.0.0?)

Your workaround seems like a good solution!

bioball avatar Sep 06 '24 04:09 bioball