diff options
author | Alan Pearce | 2025-03-12 22:39:51 +0100 |
---|---|---|
committer | Alan Pearce | 2025-03-12 22:39:51 +0100 |
commit | 9015baf955c94a806c01b3dcd5648c8e68ad2685 (patch) | |
tree | 5f59386c2ab31b6e45b85576e45a1fc8ae448ae0 /internal/fetcher/nixpkgs-channel.go | |
parent | 7bb77ff5729cc9434afee895a470fd3b4c12e6d1 (diff) | |
download | searchix-9015baf955c94a806c01b3dcd5648c8e68ad2685.tar.lz searchix-9015baf955c94a806c01b3dcd5648c8e68ad2685.tar.zst searchix-9015baf955c94a806c01b3dcd5648c8e68ad2685.zip |
Diffstat (limited to 'internal/fetcher/nixpkgs-channel.go')
-rw-r--r-- | internal/fetcher/nixpkgs-channel.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/internal/fetcher/nixpkgs-channel.go b/internal/fetcher/nixpkgs-channel.go index 6f8ca63..0424602 100644 --- a/internal/fetcher/nixpkgs-channel.go +++ b/internal/fetcher/nixpkgs-channel.go @@ -2,13 +2,12 @@ package fetcher import ( "context" - "fmt" "net/url" "go.alanpearce.eu/searchix/internal/config" "go.alanpearce.eu/searchix/internal/index" - "github.com/pkg/errors" + "gitlab.com/tozd/go/errors" "go.alanpearce.eu/x/log" ) @@ -17,7 +16,7 @@ type NixpkgsChannelFetcher struct { Logger *log.Logger } -func makeChannelURL(channel string, subPath string) (string, error) { +func makeChannelURL(channel string, subPath string) (string, errors.E) { url, err := url.JoinPath("https://channels.nixos.org/", channel, subPath) return url, errors.WithMessagef(err, "error creating URL") @@ -26,7 +25,7 @@ func makeChannelURL(channel string, subPath string) (string, error) { func NewNixpkgsChannelFetcher( source *config.Source, logger *log.Logger, -) (*NixpkgsChannelFetcher, error) { +) (*NixpkgsChannelFetcher, errors.E) { switch source.Importer { case config.Options, config.Packages: return &NixpkgsChannelFetcher{ @@ -34,7 +33,7 @@ func NewNixpkgsChannelFetcher( Logger: logger, }, nil default: - return nil, fmt.Errorf("unsupported importer type %s", source.Importer) + return nil, errors.Errorf("unsupported importer type %s", source.Importer) } } @@ -47,7 +46,7 @@ const ( func (i *NixpkgsChannelFetcher) FetchIfNeeded( ctx context.Context, sourceMeta *index.SourceMeta, -) (f FetchedFiles, err error) { +) (f *FetchedFiles, err errors.E) { filesToFetch := make([]string, 2) filesToFetch[0] = revisionFilename |