refactor: update outdated stuff

This commit is contained in:
fengxxc
2023-02-21 16:05:44 +08:00
parent 1cfe71e0a3
commit 9e30b39a15
3 changed files with 4 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ markdown和图片文件将保存在 `D:\wechatmp_bak\2022年度总结\` 下
将返回一个zip文件
## 开发
go 1.20
### 编译
#### Linux or Mac 环境
```

View File

@@ -12,8 +12,7 @@ type Header struct {
Text string
}
// go不资瓷泛型可真是难受...
type Value interface{}
type Value any
type Piece struct {
Type PieceType

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"encoding/base64"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@@ -187,7 +186,7 @@ func ParseFromHTMLFile(filepath string, imagePolicy ImagePolicy) Article {
panic(err)
}
defer file.Close()
content, err2 := ioutil.ReadAll(file)
content, err2 := io.ReadAll(file)
if err2 != nil {
panic(err)
}
@@ -229,7 +228,7 @@ func fetchImgFile(url string) []byte {
if res.StatusCode != 200 {
log.Fatalf("get Image from url %s error: %d %s", url, res.StatusCode, res.Status)
}
content, err := ioutil.ReadAll(res.Body)
content, err := io.ReadAll(res.Body)
if err != nil {
log.Fatalf("read image Response error: %s", err.Error())
}