Compare commits

..

No commits in common. "0edc5682de6ec8fc36b7c952981dde98c560612b" and "898da94c9538056a43d6b8b5d5a2f2225183dabb" have entirely different histories.

4 changed files with 7 additions and 23 deletions

2
.gitignore vendored

@ -1,3 +1 @@
.idea/
.vscode/
.devcontainer/

@ -1,17 +1,9 @@
# GoINI [![PkgGoDev](https://pkg.go.dev/badge/github.com/xiaoqidun/goini)](https://pkg.go.dev/github.com/xiaoqidun/goini)
简单易用的Golang INI配置解析库
# 安装方法
```shell
go get -u github.com/xiaoqidun/goini
```
# 读取配置
## 从文件读取配置
```go
//初始GoINI对象
ini := goini.NewGoINI()
@ -21,20 +13,14 @@ if err := ini.LoadFile("./config.ini"); err != nil {
return
}
```
## 从字符读取配置
```go
//初始GoINI对象
ini := goini.NewGoINI()
//从字符获取配置
ini.SetData([]byte(""))
```
# 注释方法
goini将;或#开头的行识别为注释信息
# 分区支持
goini将[](英文中括号)识别为分区

2
go.mod

@ -1,3 +1,3 @@
module github.com/xiaoqidun/goini
go 1.20
go 1.13

@ -3,7 +3,7 @@ package goini
import (
"bytes"
"errors"
"os"
"io/ioutil"
"reflect"
"regexp"
"strconv"
@ -135,7 +135,7 @@ func (ini *GoINI) SetData(fileData []byte) {
// LoadFile 从文件读取配置并解析
func (ini *GoINI) LoadFile(fileName string) error {
b, err := os.ReadFile(fileName)
b, err := ioutil.ReadFile(fileName)
if err != nil {
return err
}