Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Commit

Permalink
ditch the common package
Browse files Browse the repository at this point in the history
  • Loading branch information
fischersean committed Nov 25, 2020
1 parent 44914af commit 2ad87e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
16 changes: 9 additions & 7 deletions chadwick/download.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package chadwick

import (
"github.com/fischersean/dinah/common"
"net/http"
)

var peopleRegister = "https://raw.githubusercontent.com/chadwickbureau/register/master/data/people.csv"

var countryRegister = "https://raw.githubusercontent.com/chadwickbureau/register/master/data/names.csv"

func downloadPeopleRegister() (p []Person, err error) {
r, err := common.DownloadFileUrl(peopleRegister)

res, err := http.Get(peopleRegister)

if err != nil {
return p, err
return nil, err
}

p, err = marshalPeople(r)
p, err = marshalPeople(res.Body)

if err != nil {
return p, err
Expand All @@ -25,13 +26,14 @@ func downloadPeopleRegister() (p []Person, err error) {
}

func downloadCountryRegister() (c []Country, err error) {
r, err := common.DownloadFileUrl(countryRegister)

res, err := http.Get(countryRegister)

if err != nil {
return c, err
return nil, err
}

c, err = marshalContries(r)
c, err = marshalContries(res.Body)

if err != nil {
return c, err
Expand Down
19 changes: 0 additions & 19 deletions common/common.go

This file was deleted.

7 changes: 5 additions & 2 deletions statcast/download.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package statcast

import (
"github.com/fischersean/dinah/common"
"net/http"
"net/url"
"time"
)
Expand Down Expand Up @@ -36,12 +36,15 @@ func downloadStatcastDay(d time.Time) (pitches []Pitch, err error) {

url := constructUrl(d, d)

r, err := common.DownloadFileUrl(url)
res, err := http.Get(url)

if err != nil {
return nil, err
}

r := res.Body


pitches, err = marshalPitches(r)

if err != nil {
Expand Down

0 comments on commit 2ad87e9

Please sign in to comment.