refactor: clarify source.JoinPath usage restricted to file paths
6 files changed, 9 insertions(+), 9 deletions(-)
M internal/config/structs.go → internal/config/structs.go
@@ -86,7 +86,7 @@ source.Name = strings.ToTitle(source.Key[0:1]) + source.Key[1:] } } -func (source *Source) JoinPath(name string) string { +func (source *Source) JoinFilePath(name string) string { //nolint:forbidigo // is not absolute return filepath.Join("sources", source.Key, name) }
M internal/fetcher/channel.go → internal/fetcher/channel.go
@@ -41,7 +41,7 @@ func (i *ChannelFetcher) FetchIfNeeded( ctx context.Context, sourceMeta *meta.SourceMeta, ) (*FetchedFiles, error) { - target := i.Source.JoinPath("options.json") + target := i.Source.JoinFilePath("options.json") args := []string{ "--no-build-output", "--timeout",
M internal/fetcher/download.go → internal/fetcher/download.go
@@ -56,7 +56,7 @@ files[i.Source.Importer], } for _, basename := range filesToFetch { - target := i.Source.JoinPath(basename) + target := i.Source.JoinFilePath(basename) fetchURL, baseErr := url.JoinPath(i.Source.URL, basename) if baseErr != nil { return nil, fault.Wrap(
M internal/fetcher/main.go → internal/fetcher/main.go
@@ -33,7 +33,7 @@ func New( source config.Source, opts *Options, ) (fetcher Fetcher, err error) { - target := source.JoinPath("") + target := source.JoinFilePath("") exists, err := opts.Root.Exists(target) if err != nil { return nil, fault.Wrap(err, fmsg.With("failed to check if directory exists"))@@ -68,7 +68,7 @@ root := opts.Root f := &FetchedFiles{} - rev, err := openIfExists(root, source.JoinPath("revision")) + rev, err := openIfExists(root, source.JoinFilePath("revision")) if err != nil { opts.Logger.Warn("failed to open revision file", "error", err) }@@ -78,9 +78,9 @@ } switch source.Importer { case config.Options: - f.Options, err = root.Open(source.JoinPath("options.json")) + f.Options, err = root.Open(source.JoinFilePath("options.json")) case config.Packages: - f.Packages, err = root.Open(source.JoinPath("packages.json")) + f.Packages, err = root.Open(source.JoinFilePath("packages.json")) default: err = fault.Newf("unsupported importer type %s", source.Importer.String()) }
M internal/fetcher/nixpkgs-channel.go → internal/fetcher/nixpkgs-channel.go
@@ -66,7 +66,7 @@ }) var fetchURL string for urlname, filename := range filesToFetch { - target := i.Source.JoinPath(filename) + target := i.Source.JoinFilePath(filename) fetchURL, err = makeChannelURL(i.Source.Channel, urlname) if err != nil { return
M internal/programs/programs.go → internal/programs/programs.go
@@ -113,7 +113,7 @@ func (p *DB) openDB(mode string) (*sql.DB, error) { u := fmt.Sprintf( "file:%s?mode=%s&_pragma=foreign_keys(1)&_pragma=mmap_size(%d)", //nolint: forbidigo // external package - p.root.JoinPath(p.source.JoinPath("programs.db")), + p.root.JoinPath(p.source.JoinFilePath("programs.db")), mode, 16*1024*1024, )