v1.0.6
This commit is contained in:
1 parent
7ccd84cd96
commit
f96ab6054d
22 files changed
+2815
-32
No files matched your search
@@ -7,14 +7,10 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
)
|
||||
|
||||
// Supported DE version is selected during SDK generation.
|
||||
const (
|
||||
supportedSDKMajor = 1
|
||||
|
||||
supportedDEMajor = 1
|
||||
supportedDEMinor = 8
|
||||
)
|
||||
@@ -42,26 +38,11 @@ func (c *Client) CheckCompatibility(ctx context.Context) error {
|
||||
return fmt.Errorf("token is not set")
|
||||
}
|
||||
|
||||
return c.checkCompatibility(ctx, core.SDKVersion())
|
||||
}
|
||||
|
||||
func (c *Client) checkCompatibility(ctx context.Context, sdkVersion string) error {
|
||||
if ctx == nil {
|
||||
return fmt.Errorf("nil context")
|
||||
}
|
||||
|
||||
deployment, err := c.DeDeployment.Get(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get DE version: %w", err)
|
||||
}
|
||||
|
||||
if sdkVersion != "devel" {
|
||||
sdkMajor, _, ok := versionMajorMinor(sdkVersion)
|
||||
if !ok || sdkMajor != supportedSDKMajor {
|
||||
return fmt.Errorf("incompatible SDK version %q: expected %d.x.x", sdkVersion, supportedSDKMajor)
|
||||
}
|
||||
}
|
||||
|
||||
deMajor, deMinor, ok := versionMajorMinor(deployment.ReleaseVersion)
|
||||
if !ok || deMajor != supportedDEMajor || deMinor != supportedDEMinor {
|
||||
return fmt.Errorf("incompatible DE version %q: expected %d.%d.x", deployment.ReleaseVersion, supportedDEMajor, supportedDEMinor)
|
||||
|
||||
Reference in new issue
Block a user