On 5/2/2024 14:58, Austin Ziegler wrote:
I think I have found a bug in the golang portgroup, and I think I have
an idea on how to fix it, but I'm not sure how to test such a modification.
You'd make the change in your local copy of the ports tree and check
that a port affected by the bug now works correctly, and that some
existing ports still work correctly.
For those interested, it's in go._translate_package_id. If I have a
package ID github.com/jmespath/go-jmespath/internal/testify
<http://github.com/jmespath/go-jmespath/internal/testify>, the
*subproject* is internal/testify, not internal. But the line `set
subproject [lindex ${parts} 3]` will *only* grab `internal`.
So this:
```tcl
set parts [split ${package_id} /]
set domain [lindex ${parts} 0]
set author [lindex ${parts} 1]
set project [lindex ${parts} 2]
# possibly empty
set subproject [lindex ${parts} 3]
```
Should probably be this:
```tcl
set parts [split $package_id /]
set domain [lindex $parts 0]
set author [lindex $parts 1]
set project [lindex $parts 2]
# Join the remaining parts to get the full subproject path
if {[llength $parts] > 3} {
set subproject [join [lrange $parts 3 end] /]
} else {
set subproject ""
}
```
This could be simplified further to something like:
set parts [split $package_id /]
set remaining_parts [lassign $parts domain author project]
set subproject [join $remaining_parts /]
- Josh