Skip to content

packages: use ParseFromRepoName when syncing repos

Warren Gifford requested to merge mrn/pkg-parse-from-repo-name into main

Created by: mrnugget

Without this change we run into error messages when using RepoLookup on repo-updater:

{"SeverityText":"ERROR","Timestamp":1657705205626718687,"InstrumentationScope":"service.ObservedSource","Caller":"repos/observability.go:133","Function":"github.com/sourcegraph/sourcegraph/internal/repos.(*observedSource).GetRepo.func1","Body":"source.get-repo","Resource":{"service.name":"repo-updater","service.version":"160198_2022-07-13_453c015a507e","service.instance.id":"c74ecd010292"},"Attributes":{"error":"malformed module path \"go/github.com/pborman/getopt\": missing dot in first path element"}}
{"SeverityText":"ERROR","Timestamp":1657705205626933209,"InstrumentationScope":"service","Caller":"repoupdater/server.go:126","Function":"github.com/sourcegraph/sourcegraph/cmd/repo-updater/repoupdater.(*Server).handleRepoLookup","Body":"repoLookup failed","Resource":{"service.name":"repo-updater","service.version":"160198_2022-07-13_453c015a507e","service.instance.id":"c74ecd010292"},"Attributes":{"repo":{"name":"go/github.com/pborman/getopt","update":true},"error":"malformed module path \"go/github.com/pborman/getopt\": missing dot in first path element"}}
"SeverityText":"ERROR","Timestamp":1657705213547695760,"InstrumentationScope":"service.ObservedSource","Caller":"repos/observability.go:133","Function":"github.com/sourcegraph/sourcegraph/internal/repos.(*observedSource).GetRepo.func1","Body":"source.get-repo","Resource":{"service.name":"repo-updater","service.version":"160198_2022-07-13_453c015a507e","service.instance.id":"c74ecd010292"},"Attributes":{"error":"expected dependency in (@scope/)?name@version format but found npm/urql/core@0"}}
{"SeverityText":"ERROR","Timestamp":1657705213547862935,"InstrumentationScope":"service","Caller":"repoupdater/server.go:126","Function":"github.com/sourcegraph/sourcegraph/cmd/repo-updater/repoupdater.(*Server).handleRepoLookup","Body":"repoLookup failed","Resource":{"service.name":"repo-updater","service.version":"160198_2022-07-13_453c015a507e","service.instance.id":"c74ecd010292"},"Attributes":{"repo":{"name":"npm/urql/core","update":true},"error":"expected dependency in (@scope/)?name@version format but found npm/urql/core@0"}}

This changes the code to use the ...FromRepoName method to parse the package name.

Test plan

  • Manual testing
  • Added unit test
  • Existing tests

Merge request reports

Loading