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

Treat Redirected Go Packages as Removed #3358

Closed mikeyoung85 closed 2 months ago

mikeyoung85 commented 2 months ago

This PR updates the check_status logic for Go packages to treat a redirect from pkg.go.dev as a "Removed" package. The reasons for this change are to help capture when packages are renamed or recased and mark the now incorrect one appropriately. This is just an idea, so feel free to disagree with this approach.

One example is: https://libraries.io/go/github.com%2FAzure%2Fazure-pipeline-go vs https://libraries.io/go/github.com%2Fazure%2FAzure-pipeline-go which both reference github.com/Azure/azure-pipeline-go. This PR would mark github.com/azure/Azure-pipeline-go as removed.

> url = "https://pkg.go.dev/github.com/azure/Azure-pipeline-go"
> response = Typhoeus.get(url)
> response.response_code
=> 302
> response.body
=> "<a href=\"/github.com/Azure/azure-pipeline-go\">Found</a>.\n\n"