# OpenIM SDK Version Management OpenIM SDK uses a unique approach to version management by integrating principles from the Kubernetes project version management design. ## Versioning Methodology: Whenever you run the server CTL via the `go build` command, the system will automatically obtain the current `git commit hash`. This commit hash is then set as the version number and written to the `pkg/version/version.go` file. This approach ensures that each build is distinct and can be traced back to the specific commit hash from which it was built. It is a transparent and easy way to track changes and modifications across different versions of the SDK. ## How to Check Version: - **Server Version**: Use the command `imctl version`. - **Client Version**: Execute the command `go run main.go version`. ## SDK Versioning: 1. **Traditional SDK Versioning**: The standard method of versioning that uses Major, Minor, and Patch numbers. 2. **Client-Represented Versioning**: This is primarily managed through the Go versioning system. It helps in understanding the compatibility and dependencies. ## Code for Version Management: ### Utility to Compare Version Strings: This function compares two version strings that follow the OpenIM versioning pattern. ``` goCopy codefunc CompareOpenIMAwareVersionStrings(v1, v2 string) int { ... } ``` ### Information Structure for Version: This struct contains various version-related information, making it easy to understand and process the build details. ``` goCopy codetype Info struct { ... } func (info Info) String() string { ... } func Get() Info { ... } ``` ## Conclusion: Effective version management is crucial for the growth and stability of any SDK. With OpenIM SDK's approach, users can be confident about the build's origin and its compatibility. The code snippets provided above can be utilized to integrate this versioning mechanism into any project seamlessly. ------ Hope this helps!