stop using ioutil

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2021-02-19 18:02:02 -05:00
parent f223051b68
commit 038695d123
2 changed files with 4 additions and 5 deletions

View file

@ -3,7 +3,7 @@ package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"github.com/aymerick/raymond"
"github.com/mitchellh/mapstructure"
@ -31,7 +31,7 @@ type Page struct {
}
func newPage(slug string) (*Page, error) {
data, err := ioutil.ReadFile("posts/" + slug + ".md")
data, err := os.ReadFile("posts/" + slug + ".md")
if err != nil {
return nil, fmt.Errorf("could not read file: %s", err)
}

View file

@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@ -47,7 +46,7 @@ func newServer() (*server, error) {
}
func (s *server) refreshPages() error {
files, err := ioutil.ReadDir("posts/")
files, err := os.ReadDir("posts/")
if err != nil {
return err
}
@ -136,7 +135,7 @@ func loadRegularStylesheet(filename string) error {
}
func (s *server) refreshStyles() error {
styles, err := ioutil.ReadDir("styles/")
styles, err := os.ReadDir("styles/")
if err != nil {
return fmt.Errorf("Could not load styles directory: %s", err)
}