Support Go semver convention #197

Closed
opened 2025-12-30 01:22:02 +01:00 by adam · 2 comments
Owner

Originally created by @jjuliano on GitHub (Aug 10, 2024).

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'.

Originally created by @jjuliano on GitHub (Aug 10, 2024). 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'.
adam closed this issue 2025-12-30 01:22:02 +01:00
Author
Owner

@jjuliano commented on GitHub (Aug 10, 2024):

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 commented on GitHub (Aug 10, 2024): I have resolved it by defining a regexp on the PklProject ``` version = read?("env:VERSION").replaceFirst(Regex("^v(\\d+\\.\\d+\\.\\d+)(-[\\w\\.]+)?(\\+[\\w\\.]+)?$"), "$1") ```
Author
Owner

@bioball commented on GitHub (Sep 6, 2024):

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 commented on GitHub (Sep 6, 2024): 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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#197