Runs go fmt on all code.
This commit is contained in:
		
							parent
							
								
									29bd83be41
								
							
						
					
					
						commit
						7b1a94122f
					
				
					 4 changed files with 21 additions and 21 deletions
				
			
		
							
								
								
									
										12
									
								
								atom.go
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								atom.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -106,13 +106,13 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
 | 
			
		|||
				i.Content.Base = tn.S("xml", "base")
 | 
			
		||||
				i.Content.Text = tn.GetValue()
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			if tn = item.SelectNode(ns, "author"); tn != nil {
 | 
			
		||||
				i.Author = Author{}		
 | 
			
		||||
		                i.Author.Name = tn.S(ns, "name")
 | 
			
		||||
		                i.Author.Uri = tn.S(ns, "uri")
 | 
			
		||||
		                i.Author.Email = tn.S(ns, "email")
 | 
			
		||||
            		}
 | 
			
		||||
				i.Author = Author{}
 | 
			
		||||
				i.Author.Name = tn.S(ns, "name")
 | 
			
		||||
				i.Author.Uri = tn.S(ns, "uri")
 | 
			
		||||
				i.Author.Email = tn.S(ns, "email")
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			ch.Items = append(ch.Items, i)
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								feed.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								feed.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -165,7 +165,7 @@ func (this *Feed) makeFeed(doc *xmlx.Document) (err error) {
 | 
			
		|||
		this.CacheTimeout = this.Channels[0].TTL
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    return
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This function returns true or false, depending on whether the CacheTimeout
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										26
									
								
								feed_test.go
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								feed_test.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
package feeder
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
    "testing"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var items []*Item
 | 
			
		||||
| 
						 | 
				
			
			@ -31,9 +31,9 @@ func TestFeed(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
func Test_AtomAuthor(t *testing.T) {
 | 
			
		||||
	content, err := ioutil.ReadFile("testdata/idownload.atom")
 | 
			
		||||
    if err != nil {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Errorf("unable to load file")
 | 
			
		||||
    }
 | 
			
		||||
	}
 | 
			
		||||
	feed := New(1, true, chanHandler, itemHandler)
 | 
			
		||||
	err = feed.FetchBytes("http://example.com", content, nil)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -45,15 +45,15 @@ func Test_AtomAuthor(t *testing.T) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func Test_RssAuthor(t *testing.T) {
 | 
			
		||||
    content, _ := ioutil.ReadFile("testdata/boing.rss")
 | 
			
		||||
    feed := New(1, true, chanHandler, itemHandler)
 | 
			
		||||
    feed.FetchBytes("http://example.com", content, nil)
 | 
			
		||||
	content, _ := ioutil.ReadFile("testdata/boing.rss")
 | 
			
		||||
	feed := New(1, true, chanHandler, itemHandler)
 | 
			
		||||
	feed.FetchBytes("http://example.com", content, nil)
 | 
			
		||||
 | 
			
		||||
    item := items[0]
 | 
			
		||||
    expected := "Cory Doctorow"
 | 
			
		||||
    if item.Author.Name != expected {
 | 
			
		||||
        t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name)
 | 
			
		||||
    }
 | 
			
		||||
	item := items[0]
 | 
			
		||||
	expected := "Cory Doctorow"
 | 
			
		||||
	if item.Author.Name != expected {
 | 
			
		||||
		t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Test_CData(t *testing.T) {
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ func Test_CData(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
	item := items[0]
 | 
			
		||||
	expected := `<p>abc<div>"def"</div>ghi`
 | 
			
		||||
    if item.Description != expected {
 | 
			
		||||
	if item.Description != expected {
 | 
			
		||||
		t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,6 @@ func chanHandler(feed *Feed, newchannels []*Channel) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func itemHandler(feed *Feed, ch *Channel, newitems []*Item) {
 | 
			
		||||
    items = newitems
 | 
			
		||||
	items = newitems
 | 
			
		||||
	println(len(newitems), "new item(s) in", ch.Title, "of", feed.Url)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								rss.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								rss.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -151,7 +151,7 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
			i.Comments = item.S(ns, "comments")
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			guid := item.S(ns, "guid")
 | 
			
		||||
			if len(guid) > 0 {
 | 
			
		||||
				i.Guid = &guid
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue