Skip to content

Commit

Permalink
update synver logic
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <[email protected]>
  • Loading branch information
MUzairS15 committed Jul 15, 2024
1 parent f3af398 commit fd9565f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/syncmodutil/internal/modsync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ func getRequiredVersionsFromString(s string) (p []Package) {
data = strings.TrimSuffix(strings.TrimPrefix(data, "\n"), "\n")
packages := strings.Split(data, "\n")
for _, pkg := range packages {
pkg = strings.TrimSuffix(strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(pkg, "\t"), " "), " "), "\t")
pkg = strings.TrimSpace(pkg)
if pkg == "" {
continue
}

pkgName, pkgVersion := getPackageAndVersionFromPackageVersion(pkg)
if strings.HasPrefix(pkgName, "//") { //Has been commented out
continue
Expand All @@ -132,7 +136,10 @@ func getReplacedVersionsFromString(s string) (p [][]Package) {
data = strings.TrimSuffix(strings.TrimPrefix(data, "\n"), "\n")
packages := strings.Split(data, "\n")
for _, pkg := range packages {
pkg = strings.TrimSuffix(strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(pkg, "\t"), " "), " "), "\t")
pkg = strings.TrimSpace(pkg)
if pkg == "" {
continue
}
p0 := getPackagesAndVersionsFromPackageVersions(pkg)
if len(p0) != 0 {
p = append(p, p0)
Expand Down

0 comments on commit fd9565f

Please sign in to comment.