Skip to content

Commit 598abab

Browse files
committed
move newdoc type, fix typos. 0.4.4
1 parent a229cc7 commit 598abab

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GOCMD=go
22
BINARY=awsnews
33
BUILD_FLAGS=-ldflags="-s -w"
44
PROJECT=circa10a/go-aws-news
5-
VERSION=0.4.3
5+
VERSION=0.4.4
66

77
# First target for travis ci
88
test:

main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ import (
1010
)
1111

1212
func main() {
13-
1413
news, err := news.Yesterday()
14+
1515
if err != nil {
1616
log.Fatal(err)
1717
}
18-
1918
if len(news) == 0 {
2019
log.Info("No news fetched. Skipping notifications.")
2120
log.Exit(0)
@@ -26,7 +25,6 @@ func main() {
2625
if len(providers) == 0 {
2726
log.Fatal("No providers enabled. See config.yaml.")
2827
}
29-
3028
for _, p := range providers {
3129
log.Info(fmt.Sprintf("[%v] Provider registered", p.GetName()))
3230
p.Notify(news)

news/announcements.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ type Announcement struct {
2222
PostDate string
2323
}
2424

25-
// newDoc Extends the goquery.Document to create more receiver functions on the *goquery.Document type.
26-
type newsDoc struct {
27-
*goquery.Document
28-
}
29-
30-
func (n newsDoc) GetAnnouncements() (Announcements, error) {
25+
func (d newsDoc) GetAnnouncements() (Announcements, error) {
3126
// Create []Announcement
3227
var announcements Announcements
33-
n.getSelectionItems().Each(func(i int, s *goquery.Selection) {
34-
title := n.getSelectionTitle(s)
35-
link := fmt.Sprintf("https:%v", n.getSelectionItemLink(s))
36-
date := parseDate(n.getSelectionItemDate(s))
28+
d.getSelectionItems().Each(func(i int, s *goquery.Selection) {
29+
title := d.getSelectionTitle(s)
30+
link := fmt.Sprintf("https:%v", d.getSelectionItemLink(s))
31+
date := parseDate(d.getSelectionItemDate(s))
3732
announcements = append(announcements, Announcement{Title: title, Link: link, PostDate: date})
3833
})
3934
return announcements, nil

news/newsdoc.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import (
66
"github.com/PuerkitoBio/goquery"
77
)
88

9+
// newsDoc Extends the goquery.Document to create more receiver functions on the *goquery.Document type.
10+
type newsDoc struct {
11+
*goquery.Document
12+
}
13+
914
// getNewsDocYear Fetches html from AWS depending on the year/month specified.
1015
func getNewsDocYear(year int) (*goquery.Document, error) {
1116
url := fmt.Sprintf("https://aws.amazon.com/about-aws/whats-new/%d", year)
@@ -45,7 +50,7 @@ func (d *newsDoc) getSelectionItemLink(s *goquery.Selection) string {
4550
return link
4651
}
4752

48-
//getSelectionItemData Filters the date posted for each announcement.
53+
// getSelectionItemData Filters the date posted for each announcement.
4954
func (d *newsDoc) getSelectionItemDate(s *goquery.Selection) string {
5055
return s.Find("div.date").Text()
5156
}

0 commit comments

Comments
 (0)