Function
versionedModulePath
(modulePath, moduleVersion string)
Source from the content-addressed store, hash-verified
| 606 | } |
| 607 | |
| 608 | func versionedModulePath(modulePath, moduleVersion string) string { |
| 609 | if moduleVersion == "" { |
| 610 | return modulePath |
| 611 | } |
| 612 | ver, err := semver.StrictNewVersion(strings.TrimPrefix(moduleVersion, "v")) |
| 613 | if err != nil { |
| 614 | return modulePath |
| 615 | } |
| 616 | major := ver.Major() |
| 617 | if major > 1 { |
| 618 | modulePath += fmt.Sprintf("/v%d", major) |
| 619 | } |
| 620 | return path.Clean(modulePath) |
| 621 | } |
Tested by
no test coverage detected