修正格式,完善资料。

Signed-off-by: rick.chan <cy@haoan119.com>
This commit is contained in:
rick.chan 2025-03-28 17:41:29 +08:00
parent 7f6f1ffaa6
commit 4a5a154ab8
3 changed files with 22 additions and 14 deletions

View File

@ -255,16 +255,22 @@ func ListDir(dir, suffix string) (files []string, err error) {
suffix = strings.ToLower(suffix) //匹配后缀
for _, _file := range _dir {
if _file.IsDir() {
continue //忽略目录
for _, file := range _dir {
if file.IsDir() {
// 递归读取子目录下的文件
sub := filepath.Join(dir, file.Name())
fs, err := ListDir(sub, suffix)
if len(fs) != 0 && err == nil {
files = append(files, fs...)
}
continue
}
if len(suffix) == 0 {
// 不需要匹配文件后缀
files = append(files, filepath.Join(dir, _file.Name()))
} else if strings.HasSuffix(strings.ToLower(_file.Name()), suffix) {
files = append(files, filepath.Join(dir, file.Name()))
} else if strings.HasSuffix(strings.ToLower(file.Name()), suffix) {
// 文件后缀匹配
files = append(files, filepath.Join(dir, _file.Name()))
files = append(files, filepath.Join(dir, file.Name()))
}
}

View File

@ -104,7 +104,7 @@ import (
I published an update to a Go module, bumping the version to v1.1.0. I created a tag named v1.1.0 and pushed the tag to GitHub.
https://github.com/depp/bytesize/releases/tag/v1.1.0
<https://github.com/depp/bytesize/releases/tag/v1.1.0>
However, I cannot use this package in my other projects. I get an error that says, "invalid version: unknown revision v1.1.0". I don't know why the revision is "unknown", since it's tagged.
@ -122,22 +122,24 @@ The tag was pushed after invoking go get once, which poisoned the Go module prox
From <https://proxy.golang.org/>:
Note that if someone requested the version before the tag was pushed, it may take up to 30 minutes for the mirror's cache to expire and fresh data about the version to become available.
```txt
Note that if someone requested the version before the tag was pushed, it may take up to 30 minutes for the mirror's cache to expire and fresh data about the version to become available.
```
The way to work around this before the cache expires is to use the GOPRIVATE environment variable to instruct go get to fetch this module directly, bypassing the cache.
From <https://golang.org/cmd/go/>:
GOPRIVATE, GONOPROXY, GONOSUMDB
```txt
GOPRIVATE, GONOPROXY, GONOSUMDB
Comma-separated list of glob patterns (in the syntax of Go's path.Match) of module path prefixes that should always be fetched directly or that should not be compared against the checksum database.
Comma-separated list of glob patterns (in the syntax of Go's path.Match) of module path prefixes that should always be fetched directly or that should not be compared against the checksum database.
```
The workaround is:
```bash
$ GOPRIVATE=github.com/depp/bytesize go get github.com/depp/bytesize@v1.1.0
GOPRIVATE=github.com/depp/bytesize go get github.com/depp/bytesize@v1.1.0
```
Note that if you are already using GOPRIVATE, you will want to add modules rather than overriding the value completely.

View File

@ -90,7 +90,7 @@ filepath.Match("/home/catch/*", "/home/catch/foo/bar")
```go
/**
* 获取主文件名
* 获取主文件名
* 输出my.demo
*/
filename := "my.demo.jpg"