Skip to content

Commit

Permalink
Tweak org scraper output
Browse files Browse the repository at this point in the history
  • Loading branch information
jpahm committed Nov 9, 2023
1 parent b82f360 commit 736fe29
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scrapers/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func processCsv(ctx context.Context, inputPath string, storageFilePath string) e
encoder := json.NewEncoder(bufio.NewWriter(storageFile))
encoder.SetIndent("", "\t")

var _ []*schema.Organization
var orgs []*schema.Organization
// process each row of csv
for i := 1; true; i++ {
entry, err := csvReader.Read()
Expand All @@ -189,9 +189,13 @@ func processCsv(ctx context.Context, inputPath string, storageFilePath string) e
if err != nil {
return err
}
if err := encoder.Encode(org); err != nil {
return err
}

orgs = append(orgs, org)
}

// Write JSON to file
if err = encoder.Encode(orgs); err != nil {
return err
}

if err := csvFile.Close(); err != nil {
Expand Down

0 comments on commit 736fe29

Please sign in to comment.