amake / go2port

A tool for generating MacPorts portfiles for Go projects
BSD 3-Clause "New" or "Revised" License
6 stars 7 forks source link

Correctly specify the version prefix for `go.setup` #4

Open herbygillot opened 3 years ago

herbygillot commented 3 years ago

The golang portgroup has an explicit field for the version prefix in go.setup. The prefix is used by underlying portgroups, such as the github and bitbucket portgroups.

Until now, for example, go2port has been generating new Portfiles with the following:

...
go.setup            github.com/elves/elvish v0.14.1
...

After this change, go.setup will be correctly generated as:

...
go.setup            github.com/elves/elvish 0.14.1 v
...

Additionally go2port currently has zero tests, so this adds a simple test for the proposed change, and additional tests for current & future functionality can be added over time.

amake commented 3 years ago

Thanks for looking at this. This has been a small annoyance, but since there's lots of other things to tweak when generating a new portfile I didn't feel it a priority to deal with it.

However I'm not sure about this approach. You probably know that the github and bitbucket portgroups' *.setup functions take both a tag_prefix and a tag_suffix, and this doesn't handle the suffix.

Further, both the prefix and suffix can be arbitrary strings, so parsing them out of a unified string is a bit of a hack. The only way to truly accommodate them is to accept them as additional args on the command line. (Though I recognize that the hack probably handles the vast majority of cases, so it's not out of the question.)

Or is there a spec or requirement specific to golang versioning such that this approach can handle all cases?