From d95b1e15d18d66f514d07bbbed75d61a45cac058 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 03:01:10 +0000 Subject: [PATCH 1/4] Bump golang.org/x/sys from 0.22.0 to 0.23.0 in the all group Bumps the all group with 1 update: [golang.org/x/sys](https://github.com/golang/sys). Updates `golang.org/x/sys` from 0.22.0 to 0.23.0 - [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 51fab7a0..cc44b007 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/essentialkaos/depsy v1.3.0 github.com/essentialkaos/go-linenoise/v3 v3.6.0 golang.org/x/crypto v0.25.0 - golang.org/x/sys v0.22.0 + golang.org/x/sys v0.23.0 ) require ( diff --git a/go.sum b/go.sum index b0ed1b35..6c07e10c 100644 --- a/go.sum +++ b/go.sum @@ -15,5 +15,5 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 79373be27007f1a465de371a8e2c861160524f61 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 02:36:01 +0000 Subject: [PATCH 2/4] Bump the all group across 1 directory with 2 updates Bumps the all group with 2 updates in the / directory: [golang.org/x/crypto](https://github.com/golang/crypto) and [golang.org/x/sys](https://github.com/golang/sys). Updates `golang.org/x/crypto` from 0.25.0 to 0.26.0 - [Commits](https://github.com/golang/crypto/compare/v0.25.0...v0.26.0) Updates `golang.org/x/sys` from 0.23.0 to 0.24.0 - [Commits](https://github.com/golang/sys/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index cc44b007..cbf4c0ce 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/essentialkaos/check v1.4.0 github.com/essentialkaos/depsy v1.3.0 github.com/essentialkaos/go-linenoise/v3 v3.6.0 - golang.org/x/crypto v0.25.0 - golang.org/x/sys v0.23.0 + golang.org/x/crypto v0.26.0 + golang.org/x/sys v0.24.0 ) require ( diff --git a/go.sum b/go.sum index 6c07e10c..df0bdc87 100644 --- a/go.sum +++ b/go.sum @@ -13,7 +13,7 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From a4eb10bda52cfaaa3d307617dc5b2f19a6a154ba Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 12 Aug 2024 01:22:27 +0300 Subject: [PATCH 3/4] [support/apps] Add support for Docker, Podman, and LXC --- CHANGELOG.md | 4 ++++ cache/fs/fs.go | 8 ++++++++ go.mod | 2 +- support/apps/apps.go | 18 ++++++++++++++++++ version.go | 2 +- 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c897f6d..81933007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### [13.3.2](https://kaos.sh/ek/13.3.2) + +- `[support/apps]` Added support for Docker, Podman, and LXC + ### [13.3.1](https://kaos.sh/ek/13.3.1) - `[cache]` Added constants with duration diff --git a/cache/fs/fs.go b/cache/fs/fs.go index b2083e7a..549fbc47 100644 --- a/cache/fs/fs.go +++ b/cache/fs/fs.go @@ -271,6 +271,14 @@ func (c Config) Validate() error { // ////////////////////////////////////////////////////////////////////////////////// // +// func encodeItem(item any) ([]byte, error) { +// return nil, nil +// } + +// func decodeItem() ([]byte, error) { +// return nil, nil +// } + // getItemPath returns path to cache item func (c *Cache) getItemPath(key string, temporary bool) string { if temporary { diff --git a/go.mod b/go.mod index 51fab7a0..2137c923 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/essentialkaos/ek/v13 -go 1.18 +go 1.21 require ( github.com/essentialkaos/check v1.4.0 diff --git a/support/apps/apps.go b/support/apps/apps.go index 00cf2424..779afa06 100644 --- a/support/apps/apps.go +++ b/support/apps/apps.go @@ -116,6 +116,24 @@ func SVN() support.App { return support.App{"svn", ver} } +// Docker extracts version info from Docker command output +func Docker() support.App { + ver := extractField(execVersionCmd("docker", "--version"), 0, 2) + return support.App{"docker", ver} +} + +// Podman extracts version info from Podman command output +func Podman() support.App { + ver := extractField(execVersionCmd("podman", "--version"), 0, 2) + return support.App{"podman", ver} +} + +// LXC extracts version info from LXC command output +func LXC() support.App { + ver := extractField(execVersionCmd("lxc", "--version"), 0, 0) + return support.App{"lxc", ver} +} + // ////////////////////////////////////////////////////////////////////////////////// // // execVersionCmd execs command and returns output as a string diff --git a/version.go b/version.go index 065e0a4b..feb300e1 100644 --- a/version.go +++ b/version.go @@ -8,4 +8,4 @@ package ek // ////////////////////////////////////////////////////////////////////////////////// // // VERSION is current ek package version -const VERSION = "13.3.1" +const VERSION = "13.3.2" From 51b54259a1bc2e8f8b631710670f41431fa7e017 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 12 Aug 2024 01:34:47 +0300 Subject: [PATCH 4/4] [rand] Remove method 'Int' + Code refactoring --- CHANGELOG.md | 2 ++ rand/rand.go | 14 ++++---------- rand/rand_test.go | 11 ----------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81933007..ba0dbe06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### [13.3.2](https://kaos.sh/ek/13.3.2) - `[support/apps]` Added support for Docker, Podman, and LXC +- `[rand]` Removed method `Int` +- `[rand]` Code refactoring ### [13.3.1](https://kaos.sh/ek/13.3.1) diff --git a/rand/rand.go b/rand/rand.go index 2b2d053f..88a3993a 100644 --- a/rand/rand.go +++ b/rand/rand.go @@ -25,35 +25,29 @@ func String(length int) string { return "" } + rnd := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) symbolsLength := len(symbols) result := make([]byte, length) - rand.Seed(time.Now().UTC().UnixNano()) - for i := 0; i < length; i++ { - result[i] = symbols[rand.Intn(symbolsLength)] + result[i] = symbols[rnd.Intn(symbolsLength)] } return string(result) } -// Int returns random int -func Int(n int) int { - rand.Seed(time.Now().UTC().UnixNano()) - return rand.Intn(n) -} - // Slice returns slice with random chars func Slice(length int) []string { if length == 0 { return []string{} } + rnd := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) symbolsLength := len(symbols) result := make([]string, length) for i := 0; i < length; i++ { - result[i] = string(symbols[rand.Intn(symbolsLength)]) + result[i] = string(symbols[rnd.Intn(symbolsLength)]) } return result diff --git a/rand/rand_test.go b/rand/rand_test.go index 0c0eb000..6dfcd24b 100644 --- a/rand/rand_test.go +++ b/rand/rand_test.go @@ -33,17 +33,6 @@ func (s *RandSuite) TestString(c *C) { c.Assert(len(String(-100)), Equals, 0) } -func (s *RandSuite) TestInt(c *C) { - n := 1000 - k := 0 - - for i := 0; i < 1000; i++ { - k += Int(n) - } - - c.Assert(k/n, Not(Equals), n) -} - func (s *RandSuite) TestSlice(c *C) { t1 := strings.Join(Slice(256), "") t2 := strings.Join(Slice(256), "")