Skip to content

Commit

Permalink
ignore modules with no versions (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy authored May 28, 2024
1 parent c00cd13 commit 2e6aa47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/modproxy/modproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package modproxy
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -161,6 +162,9 @@ func Query(modpath string, cached bool) (*Module, bool, error) {
return &mod, true, nil
}

// ErrNoVersions is returned when the proxy has no version for a module
var ErrNoVersions = errors.New("no module versions found")

// Latest finds the latest major version of a module
// cached sets the Disable-Module-Fetch: true header
// pre controls whether to return modules which only contain pre-release versions.
Expand All @@ -175,7 +179,7 @@ func Latest(modpath string, cached, pre bool) (*Module, error) {
return mod, nil
}
}
return nil, fmt.Errorf("no module versions found")
return nil, ErrNoVersions
}

// List finds all the major versions of a module
Expand Down Expand Up @@ -292,6 +296,9 @@ func Updates(opt UpdateOptions) {
}
group.Go(func() error {
mod, err := Latest(m.Path, opt.Cached, opt.Pre)
if err == ErrNoVersions {
return nil
}
if err != nil {
ch <- Update{Module: m, Err: err}
return nil
Expand Down

0 comments on commit 2e6aa47

Please sign in to comment.