Golang ============ 1. go build 不同平台的執行檔 ```bash= // Linux CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go // windows CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go // mac CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go GOOS:目标平台的操作系统(darwin、freebsd、linux、windows) GOARCH:目标平台的体系架构(386、amd64、arm) 交叉编译不支持 CGO 所以要禁用它 -o : output ``` [命令: go build](https://studygolang.com/articles/9463) [src:env](https://golang.org/doc/install/source#environment) ### Ginkgo [Ginkgo Github](https://github.com/onsi/ginkgo) [Ginkgo](http://onsi.github.io/ginkgo/) 1. Install ```bash go get -u github.com/onsi/ginkgo/ginkgo # installs the ginkgo CLI go get -u github.com/onsi/gomega/... # fetches the matcher library ``` 2. Create test file ```bash cd path/to/package/you/want/to/test ginkgo bootstrap # set up a new ginkgo suite ginkgo generate # will create a sample test file. edit this file and add your tests then... go test # to run your tests ginkgo # also runs your tests ``` [gitlab ci](https://github.com/mohaila/gohello/blob/master/.gitlab-ci.yml) [ginkgo使用指南](https://blog.csdn.net/Goodboynihaohao/article/details/79392500) [ginkog命令詳解](https://blog.csdn.net/Goodboynihaohao/article/details/79398622) https://deployeveryday.com/2019/10/08/golang-auth-mock.html?utm_source=dormosheio&utm_campaign=dormosheio
{"metaMigratedAt":"2023-06-14T21:35:57.283Z","metaMigratedFrom":"Content","title":"Golang","breaks":true,"contributors":"[{\"id\":\"02674073-df74-4c39-b712-43f81262264c\",\"add\":1355,\"del\":9}]"}
Expand menu