mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-18 07:49:01 +08:00
feat: add scripts format (#811)
* feat: add scripts format Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: add go work Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Notes about go workspace
|
||||
|
||||
As openim is using go1.18's [workspace feature](https://go.dev/doc/tutorial/workspaces), once you add a new module, you need to run `go work use -r .` at root directory to update the workspace synced.
|
||||
|
||||
### Create a new extensions
|
||||
|
||||
1. Create your tools_name directory in pkg `/tools` first and cd into it.
|
||||
2. Init the project.
|
||||
3. Then `go work use -r .` at current directory to update the workspace.
|
||||
4. Create your tools
|
||||
|
||||
You can execute the following commands to do things above:
|
||||
|
||||
```bash
|
||||
# 4dd91a700d3f:/openim# tree
|
||||
# .
|
||||
# ├── LICENSE
|
||||
# ├── README.md
|
||||
# ├── openim-chat
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# ├── openim-server
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# ├── openkf
|
||||
# │ ├── bin
|
||||
# │ ├── config
|
||||
# │ ├── logs
|
||||
# │ └── scripts
|
||||
# cd tools_code_dir
|
||||
# edit the CRD_NAME and CRD_GROUP to your own
|
||||
export OPENIM_TOOLS_NAME=<Changeme>
|
||||
|
||||
# copy and paste to create a new CRD and Controller
|
||||
mkdir tools/${OPENIM_TOOLS_NAME}
|
||||
cd tools/${OPENIM_TOOLS_NAME}
|
||||
go mod init github.com/OpenIMSDK/Open-IM-Server/tools/${OPENIM_TOOLS_NAME}
|
||||
go mod tidy
|
||||
go work use -r .
|
||||
cd ../..
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/infra
|
||||
|
||||
go 1.20
|
||||
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("Current module is still under development.")
|
||||
message := `
|
||||
Current module is still under development.
|
||||
|
||||
____ _____ __ __
|
||||
/ __ \ |_ _|| \/ |
|
||||
| | | | _ __ ___ _ __ | | | \ / |
|
||||
| | | || '_ \ / _ \| '_ \ | | | |\/| |
|
||||
| |__| || |_) || __/| | | | _| |_ | | | |
|
||||
\____/ | .__/ \___||_| |_||_____||_| |_|
|
||||
| |
|
||||
|_|
|
||||
|
||||
Keep checking for updates!
|
||||
`
|
||||
|
||||
fmt.Println(message)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
module github.com/OpenIMSDK/Open-IM-Server/tools/ncpu
|
||||
|
||||
go 1.20
|
||||
|
||||
require go.uber.org/automaxprocs v1.5.3
|
||||
@@ -0,0 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
|
||||
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"go.uber.org/automaxprocs/maxprocs"
|
||||
)
|
||||
|
||||
func main() {
|
||||
maxprocs.Set()
|
||||
fmt.Print(runtime.GOMAXPROCS(0))
|
||||
}
|
||||
Reference in New Issue
Block a user