Skip to content

Commit

Permalink
Make linter green again
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver committed Aug 17, 2024
1 parent 4c4a306 commit 1dd2416
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions reduxer/reduxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ func Do(ctx context.Context, opts *config.Options, urls ...*url.URL) (Reduxer, e
g.Go(func() error {
basename := strings.TrimSuffix(helper.FileName(uri.String(), ""), ".html")
basename = strings.TrimSuffix(basename, ".htm")
ctx := context.WithValue(ctx, ctxBasenameKey, basename)
gCtx := context.WithValue(ctx, ctxBasenameKey, basename)

Check failure on line 180 in reduxer/reduxer.go

View workflow job for this annotation

GitHub Actions / golangci-lint / golangci (macos-latest)

SA1029: should not use empty anonymous struct as key for value; define your own type to avoid collisions (staticcheck)

Check failure on line 180 in reduxer/reduxer.go

View workflow job for this annotation

GitHub Actions / golangci-lint / golangci (windows-latest)

SA1029: should not use empty anonymous struct as key for value; define your own type to avoid collisions (staticcheck)

shot, er := capture(ctx, opts, uri, dir)
shot, er := capture(gCtx, opts, uri, dir)
if er != nil {
return errors.Wrap(er, "capture failed")
}
Expand All @@ -190,7 +190,7 @@ func Do(ctx context.Context, opts *config.Options, urls ...*url.URL) (Reduxer, e
Raw: Asset{Local: fmt.Sprint(shot.HTML)},
PDF: Asset{Local: fmt.Sprint(shot.PDF)},
HAR: Asset{Local: fmt.Sprint(shot.HAR)},
WARC: Asset{Local: craft(ctx, uri)},
WARC: Asset{Local: craft(gCtx, uri)},
}

fp := filepath.Join(dir, basename)
Expand All @@ -202,14 +202,14 @@ func Do(ctx context.Context, opts *config.Options, urls ...*url.URL) (Reduxer, e
}

if supportedMediaSite(uri) {
artifact.Media.Local = m.download(ctx, opts)
artifact.Media.Local = m.download(gCtx, opts)
}
// Attach single file
var buf []byte
var article readability.Article
buf, err = os.ReadFile(fmt.Sprint(shot.HTML))
if err == nil {
singleFilePath := singleFile(ctx, opts, bytes.NewReader(buf), dir, shot.URL)
singleFilePath := singleFile(gCtx, opts, bytes.NewReader(buf), dir, shot.URL)
artifact.HTM.Local = singleFilePath
}
article, err = readability.FromReader(bytes.NewReader(buf), uri)
Expand All @@ -222,7 +222,7 @@ func Do(ctx context.Context, opts *config.Options, urls ...*url.URL) (Reduxer, e
artifact.Txt.Local = fp
}
// Upload files to third-party server
if err = remotely(ctx, artifact); err != nil {
if err = remotely(gCtx, artifact); err != nil {
logger.Error("upload files to remote server failed: %v", err)
}
bundle := &bundle{shots: shot, artifact: *artifact, article: article}
Expand Down

0 comments on commit 1dd2416

Please sign in to comment.