diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6dbb18e..294befa 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -6,31 +6,31 @@ jobs: test: name: Test runs-on: ${{ matrix.os }} - + strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] go: ['1.22.x', '1.18.x'] - + steps: - name: Check out code into the Go module directory uses: actions/checkout@v4 - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} id: go - name: Vet run: go vet -v ./... - + - name: Test run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... - name: Upload Coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{secrets.CODECOV_TOKEN}} file: ./coverage.txt diff --git a/config.go b/config.go index 36a1deb..12989d4 100644 --- a/config.go +++ b/config.go @@ -22,7 +22,7 @@ type Config struct { s Serializer } -// BuildDir 根据 dir 生成不同的 Config +// BuildDir 根据 dir 生成不同的 [Config] // // dir 为项目的配置文件目录,后续通过 [Config] 操作的文件都是基于此目录的。可以带以下的特殊前缀: // - ~ 表示系统提供的配置文件目录,比如 Linux 的 XDG_CONFIG、Window 的 AppData 等; @@ -81,10 +81,10 @@ func Dir(s Serializer, dir string) *Config { return c } -// New 声明 Config 对象 +// New 声明 [Config] 对象 // -// dir 表示当前项目的配置文件存放的目录名称; -// parent 表示获取系统中用于存放配置文件的目录,比如 Linux 中的 XDG_CONFIG 等目录。 +// dir 表示当前项目的配置文件存放的目录名称,如果 parent 不为空,为相对于 parent 返回值的路径; +// parent 表示获取系统中用于存放配置文件的路径,比如 Linux 中的 XDG_CONFIG 等目录。 // 用户可以根据自己的需求自行实现该方法,如果为 nil,表示直接将 dir 作为全路径进行处理。 func New(s Serializer, dir string, parent func() (string, error)) (*Config, error) { if parent != nil { diff --git a/go.mod b/go.mod index a52a141..f4f24a9 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.18 require ( github.com/issue9/assert/v4 v4.1.1 - github.com/issue9/localeutil v0.26.4 + github.com/issue9/localeutil v0.26.5 golang.org/x/text v0.14.0 ) diff --git a/go.sum b/go.sum index a7b3e30..5435c85 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/issue9/assert/v4 v4.1.1 h1:OhPE8SB8n/qZCNGLQa+6MQtr/B3oON0JAVj68k8jJlc= github.com/issue9/assert/v4 v4.1.1/go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4= -github.com/issue9/localeutil v0.26.4 h1:rfBC3YAt9PLHXHc5unreZpYjlEt+xCnVOUr7QDAveiw= -github.com/issue9/localeutil v0.26.4/go.mod h1:BJXJwcAT9CyyVZOlqfmq+B5FcPbqGxGjYnTYbVuiMM8= +github.com/issue9/localeutil v0.26.5 h1:e78b6cOOtgzfb4g4U9uPLC8QyK6Lux+s7ZiQe+6iM1A= +github.com/issue9/localeutil v0.26.5/go.mod h1:BJXJwcAT9CyyVZOlqfmq+B5FcPbqGxGjYnTYbVuiMM8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=