Skip to content

Commit

Permalink
fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhuravlev authored and avelino committed Apr 3, 2023
1 parent 272eabc commit ef78311
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* Package main contains code for generate static site. */
package main

import (
Expand All @@ -16,12 +17,14 @@ import (
"github.com/avelino/awesome-go/pkg/slug"
)

// Link contains info about awesome url
type Link struct {
Title string
Url string
URL string
Description string
}

// Category describe link category
type Category struct {
Title string
Slug string
Expand Down Expand Up @@ -251,7 +254,7 @@ func extractCategory(doc *goquery.Document, selector string) (*Category, error)
// FIXME(kazhuravlev): Title contains only title but
// description contains Title + description
Description: selLi.Text(),
Url: url,
URL: url,
}
links = append(links, link)
})
Expand Down Expand Up @@ -297,14 +300,14 @@ func rewriteLinksInIndex(doc *goquery.Document, categories map[string]Category)
return true
}

linkUrl, err := url.Parse(href)
linkURL, err := url.Parse(href)
if err != nil {
iterErr = err
return false
}

if linkUrl.Fragment != "" && linkUrl.Fragment != "contents" {
s.SetAttr("href", linkUrl.Fragment)
if linkURL.Fragment != "" && linkURL.Fragment != "contents" {
s.SetAttr("href", linkURL.Fragment)
}

return true
Expand All @@ -315,12 +318,12 @@ func rewriteLinksInIndex(doc *goquery.Document, categories map[string]Category)
}

fmt.Printf("Rewrite links in Index file: %s\n", outIndexFile)
resultHtml, err := doc.Html()
resultHTML, err := doc.Html()
if err != nil {
return fmt.Errorf("render html: %w", err)
}

if err := os.WriteFile(outIndexFile, []byte(resultHtml), 0644); err != nil {
if err := os.WriteFile(outIndexFile, []byte(resultHTML), 0644); err != nil {
return fmt.Errorf("rewrite index file: %w", err)
}

Expand Down
4 changes: 2 additions & 2 deletions tmpl/assets/awesome-go.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ h1 > a img {
line-height: 1;
}

td{
padding: 6px;
td {
padding: 6px;
}

0 comments on commit ef78311

Please sign in to comment.