Skip to content

Commit

Permalink
remove unnecessary pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhuravlev authored and avelino committed Apr 3, 2023
1 parent be52079 commit 0355285
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func main() {
panic(err)
}

objs := make(map[string]*Object)
objs := make(map[string]Object)
query.Find("body #contents").NextFiltered("ul").Find("ul").Each(func(_ int, s *goquery.Selection) {
s.Find("li a").Each(func(_ int, s *goquery.Selection) {
selector, exists := s.Attr("href")
Expand All @@ -86,7 +86,7 @@ func main() {
if obj == nil {
return
}
objs[selector] = obj
objs[selector] = *obj
})
})

Expand Down Expand Up @@ -127,7 +127,7 @@ func mkdirAll(path string) error {
return nil
}

func makeSiteStruct(objs map[string]*Object) error {
func makeSiteStruct(objs map[string]Object) error {
for _, obj := range objs {
categoryDir := filepath.Join(outDir, obj.Slug)
if err := mkdirAll(categoryDir); err != nil {
Expand All @@ -152,7 +152,7 @@ func makeSiteStruct(objs map[string]*Object) error {
return nil
}

func makeSitemap(objs map[string]*Object) {
func makeSitemap(objs map[string]Object) {
// FIXME: handle error
f, _ := os.Create(outSitemapFile)
fmt.Printf("Render Sitemap to: %s\n", outSitemapFile)
Expand Down Expand Up @@ -188,7 +188,7 @@ func makeObjByID(selector string, s *goquery.Selection) (obj *Object) {
return
}

func changeLinksInIndex(html string, query *goquery.Document, objs map[string]*Object) {
func changeLinksInIndex(html string, query *goquery.Document, objs map[string]Object) {
query.Find("body #content ul li ul li a").Each(func(_ int, s *goquery.Selection) {
href, hrefExists := s.Attr("href")
if !hrefExists {
Expand Down

0 comments on commit 0355285

Please sign in to comment.