librariesio / libraries.io

:books: The Open Source Discovery Service
https://libraries.io
GNU Affero General Public License v3.0
1.1k stars 206 forks source link

GoMod#canonical_module_name: handle go module names from go.mod that have double-quotes #3366

Closed tiegz closed 2 months ago

tiegz commented 2 months ago

these days go.mod files declare their name like module my.go/module/name at the top of the file, but it looks like vgo, the predecessor to Go Modules, actually quoted the name, e.g. module "my.go/module/name"

Go still seems able to parse these older go.mod files and will also auto-correct them when it updates the go.mod file. But pkg.go.dev doesn't consider them valid.

this adds support for the quoted names when looking up the canonical name via the Go Proxy's go.mod API, to avoid errors like these when updating the package:

bad URI(is not URI?): "https://pkg.go.dev/\"github.com/SimonWaldherr/gwv\""