4 Star 6 Fork 3

王军 / golib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 556 Bytes
一键复制 编辑 原始数据 按行查看 历史
王军 提交于 2020-06-12 22:25 . 修复代码引用错误
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"gitee.com/haodreams/golib/datacache"
)
func main() {
if len(os.Args) < 2 {
fmt.Println(os.Args[0], "filename")
return
}
f, err := os.Open(os.Args[1])
if err != nil {
log.Fatal(err)
}
defer f.Close()
buf := bufio.NewReader(f)
data := make([]byte, 17)
var item datacache.Item
for {
n, err := io.ReadFull(buf, data)
if n != 17 || err != nil {
//log.Fatal(err)
return
}
er := item.Decode(data)
if er != nil {
log.Fatal(er)
}
fmt.Println(item.String())
}
}
Go
1
https://gitee.com/haodreams/golib.git
git@gitee.com:haodreams/golib.git
haodreams
golib
golib
7a2a333d4463

搜索帮助