diff --git a/cmd/qrank-builder/build.go b/cmd/qrank-builder/build.go index 88808d2..9e25c83 100644 --- a/cmd/qrank-builder/build.go +++ b/cmd/qrank-builder/build.go @@ -48,7 +48,7 @@ func Build(client *http.Client, dumps string, numWeeks int, s3 S3) error { return nil } -type SiteFileBuilder func(site WikiSite, ctx context.Context, dumps string, s3 S3) error +type SiteFileBuilder func(site *WikiSite, ctx context.Context, dumps string, s3 S3) error func buildSiteFiles(ctx context.Context, filename string, builder SiteFileBuilder, dumps string, sites *map[string]WikiSite, s3 S3) error { stored, err := ListStoredFiles(ctx, filename, s3) @@ -69,7 +69,7 @@ func buildSiteFiles(ctx context.Context, filename string, builder SiteFileBuilde if !more { return nil } - if err := builder(t, ctx, dumps, s3); err != nil { + if err := builder(&t, ctx, dumps, s3); err != nil { return err } } diff --git a/cmd/qrank-builder/build_test.go b/cmd/qrank-builder/build_test.go index e3da676..f43d466 100644 --- a/cmd/qrank-builder/build_test.go +++ b/cmd/qrank-builder/build_test.go @@ -64,7 +64,7 @@ func TestBuildSiteFiles(t *testing.T) { t.Fatal(err) } - buildFunc := func(site WikiSite, ctx context.Context, dumps string, s3 S3) error { + buildFunc := func(site *WikiSite, ctx context.Context, dumps string, s3 S3) error { ymd := site.LastDumped.Format("20060102") path := fmt.Sprintf("foobar/%s-%s-foobar.zst", site.Key, ymd) s3.(*FakeS3).data[path] = []byte("fresh-" + ymd[:4]) diff --git a/cmd/qrank-builder/pagesignals.go b/cmd/qrank-builder/pagesignals.go index 66e4f00..f528f47 100644 --- a/cmd/qrank-builder/pagesignals.go +++ b/cmd/qrank-builder/pagesignals.go @@ -26,7 +26,7 @@ import ( ) // BuildPageSignals builds the page_signals file for a WikiSite and puts it in S3 storage. -func buildPageSignals(site WikiSite, ctx context.Context, dumps string, s3 S3) error { +func buildPageSignals(site *WikiSite, ctx context.Context, dumps string, s3 S3) error { ymd := site.LastDumped.Format("20060102") destPath := fmt.Sprintf("page_signals/%s-%s-page_signals.zst", site.Key, ymd) logger.Printf("building %s", destPath) @@ -50,10 +50,10 @@ func buildPageSignals(site WikiSite, ctx context.Context, dumps string, s3 S3) e group, groupCtx := errgroup.WithContext(ctx) group.Go(func() error { defer close(linesChan) - if err := processPagePropsTable(groupCtx, dumps, &site, linesChan); err != nil { + if err := processPagePropsTable(groupCtx, dumps, site, linesChan); err != nil { return err } - if err := processPageTable(groupCtx, dumps, &site, linesChan); err != nil { + if err := processPageTable(groupCtx, dumps, site, linesChan); err != nil { return err } return nil diff --git a/cmd/qrank-builder/pagesignals_test.go b/cmd/qrank-builder/pagesignals_test.go index b30f035..225f051 100644 --- a/cmd/qrank-builder/pagesignals_test.go +++ b/cmd/qrank-builder/pagesignals_test.go @@ -28,8 +28,9 @@ func TestBuildPageSignals(t *testing.T) { if err != nil { t.Fatal(err) } - for _, site := range []string{"rmwiki", "wikidatawiki"} { - if err := buildPageSignals((*sites)[site], ctx, dumps, s3); err != nil { + for _, siteKey := range []string{"rmwiki", "wikidatawiki"} { + site := (*sites)[siteKey] + if err := buildPageSignals(&site, ctx, dumps, s3); err != nil { t.Fatal(err) } }