ioutil.ReadFile -> os.ReadFile + use constant for README
This commit is contained in:
parent
05fe195266
commit
ed9808b8f1
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -49,7 +49,7 @@ func TestDuplicatedLinks(t *testing.T) {
|
||||||
// Test if an entry has description, it must be separated from link with ` - `
|
// Test if an entry has description, it must be separated from link with ` - `
|
||||||
func TestSeparator(t *testing.T) {
|
func TestSeparator(t *testing.T) {
|
||||||
var matched, containsLink, noDescription bool
|
var matched, containsLink, noDescription bool
|
||||||
input, err := ioutil.ReadFile("./README.md")
|
input, err := os.ReadFile(readmePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
|
@ -11,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func readme() []byte {
|
func readme() []byte {
|
||||||
input, err := os.ReadFile("./README.md")
|
input, err := os.ReadFile(readmePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -37,7 +36,7 @@ type content struct {
|
||||||
|
|
||||||
// GenerateHTML generate site html (index.html) from markdown file
|
// GenerateHTML generate site html (index.html) from markdown file
|
||||||
func GenerateHTML(srcFilename, outFilename string) error {
|
func GenerateHTML(srcFilename, outFilename string) error {
|
||||||
input, err := ioutil.ReadFile(srcFilename)
|
input, err := os.ReadFile(srcFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue