### Run Login Test Source: https://github.com/guoruilv/openim-sdk-core/blob/main/README.md Execute test functions to simulate SDK usage. The init file handles SDK initialization and login. This example runs a test to get all conversation lists. ```bash go test -run Test_GetAllConversationList ``` -------------------------------- ### Install gomobile and gobind Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Install the latest versions of the gomobile and gobind tools. ```bash go install golang.org/x/mobile/cmd/gomobile@latest go install golang.org/x/mobile/cmd/gobind@latest ``` -------------------------------- ### Initialize gomobile Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Perform the initial setup for the gomobile tool. ```bash gomobile init ``` -------------------------------- ### Build WebAssembly Package Source: https://github.com/guoruilv/openim-sdk-core/blob/main/README_zh-CN.md Navigate to the 'wasm/cmd' directory and use 'make wasm' to build the WebAssembly package. Ensure Go is installed. For Windows, use 'mingw32-make wasm' with MinGW64 installed. ```bash make wasm # Ensure Go is installed ``` ```bash mingw32-make wasm # Ensure MinGW64 is installed ``` -------------------------------- ### Build WebAssembly Package Source: https://github.com/guoruilv/openim-sdk-core/blob/main/README.md Navigate to the wasm/cmd directory and run 'make wasm' to build the WebAssembly package. Ensure Go is installed. For Windows, use 'mingw32-make wasm' and ensure MinGW64 is installed. ```bash make wasm ``` ```bash mingw32-make wasm ``` -------------------------------- ### Alternative to 'make' Command on Windows Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md If the 'make' command is not found on Windows, you can use 'mingw32-make' if MinGW64 is installed. Alternatively, you can directly run the 'gomobile bind' command. ```bash mingw32-make ``` ```bash gomobile bind ``` -------------------------------- ### Version Information Structure Source: https://github.com/guoruilv/openim-sdk-core/blob/main/pkg/version/README.md Defines a struct to hold various version-related information for build details. Includes a String method for formatted output and a Get function to retrieve the current version info. ```go type Info struct { ... } func (info Info) String() string { ... } func Get() Info { ... } ``` -------------------------------- ### Install GNU Utils on macOS Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/development.md Install core GNU utilities required for shell scripts on macOS. Ensure these are available before running build or test scripts. ```sh brew install coreutils findutils gawk gnu-sed gnu-tar grep make ``` -------------------------------- ### Commit with Semantic Message Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Example of a standard commit command using a semantic prefix to describe the change. ```bash ❯ git commit -a -s -m "docs: add a new section to the readme" ``` -------------------------------- ### Check Go environment variables Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Verify the current Go environment configuration using the go env command. ```bash > go env set GOPATH=D:\Go\gopath set GOMODCACHE=D:\Go\gopath\pkg\mod ``` -------------------------------- ### Initialize Local Development Branch Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Fetch the latest changes from upstream and prepare a local branch for development. ```bash ❯ cd OpenIM ❯ git fetch upstream ❯ git checkout upstream/main ``` -------------------------------- ### Configure GOPATH on Unix systems Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Add GOPATH and the bin directory to the system PATH in shell configuration files. ```bash export GOPATH=/Users/youruser/go # Replace with your actual path export PATH=$PATH:$GOPATH/bin ``` -------------------------------- ### OpenIM Release Branching Model Visualization Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/git_workflow.md Visual representation of OpenIM's release branches and their corresponding versions. ```text main -------------------------------------------. (OpenIM 3.10) release-3.0.0 \---------------|---------------. (OpenIM 3.00) release-2.4.0 \---------------. (OpenIM 2.40) ``` -------------------------------- ### Compare OpenIM Aware Version Strings Source: https://github.com/guoruilv/openim-sdk-core/blob/main/pkg/version/README.md Compares two version strings following the OpenIM versioning pattern. Use this utility for version comparisons within the SDK. ```go func CompareOpenIMAwareVersionStrings(v1, v2 string) int { ... } ``` -------------------------------- ### Set Go Proxy for Dependency Downloads Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Use this command to set the Go proxy if you encounter network issues or dependency download failures when writing your go.mod file. The first option is a global proxy, and the second is recommended for users in China. ```bash go env -w GOPROXY=https://proxy.golang.org,direct ``` ```bash go env -w GOPROXY=https://goproxy.cn,direct ``` -------------------------------- ### Verify Git Remote Configuration Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Check the current remote repository URLs and push/fetch settings. ```go ❯ git remote -v origin https://github.com//OpenIM.git (fetch) origin https://github.com//OpenIM.git (push) upstream https://github.com/openimsdk/openim-sdk-core.git (fetch) upstream no-pushing (push) ``` -------------------------------- ### Configure Server Details for Testing Source: https://github.com/guoruilv/openim-sdk-core/blob/main/README.md Update the config file in the test directory with your server API and WebSocket addresses, and a test UserID. ```json { "APIADDR": "http://your-server-api-address", "WSADDR": "ws://your-server-websocket-address", "UserID": "your-test-user-id" } ``` -------------------------------- ### Compile iOS xcframework on macOS Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Use the make command to build the iOS xcframework library. ```bash make ios ``` -------------------------------- ### Compile Android AAR package on Windows Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Directly invoke the gomobile bind command to generate an AAR file for Android. ```bash gomobile bind -v -trimpath -ldflags="-s -w" -o ./open_im_sdk.aar -target=android ./open_im_sdk/ ./open_im_sdk_callback/ ``` -------------------------------- ### Compile Android AAR using make Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Use the Makefile to build the Android AAR package. ```bash mingw32-make android ``` -------------------------------- ### Configure GOPATH on Unix systems Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup-cn.md Add GOPATH to the system PATH in shell configuration files. ```bash export GOPATH=/Users/youruser/go # 根据你的实际路径替换 export PATH=$PATH:$GOPATH/bin ``` -------------------------------- ### Commit Changes with Linting Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Rebase against upstream, run linting, and commit changes with a sign-off trailer. ```bash ❯ git rebase upstream/main ❯ make lint # golangci-lint run -c .golangci.yml ❯ git add -A # add changes to staging ❯ git commit -a -s -m "fix: message for your changes" # -s adds a Signed-off-by trailer ``` -------------------------------- ### Compile Android AAR on macOS Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/gomobile-android-ios-setup.md Use the make command to build the Android AAR package on a macOS environment. ```bash make android ``` -------------------------------- ### Sync and Squash Commits Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Synchronize with upstream and squash multiple commits into one before pushing. ```bash # sync up with upstream ❯ git fetch upstream ❯ git rebase upstream/main ❯ git rebase -i # rebase with interactive mode to `squash` your commits into a single one ❯ git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin ``` -------------------------------- ### Create New Feature Branch Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Create a new branch based on the current state of the repository. ```bash ❯ git checkout -b ``` -------------------------------- ### Manually trigger a release version via Git Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Use this command to manually set a release version by creating an empty commit with a specific release message. ```bash git commit --allow-empty -m "chore: release 0.0.3" -m "Release-As: 0.0.3" ``` -------------------------------- ### Manage Multiple Feature PRs Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Workflow for developing and submitting multiple features sequentially in the same branch. ```bash # create new branch, for example git checkout -b feature/infra ❯ git checkout -b # update some code, feature1 ❯ git add -A ❯ git commit -m -s "feat: feature one" ❯ git push # if it's first time push, run git push --set-upstream origin # then create pull request, and merge # update some new feature, feature2, rebase main branch first. ❯ git rebase upstream/main # rebase the current branch to upstream/main branch ❯ git add -A ❯ git commit -m -s "feat: feature two" # then create pull request, and merge ``` -------------------------------- ### Update PATH for GNU Utils on macOS Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/development.md Prepend GNU utilities to the PATH environment variable in your shell init script. This ensures that the system uses GNU versions of commands like sed. ```sh GNUBINS="$(find /usr/local/opt -type d -follow -name gnubin -print)" for bindir in ${GNUBINS[@]}; do PATH=$bindir:$PATH done export PATH ``` -------------------------------- ### Clone Fork and Set Upstream Remote Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/git_workflow.md Commands to clone your OpenIM fork and add the official repository as an upstream remote. Ensure to never push directly to upstream. ```sh ## Clone fork to local storage export user="your github profile name" git clone https://github.com/$user/OpenIM.git # or: git clone git@github.com:$user/OpenIM.git ## Add OpenIM as upstream to your fork cd OpenIM git remote add upstream https://github.com/openimsdk/openim-sdk-core.git # or: git remote add upstream git@github.com:OpenIMSDK/openim-sdk-core.git ## Ensure to never push to upstream directly git remote set-url --push upstream no_push ## Confirm that your remotes make sense: git remote -v ``` -------------------------------- ### Create New Feature Branch Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/git_workflow.md Steps to update your local main branch and create a new branch for feature development. This ensures your new branch is based on the latest code. ```sh ## Get local main up to date # Assuming the OpenIM clone is the current working directory git fetch upstream git checkout main git rebase upstream/main ## Create a new branch from main git checkout -b myfeature ``` -------------------------------- ### Automate Git Commit Sign Off Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Add this function to your .bashrc or .zshrc to automatically apply --signoff to all git commit commands. ```bash git() { if [ $# -gt 0 ] && [[ "$1" == "commit" ]] ; then shift command git commit --signoff "$@" else command git "$@" fi } ``` -------------------------------- ### Keep Local Branches in Sync with Upstream Source: https://github.com/guoruilv/openim-sdk-core/blob/main/docs/contrib/git_workflow.md Commands to fetch changes from the upstream repository and rebase your current branch onto the latest main branch. This avoids merge commits. ```sh git fetch upstream git rebase upstream/main ``` -------------------------------- ### Configure Git Remote Upstream Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Set the upstream remote to the official OpenIM repository and disable pushing to it directly. ```bash ❯ git remote add upstream https://github.com/openimsdk/openim-sdk-core.git ❯ git remote set-url --push upstream no-pushing ``` -------------------------------- ### Commit with Automatic Sign Off Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Append the Signed-off-by line automatically to your commit message using the -s flag. ```bash git commit -s -m "docs: this is my commit message" ``` -------------------------------- ### Sign Off Last Git Commit Source: https://github.com/guoruilv/openim-sdk-core/blob/main/CONTRIBUTING.md Use this command to amend your last commit and add the Signed-off-by line, which is required for DCO checks. ```bash git commit --amend --signoff ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.