version

package
v3.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

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!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenIMVersionRegex = regexp.MustCompile("^v([\\d]+)(?:(alpha|beta)([\\d]+))?$")

Functions

func CompareOpenIMAwareVersionStrings

func CompareOpenIMAwareVersionStrings(v1, v2 string) int

CompareOpenIMAwareVersionStrings compares two OpenIM-like version strings. OpenIM-like version strings are starting with a v, followed by a major version, optional "alpha" or "beta" strings followed by a minor version (e.g. v1, v2beta1). Versions will be sorted based on GA/alpha/beta first and then major and minor versions. e.g. v2, v1, v1beta2, v1beta1, v1alpha1.

Types

type Info

type Info struct {
	Major        string `json:"major"`
	Minor        string `json:"minor"`
	GitVersion   string `json:"gitVersion"`
	GitCommit    string `json:"gitCommit"`
	GitTreeState string `json:"gitTreeState"`
	BuildDate    string `json:"buildDate"`
	GoVersion    string `json:"goVersion"`
	Compiler     string `json:"compiler"`
	Platform     string `json:"platform"`
}

Info contains versioning information. TODO: Add []string of api versions supported? It's still unclear how we'll want to distribute that information.

func Get

func Get() Info

Get returns the overall codebase version. It's for detecting what code a binary was built from.

func (Info) String

func (info Info) String() string

String returns info as a human-friendly version string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL