From 0f080e27dbe5a1c8bfa4c282ddf31abe4040fc87 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Mon, 10 Feb 2025 10:53:46 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20soft-deprecate=20semver=20in=20f?= =?UTF-8?q?avor=20of=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The soft part of this deprecation is that we don't show a deprecation warning anywhere at all. So semver is still technically included, since we released it in v9.x, but we will deprecate it formally with the next major release. --- cli/printer/mql.go | 2 +- llx/builtin.go | 60 +++++++++---------- llx/builtin_global.go | 23 +++---- llx/{builtin_semver.go => builtin_version.go} | 30 +++++----- llx/data_conversions.go | 6 +- llx/data_conversions_test.go | 8 +-- llx/rawdata_test.go | 6 +- mqlc/builtin.go | 2 +- mqlc/typemaps.go | 17 +++--- providers/core/resources/mql_test.go | 58 +++++++++--------- types/types.go | 8 +-- 11 files changed, 113 insertions(+), 107 deletions(-) rename llx/{builtin_semver.go => builtin_version.go} (66%) diff --git a/cli/printer/mql.go b/cli/printer/mql.go index f27c04ad25..5d9ab3a1cb 100644 --- a/cli/printer/mql.go +++ b/cli/printer/mql.go @@ -698,7 +698,7 @@ func (print *Printer) Data(typ types.Type, data interface{}, codeID string, bund case types.Block: return print.refMap(typ, data.(map[string]interface{}), codeID, bundle, indent) - case types.Semver: + case types.Version: return print.Secondary(data.(string)) case types.ArrayLike: diff --git a/llx/builtin.go b/llx/builtin.go index a9bda7461b..41d569db55 100644 --- a/llx/builtin.go +++ b/llx/builtin.go @@ -267,8 +267,8 @@ func init() { string("!=" + types.Float): {f: stringNotFloatV2, Label: "!="}, string("==" + types.Dict): {f: stringCmpDictV2, Label: "=="}, string("!=" + types.Dict): {f: stringNotDictV2, Label: "!="}, - string("==" + types.Semver): {f: semverCmpSemver, Label: "=="}, - string("!=" + types.Semver): {f: semverNotSemver, Label: "!="}, + string("==" + types.Version): {f: versionCmpVersion, Label: "=="}, + string("!=" + types.Version): {f: versionNotVersion, Label: "!="}, string("==" + types.ArrayLike): {f: chunkEqFalseV2, Label: "=="}, string("!=" + types.ArrayLike): {f: chunkNeqTrueV2, Label: "!="}, string("==" + types.Array(types.String)): {f: stringCmpStringarrayV2, Label: "=="}, @@ -295,10 +295,10 @@ func init() { string("<=" + types.Dict): {f: stringLTEDictV2, Label: "<="}, string(">" + types.Dict): {f: stringGTDictV2, Label: ">"}, string(">=" + types.Dict): {f: stringGTEDictV2, Label: ">="}, - string("<" + types.Semver): {f: semverLTsemver, Label: "<"}, - string(">" + types.Semver): {f: semverGTsemver, Label: ">"}, - string("<=" + types.Semver): {f: semverLTEsemver, Label: "<="}, - string(">=" + types.Semver): {f: semverGTEsemver, Label: ">="}, + string("<" + types.Version): {f: versionLTversion, Label: "<"}, + string(">" + types.Version): {f: versionGTversion, Label: ">"}, + string("<=" + types.Version): {f: versionLTEversion, Label: "<="}, + string(">=" + types.Version): {f: versionGTEversion, Label: ">="}, string("&&" + types.Bool): {f: stringAndBoolV2, Label: "&&"}, string("||" + types.Bool): {f: stringOrBoolV2, Label: "||"}, string("&&" + types.Int): {f: stringAndIntV2, Label: "&&"}, @@ -461,8 +461,8 @@ func init() { string("!=" + types.String): {f: dictNotStringV2, Label: "!="}, string("==" + types.Regex): {f: dictCmpRegexV2, Label: "=="}, string("!=" + types.Regex): {f: dictNotRegexV2, Label: "!="}, - string("==" + types.Semver): {f: semverCmpSemver, Label: "=="}, - string("!=" + types.Semver): {f: semverNotSemver, Label: "!="}, + string("==" + types.Version): {f: versionCmpVersion, Label: "=="}, + string("!=" + types.Version): {f: versionNotVersion, Label: "!="}, string("==" + types.ArrayLike): {f: dictCmpArrayV2, Label: "=="}, string("!=" + types.ArrayLike): {f: dictNotArrayV2, Label: "!="}, string("==" + types.Array(types.String)): {f: dictCmpStringarrayV2, Label: "=="}, @@ -491,10 +491,10 @@ func init() { string("<=" + types.Dict): {f: dictLTEDictV2, Label: "<="}, string(">" + types.Dict): {f: dictGTDictV2, Label: ">"}, string(">=" + types.Dict): {f: dictGTEDictV2, Label: ">="}, - string("<" + types.Semver): {f: semverLTsemver, Label: "<"}, - string(">" + types.Semver): {f: semverGTsemver, Label: ">"}, - string("<=" + types.Semver): {f: semverLTEsemver, Label: "<="}, - string(">=" + types.Semver): {f: semverGTEsemver, Label: ">="}, + string("<" + types.Version): {f: versionLTversion, Label: "<"}, + string(">" + types.Version): {f: versionGTversion, Label: ">"}, + string("<=" + types.Version): {f: versionLTEversion, Label: "<="}, + string(">=" + types.Version): {f: versionGTEversion, Label: ">="}, string("&&" + types.Bool): {f: dictAndBoolV2, Label: "&&"}, string("||" + types.Bool): {f: dictOrBoolV2, Label: "||"}, string("&&" + types.Int): {f: dictAndIntV2, Label: "&&"}, @@ -565,24 +565,24 @@ func init() { // We have not yet decided if and how these may be exposed to users "notEmpty": {f: dictNotEmptyV2}, }, - types.Semver: { - string("==" + types.Nil): {f: stringCmpNilV2, Label: "=="}, - string("!=" + types.Nil): {f: stringNotNilV2, Label: "!="}, - string("==" + types.Empty): {f: stringCmpEmptyV2, Label: "=="}, - string("!=" + types.Empty): {f: stringNotEmptyV2, Label: "!="}, - string("==" + types.Semver): {f: semverCmpSemver, Label: "=="}, - string("!=" + types.Semver): {f: semverNotSemver, Label: "!="}, - string("<" + types.Semver): {f: semverLTsemver, Label: "<"}, - string(">" + types.Semver): {f: semverGTsemver, Label: ">"}, - string("<=" + types.Semver): {f: semverLTEsemver, Label: "<="}, - string(">=" + types.Semver): {f: semverGTEsemver, Label: ">="}, - string("==" + types.String): {f: semverCmpSemver, Label: "=="}, - string("!=" + types.String): {f: semverNotSemver, Label: "!="}, - string("<" + types.String): {f: semverLTsemver, Label: "<"}, - string(">" + types.String): {f: semverGTsemver, Label: ">"}, - string("<=" + types.String): {f: semverLTEsemver, Label: "<="}, - string(">=" + types.String): {f: semverGTEsemver, Label: ">="}, - "epoch": {f: semverEpoch}, + types.Version: { + string("==" + types.Nil): {f: stringCmpNilV2, Label: "=="}, + string("!=" + types.Nil): {f: stringNotNilV2, Label: "!="}, + string("==" + types.Empty): {f: stringCmpEmptyV2, Label: "=="}, + string("!=" + types.Empty): {f: stringNotEmptyV2, Label: "!="}, + string("==" + types.Version): {f: versionCmpVersion, Label: "=="}, + string("!=" + types.Version): {f: versionNotVersion, Label: "!="}, + string("<" + types.Version): {f: versionLTversion, Label: "<"}, + string(">" + types.Version): {f: versionGTversion, Label: ">"}, + string("<=" + types.Version): {f: versionLTEversion, Label: "<="}, + string(">=" + types.Version): {f: versionGTEversion, Label: ">="}, + string("==" + types.String): {f: versionCmpVersion, Label: "=="}, + string("!=" + types.String): {f: versionNotVersion, Label: "!="}, + string("<" + types.String): {f: versionLTversion, Label: "<"}, + string(">" + types.String): {f: versionGTversion, Label: ">"}, + string("<=" + types.String): {f: versionLTEversion, Label: "<="}, + string(">=" + types.String): {f: versionGTEversion, Label: ">="}, + "epoch": {f: versionEpoch}, }, types.ArrayLike: { "[]": {f: arrayGetIndexV2}, diff --git a/llx/builtin_global.go b/llx/builtin_global.go index 775137a46c..2a1edf18cb 100644 --- a/llx/builtin_global.go +++ b/llx/builtin_global.go @@ -38,13 +38,16 @@ func init() { "return": returnCallV2, "createResource": globalCreateResource, // type-conversions - "string": stringCall, - "$regex": regexCall, // TODO: support both the regex resource and the internal typemap! - "float": floatCall, - "int": intCall, - "bool": boolCall, - "dict": dictCall, - "semver": semverCall, + "string": stringCall, + "$regex": regexCall, // TODO: support both the regex resource and the internal typemap! + "float": floatCall, + "int": intCall, + "bool": boolCall, + "dict": dictCall, + "version": versionCall, + // FIXME: DEPRECATED, remove in v13.0 vv + "semver": versionCall, // deprecated + // ^^ } } @@ -193,9 +196,9 @@ func typeofCallV2(e *blockExecutor, f *Function, ref uint64) (*RawData, uint64, return StringData(res.Type.Label()), 0, nil } -func semverCall(e *blockExecutor, f *Function, ref uint64) (*RawData, uint64, error) { +func versionCall(e *blockExecutor, f *Function, ref uint64) (*RawData, uint64, error) { if len(f.Args) != 1 { - return nil, 0, errors.New("Called `semver` with " + strconv.Itoa(len(f.Args)) + " arguments, expected one") + return nil, 0, errors.New("Called `version` with " + strconv.Itoa(len(f.Args)) + " arguments, expected one") } res, dref, err := e.resolveValue(f.Args[0], ref) @@ -203,7 +206,7 @@ func semverCall(e *blockExecutor, f *Function, ref uint64) (*RawData, uint64, er return res, dref, err } - return &RawData{Type: types.Semver, Value: res.Value}, 0, nil + return &RawData{Type: types.Version, Value: res.Value}, 0, nil } func stringCall(e *blockExecutor, f *Function, ref uint64) (*RawData, uint64, error) { diff --git a/llx/builtin_semver.go b/llx/builtin_version.go similarity index 66% rename from llx/builtin_semver.go rename to llx/builtin_version.go index 39de0f08b7..a9b705ed8c 100644 --- a/llx/builtin_semver.go +++ b/llx/builtin_version.go @@ -80,59 +80,59 @@ func (v Version) Compare(o Version) int { return v.Version.Compare(o.Version) } -func semverLT(left interface{}, right interface{}) *RawData { +func versionLT(left interface{}, right interface{}) *RawData { l := NewVersion(left.(string)) r := NewVersion(right.(string)) return BoolData(l.Compare(r) < 0) } -func semverGT(left interface{}, right interface{}) *RawData { +func versionGT(left interface{}, right interface{}) *RawData { l := NewVersion(left.(string)) r := NewVersion(right.(string)) return BoolData(l.Compare(r) > 0) } -func semverLTE(left interface{}, right interface{}) *RawData { +func versionLTE(left interface{}, right interface{}) *RawData { l := NewVersion(left.(string)) r := NewVersion(right.(string)) return BoolData(l.Compare(r) <= 0) } -func semverGTE(left interface{}, right interface{}) *RawData { +func versionGTE(left interface{}, right interface{}) *RawData { l := NewVersion(left.(string)) r := NewVersion(right.(string)) return BoolData(l.Compare(r) >= 0) } -func semverCmpSemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { +func versionCmpVersion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, func(left, right interface{}) *RawData { return BoolData(left.(string) == right.(string)) }) } -func semverNotSemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { +func versionNotVersion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, func(left, right interface{}) *RawData { return BoolData(left.(string) != right.(string)) }) } -func semverLTsemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { - return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, semverLT) +func versionLTversion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { + return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, versionLT) } -func semverGTsemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { - return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, semverGT) +func versionGTversion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { + return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, versionGT) } -func semverLTEsemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { - return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, semverLTE) +func versionLTEversion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { + return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, versionLTE) } -func semverGTEsemver(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { - return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, semverGTE) +func versionGTEversion(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { + return nonNilDataOpV2(e, bind, chunk, ref, types.Bool, versionGTE) } -func semverEpoch(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { +func versionEpoch(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { if bind.Value == nil { return &RawData{Type: types.Int, Error: bind.Error}, 0, nil } diff --git a/llx/data_conversions.go b/llx/data_conversions.go index 5a15f2f029..567aa28c70 100644 --- a/llx/data_conversions.go +++ b/llx/data_conversions.go @@ -39,7 +39,7 @@ func init() { types.Score: score2result, types.Empty: empty2result, types.Block: block2result, - types.Semver: string2result, + types.Version: string2result, types.ArrayLike: array2result, types.MapLike: map2result, types.ResourceLike: resource2result, @@ -60,7 +60,7 @@ func init() { types.Score: pscore2raw, types.Empty: pempty2raw, types.Block: pblock2rawV2, - types.Semver: pstring2raw, + types.Version: pstring2raw, types.ArrayLike: parray2raw, types.MapLike: pmap2raw, types.ResourceLike: presource2raw, @@ -189,7 +189,7 @@ func string2result(value interface{}, typ types.Type) (*Primitive, error) { return nil, errInvalidConversion(value, typ) } p := StringPrimitive(v) - // special case for semver + // special case for version p.Type = string(typ) return p, nil } diff --git a/llx/data_conversions_test.go b/llx/data_conversions_test.go index 79521da9f9..804d5295db 100644 --- a/llx/data_conversions_test.go +++ b/llx/data_conversions_test.go @@ -11,10 +11,10 @@ import ( "go.mondoo.com/cnquery/v11/types" ) -func TestSemver_Conversions(t *testing.T) { +func TestVersion_Conversions(t *testing.T) { sv := llx.StringPrimitive("1.2.3") - sv.Type = string(types.Semver) + sv.Type = string(types.Version) rd := sv.RawData() - require.NoError(t, rd.Error, "no error converting semver to raw data") - require.Equal(t, "1.2.3", rd.Value, "semver to raw data is the same") + require.NoError(t, rd.Error, "no error converting version to raw data") + require.Equal(t, "1.2.3", rd.Value, "version to raw data is the same") } diff --git a/llx/rawdata_test.go b/llx/rawdata_test.go index 54df049890..f146944d4b 100644 --- a/llx/rawdata_test.go +++ b/llx/rawdata_test.go @@ -212,9 +212,9 @@ func TestRawData_JSON(t *testing.T) { } } -func TestRawData_Semver_Result(t *testing.T) { - d := &RawData{Type: types.Semver, Value: "1.2.3"} +func TestRawData_Version_Result(t *testing.T) { + d := &RawData{Type: types.Version, Value: "1.2.3"} r := d.Result() - assert.Equal(t, string(types.Semver), r.Data.Type) + assert.Equal(t, string(types.Version), r.Data.Type) assert.EqualValues(t, "1.2.3", r.Data.Value) } diff --git a/mqlc/builtin.go b/mqlc/builtin.go index ed0d929573..3a63173949 100644 --- a/mqlc/builtin.go +++ b/mqlc/builtin.go @@ -96,7 +96,7 @@ func init() { "keys": {typ: stringArrayType, signature: FunctionSignature{}}, "values": {typ: dictArrayType, signature: FunctionSignature{}}, }, - types.Semver: { + types.Version: { "epoch": {typ: intType, signature: FunctionSignature{}}, }, types.ArrayLike: { diff --git a/mqlc/typemaps.go b/mqlc/typemaps.go index a3831ed46d..57a34cac42 100644 --- a/mqlc/typemaps.go +++ b/mqlc/typemaps.go @@ -15,13 +15,16 @@ var typeConversions map[string]fieldCompiler func init() { typeConversions = map[string]fieldCompiler{ - "bool": compileTypeConversion("bool", types.Bool), - "int": compileTypeConversion("int", types.Int), - "float": compileTypeConversion("float", types.Float), - "string": compileTypeConversion("string", types.String), - "regex": compileTypeConversion("$regex", types.Regex), - "dict": compileTypeConversion("dict", types.Dict), - "semver": compileTypeConversion("semver", types.Semver), + "bool": compileTypeConversion("bool", types.Bool), + "int": compileTypeConversion("int", types.Int), + "float": compileTypeConversion("float", types.Float), + "string": compileTypeConversion("string", types.String), + "regex": compileTypeConversion("$regex", types.Regex), + "dict": compileTypeConversion("dict", types.Dict), + "version": compileTypeConversion("version", types.Version), + // FIXME: DEPRECATED, remove in v13.0 vv + "semver": compileTypeConversion("semver", types.Version), // deprecated + // } } diff --git a/providers/core/resources/mql_test.go b/providers/core/resources/mql_test.go index 71b63d3bb0..471bde0722 100644 --- a/providers/core/resources/mql_test.go +++ b/providers/core/resources/mql_test.go @@ -863,27 +863,27 @@ func TestTime(t *testing.T) { }) } -func TestSemver(t *testing.T) { - t.Run("regular semver", func(t *testing.T) { +func TestVersion(t *testing.T) { + t.Run("regular version", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('1.2.3') == semver('1.2.3')", + Code: "version('1.2.3') == version('1.2.3')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('1.2.3') == semver('1.2')", + Code: "version('1.2.3') == version('1.2')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('1.2') < semver('1.10.2')", + Code: "version('1.2') < version('1.10.2')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('1.10') >= semver('1.2.3')", + Code: "version('1.10') >= version('1.2.3')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('1.10') >= '1.2'", + Code: "version('1.10') >= '1.2'", ResultIndex: 2, Expectation: true, }, }) @@ -892,27 +892,27 @@ func TestSemver(t *testing.T) { t.Run("one-sided epoch", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('1.2.3') == semver('1:1.2.3')", + Code: "version('1.2.3') == version('1:1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('2:1.2.3') == semver('1.2.3')", + Code: "version('2:1.2.3') == version('1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('3:1.2') < semver('1.10.2')", + Code: "version('3:1.2') < version('1.10.2')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('1.10') >= semver('4:1.2.3')", + Code: "version('1.10') >= version('4:1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('1.2') <= semver('3:1.10.2')", + Code: "version('1.2') <= version('3:1.10.2')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('4:1.10') > semver('1.2.3')", + Code: "version('4:1.10') > version('1.2.3')", ResultIndex: 2, Expectation: true, }, }) @@ -921,11 +921,11 @@ func TestSemver(t *testing.T) { t.Run("deb/rpm epochs", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('1.2.3').epoch", + Code: "version('1.2.3').epoch", ResultIndex: 0, Expectation: int64(0), }, { - Code: "semver('7:1.2.3').epoch", + Code: "version('7:1.2.3').epoch", ResultIndex: 0, Expectation: int64(7), }, }) @@ -934,11 +934,11 @@ func TestSemver(t *testing.T) { t.Run("python epochs", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('1.2.3').epoch", + Code: "version('1.2.3').epoch", ResultIndex: 0, Expectation: int64(0), }, { - Code: "semver('5!1.2.3').epoch", + Code: "version('5!1.2.3').epoch", ResultIndex: 0, Expectation: int64(5), }, }) @@ -947,52 +947,52 @@ func TestSemver(t *testing.T) { t.Run("different epochs", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('2:1.2.3') == semver('1:1.2.3')", + Code: "version('2:1.2.3') == version('1:1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('2:1.2.3') == semver('3:1.2.3')", + Code: "version('2:1.2.3') == version('3:1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('3:1.2') < semver('1:1.10.2')", + Code: "version('3:1.2') < version('1:1.10.2')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('2:1.10') >= semver('4:1.2.3')", + Code: "version('2:1.10') >= version('4:1.2.3')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('2:1.2') <= semver('3:1.0.2')", + Code: "version('2:1.2') <= version('3:1.0.2')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('4:1.1') > semver('1:1.2.3')", + Code: "version('4:1.1') > version('1:1.2.3')", ResultIndex: 2, Expectation: true, }, }) }) - t.Run("semver with equal epochs", func(t *testing.T) { + t.Run("version with equal epochs", func(t *testing.T) { x.TestSimple(t, []testutils.SimpleTest{ { - Code: "semver('1:1.2.3') == semver('1:1.2.3')", + Code: "version('1:1.2.3') == version('1:1.2.3')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('2:1.2.3') == semver('2:1.2')", + Code: "version('2:1.2.3') == version('2:1.2')", ResultIndex: 2, Expectation: false, }, { - Code: "semver('3:1.2') < semver('3:1.10.2')", + Code: "version('3:1.2') < version('3:1.10.2')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('4:1.10') >= semver('4:1.2.3')", + Code: "version('4:1.10') >= version('4:1.2.3')", ResultIndex: 2, Expectation: true, }, { - Code: "semver('5:1.10') >= '5:1.2'", + Code: "version('5:1.10') >= '5:1.2'", ResultIndex: 2, Expectation: true, }, }) diff --git a/types/types.go b/types/types.go index 6b0079456d..ee2bb8ceb2 100644 --- a/types/types.go +++ b/types/types.go @@ -47,7 +47,7 @@ const ( byteScore byteBlock byteEmpty - byteSemver + byteVersion byteArray = 1<<4 + iota - 6 // set to 25 to avoid breaking changes byteMap byteResource @@ -88,8 +88,8 @@ const ( Block = Type(rune(byteBlock)) // Empty value Empty = Type(rune(byteEmpty)) - // Semver value - Semver = Type(rune(byteSemver)) + // Version value + Version = Type(rune(byteVersion)) // ArrayLike is the underlying type of all arrays ArrayLike = Type(rune(byteArray)) // MapLike is the underlying type of all maps @@ -258,7 +258,7 @@ var labels = map[byte]string{ byteScore: "score", byteBlock: "block", byteEmpty: "empty", - byteSemver: "semver", + byteVersion: "version", byteStringSlice: "stringslice", byteRange: "range", }