if err := os.Mkdir(path, os.ModePerm); err != nil { return false, err } else { return true, nil } } else { return true, err } } 2、文件是否存在函数 代码语言:javascript 代码运行次数:0 运行 AI代码解释 // // IsExists // @Description: 文件是否存在 // @param path // @return...
TarFile := "test.tar" src := "test" dstDir := "test_ext" if err := Tar(src, TarFile, false); err != nil { fmt.Println(err) } if err := UnTar(TarFile, dstDir); err != nil { fmt.Println(err) } } // 将文件或目录打包成 .tar 文件 // src 是要打包的文件或目录的路径 ...
exists := gotool.FileUtils.Exists("F:/go-test/test") fmt.Println("创建前--->", exists) err := os.MkdirAll("F:/go-test/test", os.ModePerm) if err != nil { t.Fatal(err) } exists = gotool.FileUtils.Exists("F:/go-test/test") fmt.Println("创建后--->", exists) } //o...
.MetricsRepo{ ProjectID: 2, RepoPath: "/", FileCount: 5, CodeLineCount: 76, OwnerWorkNo: "999999", } return &repo } func getTeam() *model.Teams { team := model.Teams{ WorkNo: "999999", } return &team } func init() { db, err := gorm.Open("sqlite3", "test.db") if ...
{Id:22,Name:"静态文件",Path:"^/test/static/",Type: LocalFileSystem,Target:"/root/workspace/test/static",Enabled:true,DisableCache:true,SubHandlers: []*HandlerOptions{},},{Id:23,Name:"websocket相关",Path:"^/test/ws",Type: RemoteHttpServer,Target:"https://192.168.1.100:8000/ws",...
/home/keke/go/Test/wait.go:17 +0xab exit status2 它提示所有的 goroutine 都已经睡眠了,出现了死锁。这是因为 wg 给拷贝传递到了 goroutine 中,导致只有 Add 操作,其实 Done操作是在 wg 的副本执行的。 因此Wait 就死锁了。 这个第一个修改方式:将匿名函数中 wg 的传入类型改为 *sync.WaitGrou,这样...
func TestGet(t *testing.T) { value,ok := Get("name") if ok { fmt.Printf("name:%v\n",value) }else { t.Errorf("Get key:%v is not exists","name") } select { } } func MStat(t *testing.T) { type MemStatus struct { ...
go-testdeep - 非常灵活的深度比较包,扩展了 Go 测试包 go-model - struct 操作包 concurrent-map - 并发安全 map goleak - 检测 goroutine 泄漏 guregu/null - SQL/JSON的null处理包,提供替代类型 stats - 标准数字统计 Chronos - 静态竞争检测器 collection - 替代原生的 Slice rf - 代码重构工具 bytebuf...
misc_test.go Add helper method to check if file descriptor has been initialized wi… Aug 13, 2021 Repository files navigation README MIT license Golang argparseLet's be honest -- Go's standard command line arguments parser flag terribly sucks. It cannot come anywhere close to the Python's ...
Makefile Makefile: update goacc and linter versions Aug 21, 2024 README.md README: Update build instructions for switch from glide to modules Nov 20, 2019 btcwallet.go Fix lint errors Sep 20, 2022 config.go multi: add testnet4 support Mar 19, 2025 deps.txt Add 0.7.0 deps to deps....