diff --git a/.github/workflows/push-pr-lint.yaml b/.github/workflows/push-pr-lint.yaml index 80023be3b..64c688aa1 100644 --- a/.github/workflows/push-pr-lint.yaml +++ b/.github/workflows/push-pr-lint.yaml @@ -14,7 +14,10 @@ jobs: go-version-file: go.mod - name: Run golangci-lint - run: make golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + args: --config .golangci.yml --timeout 2m + version: v1.61.0 - name: Check go generated files run: make check-go-generated diff --git a/.golangci.yml b/.golangci.yml index 811246814..75dce94f0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -41,52 +41,49 @@ linters: # Comments help explain why its disabled or point at ones we should not disable but will take a little work # If its not commented its likely because its just too annoying or we don't find useful disable: - - copyloopvar # requires go >=1.22 - cyclop - - deadcode # deprecated - depguard - errname # maybe should be enabled - - exhaustivestruct # deprecated + - execinquery - exhaustruct + - exportloopref - forbidigo - funlen + - gci - gochecknoglobals - gochecknoinits - gocognit - goconst - godot - godox - - golint # deprecated - gomnd - - ifshort # deprecated - inamedparam - interfacebloat - - interfacer # deprecated - - intrange # requires go >=1.22 - ireturn # should be enabled, ironlib needs some changes + - intrange - lll # not previously enabled, ironlib and mctl both fail this - - maligned # deprecated + - mnd - nestif - nilnil - nlreturn - nolintlint - - nonamedreturns # should be enabled, probably - - nosnakecase # deprecated + - nonamedreturns # FIXME: named returns are unmaintainable - paralleltest - perfsprint - - scopelint # deprecated - - structcheck # deprecated - tagliatelle - tenv # should be enabled - testpackage - testifylint # should be enabled - thelper # should be enabled - - varcheck # deprecated - varnamelen - wrapcheck - wsl issues: + exclude-files: + - ".*_test\\.go" + exclude-dirs: + - fixtures exclude-rules: - linters: - stylecheck diff --git a/Makefile b/Makefile index b658411d1..158c8050b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ lint: golangci-lint check-go-generated ## Run golangci-lint golangci-lint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57 golangci-lint run --config .golangci.yml ## Run go generate diff --git a/actions/dynamic.go b/actions/dynamic.go index e6e3c9acd..66994501a 100644 --- a/actions/dynamic.go +++ b/actions/dynamic.go @@ -3,7 +3,8 @@ package actions import ( "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/metal-toolbox/ironlib/utils" ) diff --git a/actions/interface.go b/actions/interface.go index 52d647499..0f5b9c27f 100644 --- a/actions/interface.go +++ b/actions/interface.go @@ -3,10 +3,11 @@ package actions import ( "context" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/sirupsen/logrus" ) // DeviceManager interface is returned to the caller when calling ironlib.New() diff --git a/actions/inventory.go b/actions/inventory.go index bfec88444..90da2dfb1 100644 --- a/actions/inventory.go +++ b/actions/inventory.go @@ -8,13 +8,14 @@ import ( "slices" "strings" - "github.com/bmc-toolbox/common" - "github.com/metal-toolbox/ironlib/firmware" - "github.com/metal-toolbox/ironlib/model" - "github.com/metal-toolbox/ironlib/utils" + common "github.com/metal-toolbox/bmc-common" "github.com/pkg/errors" "github.com/r3labs/diff/v3" "github.com/sirupsen/logrus" + + "github.com/metal-toolbox/ironlib/firmware" + "github.com/metal-toolbox/ironlib/model" + "github.com/metal-toolbox/ironlib/utils" ) var ( @@ -840,7 +841,6 @@ func (a *InventoryCollectorAction) vetChanges(changes diff.Changelog) diff.Chang for _, change := range changes { // Skip changes that delete items - change := change if a.acceptChange(&change) { accepted = append(accepted, change) } diff --git a/actions/inventory_test.go b/actions/inventory_test.go index 603d6ed58..96bb1e0ab 100644 --- a/actions/inventory_test.go +++ b/actions/inventory_test.go @@ -6,13 +6,14 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/sirupsen/logrus/hooks/test" + "github.com/stretchr/testify/assert" + dellFixtures "github.com/metal-toolbox/ironlib/fixtures/dell" smcFixtures "github.com/metal-toolbox/ironlib/fixtures/supermicro" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/sirupsen/logrus/hooks/test" - "github.com/stretchr/testify/assert" ) func Test_Inventory_dell(t *testing.T) { diff --git a/actions/storage_controller.go b/actions/storage_controller.go index cadfdfcc1..a99976082 100644 --- a/actions/storage_controller.go +++ b/actions/storage_controller.go @@ -5,11 +5,12 @@ import ( "fmt" "strings" - "github.com/bmc-toolbox/common" - "github.com/metal-toolbox/ironlib/model" - "github.com/metal-toolbox/ironlib/utils" + common "github.com/metal-toolbox/bmc-common" "github.com/pkg/errors" "github.com/sirupsen/logrus" + + "github.com/metal-toolbox/ironlib/model" + "github.com/metal-toolbox/ironlib/utils" ) var ErrVirtualDiskManagerUtilNotIdentified = errors.New("virtual disk management utility not identifed") diff --git a/actions/update.go b/actions/update.go index a1cf467b0..a12673369 100644 --- a/actions/update.go +++ b/actions/update.go @@ -4,11 +4,12 @@ import ( "context" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" ) var ( diff --git a/device.go b/device.go index 160f5b4a6..7bde1403f 100644 --- a/device.go +++ b/device.go @@ -3,7 +3,10 @@ package ironlib import ( "fmt" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/providers/asrockrack" @@ -11,8 +14,6 @@ import ( "github.com/metal-toolbox/ironlib/providers/generic" "github.com/metal-toolbox/ironlib/providers/supermicro" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // New returns a device Manager interface based on the hardware deviceVendor, model attributes diff --git a/examples/diskwipe/main.go b/examples/diskwipe/main.go index 2a8075fab..f2825b4fc 100644 --- a/examples/diskwipe/main.go +++ b/examples/diskwipe/main.go @@ -6,11 +6,12 @@ import ( "strings" "time" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib" "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/utils" - "github.com/sirupsen/logrus" ) var ( diff --git a/examples/firmware-install/firmware-install.go b/examples/firmware-install/firmware-install.go index ce2e566ea..e6d0305d9 100644 --- a/examples/firmware-install/firmware-install.go +++ b/examples/firmware-install/firmware-install.go @@ -4,10 +4,11 @@ import ( "context" "fmt" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib" "github.com/metal-toolbox/ironlib/model" - "github.com/sirupsen/logrus" ) // This example invokes ironlib to install the supermicro BMC firmware diff --git a/fixtures/asrr/e3c246d4i-nl.go b/fixtures/asrr/e3c246d4i-nl.go index 3096e906e..11f495723 100644 --- a/fixtures/asrr/e3c246d4i-nl.go +++ b/fixtures/asrr/e3c246d4i-nl.go @@ -1,7 +1,7 @@ package asrr import ( - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" ) // E3C246D4INL is an example inventory taken with lshw diff --git a/fixtures/dell/r6515.go b/fixtures/dell/r6515.go index 4aebf495b..d186eaf10 100644 --- a/fixtures/dell/r6515.go +++ b/fixtures/dell/r6515.go @@ -1,7 +1,8 @@ package dell import ( - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/metal-toolbox/ironlib/model" ) @@ -1633,7 +1634,7 @@ var ( Common: common.Common{ Oem: false, Description: "SATA controller", - Vendor: "Advanced Micro Devices, Inc. [AMD]", + Vendor: common.VendorAMD, Model: "FCH SATA Controller [AHCI mode]", Serial: "dead:beef", ProductName: "FCH SATA Controller [AHCI mode]", @@ -1654,7 +1655,7 @@ var ( Common: common.Common{ Oem: false, Description: "SATA controller", - Vendor: "Advanced Micro Devices, Inc. [AMD]", + Vendor: common.VendorAMD, Model: "FCH SATA Controller [AHCI mode]", Serial: "dead:beef", ProductName: "FCH SATA Controller [AHCI mode]", @@ -3212,7 +3213,7 @@ var ( Common: common.Common{ Oem: false, Description: "SATA controller", - Vendor: "Advanced Micro Devices, Inc. [AMD]", + Vendor: common.VendorAMD, Model: "FCH SATA Controller [AHCI mode]", Serial: "dead:beef", ProductName: "FCH SATA Controller [AHCI mode]", @@ -3233,7 +3234,7 @@ var ( Common: common.Common{ Oem: false, Description: "SATA controller", - Vendor: "Advanced Micro Devices, Inc. [AMD]", + Vendor: common.VendorAMD, Model: "FCH SATA Controller [AHCI mode]", Serial: "dead:beef", ProductName: "FCH SATA Controller [AHCI mode]", diff --git a/fixtures/supermicro/x11dph-t.go b/fixtures/supermicro/x11dph-t.go index 065b3847d..6df55e813 100644 --- a/fixtures/supermicro/x11dph-t.go +++ b/fixtures/supermicro/x11dph-t.go @@ -1,7 +1,8 @@ package supermicro import ( - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/metal-toolbox/ironlib/model" ) diff --git a/go.mod b/go.mod index 1015f5ec1..6a53e9834 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.22 require ( github.com/beevik/etree v1.4.1 - github.com/bmc-toolbox/common v0.0.0-20240426155832-c9882dbabcca github.com/dselans/dmidecode v0.0.0-20180814053009-65c3f9d81910 + github.com/metal-toolbox/bmc-common v1.0.2 github.com/pkg/errors v0.9.1 github.com/r3labs/diff/v3 v3.0.1 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index aa6b5b8cb..f03c7bbcc 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/beevik/etree v1.4.1 h1:PmQJDDYahBGNKDcpdX8uPy1xRCwoCGVUiW669MEirVI= github.com/beevik/etree v1.4.1/go.mod h1:gPNJNaBGVZ9AwsidazFZyygnd+0pAU38N4D+WemwKNs= -github.com/bmc-toolbox/common v0.0.0-20240426155832-c9882dbabcca h1:8hmbfSQ3cR0KXyAegrgmv9ic2eyDLdYl9j6819dkKb0= -github.com/bmc-toolbox/common v0.0.0-20240426155832-c9882dbabcca/go.mod h1:SY//n1PJjZfbFbmAsB6GvEKbc7UXz3d30s3kWxfJQ/c= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -15,6 +13,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/metal-toolbox/bmc-common v1.0.2 h1:AbUhx4tJzz2dYxKaXu8ENSR8+bCupbqwLvYouzpEc5U= +github.com/metal-toolbox/bmc-common v1.0.2/go.mod h1:WxMpaNb7/yTSEW0fMDOWUrhs/CPAzuCSx0p3uv3vRVA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/model/hardware.go b/model/hardware.go index 23359da8c..4c18bc57f 100644 --- a/model/hardware.go +++ b/model/hardware.go @@ -1,6 +1,8 @@ package model -import "github.com/bmc-toolbox/common" +import ( + common "github.com/metal-toolbox/bmc-common" +) // Hardware is a base struct that various providers inherit type Hardware struct { diff --git a/model/stuff.go b/model/stuff.go index 429bfa35d..b7a53709c 100644 --- a/model/stuff.go +++ b/model/stuff.go @@ -1,7 +1,7 @@ package model import ( - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/pkg/errors" ) diff --git a/providers/asrockrack/asrockrack.go b/providers/asrockrack/asrockrack.go index 1e97905db..2a6905875 100644 --- a/providers/asrockrack/asrockrack.go +++ b/providers/asrockrack/asrockrack.go @@ -3,13 +3,14 @@ package asrockrack import ( "context" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // A asrockrack device has methods to collect hardware inventory, regardless of the vendor diff --git a/providers/dell/dell.go b/providers/dell/dell.go index 73b8072aa..e8c71cc93 100644 --- a/providers/dell/dell.go +++ b/providers/dell/dell.go @@ -4,13 +4,14 @@ import ( "context" "os" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // EnvUpdateStoreURL defines up the update store base URL prefix diff --git a/providers/dell/dell_test.go b/providers/dell/dell_test.go index e7360a978..5163eb08e 100644 --- a/providers/dell/dell_test.go +++ b/providers/dell/dell_test.go @@ -6,14 +6,15 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus/hooks/test" + "github.com/stretchr/testify/assert" + "github.com/metal-toolbox/ironlib/actions" dellFixtures "github.com/metal-toolbox/ironlib/fixtures/dell" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/sirupsen/logrus" - "github.com/sirupsen/logrus/hooks/test" - "github.com/stretchr/testify/assert" ) var r6515fixtures = "../../fixtures/dell/r6515" diff --git a/providers/generic/generic.go b/providers/generic/generic.go index 9f3c1321d..5f332bdd4 100644 --- a/providers/generic/generic.go +++ b/providers/generic/generic.go @@ -3,13 +3,14 @@ package generic import ( "context" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // A Generic device has methods to collect hardware inventory, regardless of the vendor diff --git a/providers/supermicro/supermicro.go b/providers/supermicro/supermicro.go index 30856649f..94416607c 100644 --- a/providers/supermicro/supermicro.go +++ b/providers/supermicro/supermicro.go @@ -3,14 +3,15 @@ package supermicro import ( "context" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/metal-toolbox/ironlib/actions" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/firmware" "github.com/metal-toolbox/ironlib/model" "github.com/metal-toolbox/ironlib/utils" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) type supermicro struct { diff --git a/utils/blkdiscard.go b/utils/blkdiscard.go index 43ef2283f..e11d2b751 100644 --- a/utils/blkdiscard.go +++ b/utils/blkdiscard.go @@ -5,7 +5,7 @@ import ( "context" "os" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/sirupsen/logrus" ) diff --git a/utils/blkdiscard_test.go b/utils/blkdiscard_test.go index 39f0fe205..4d6c94119 100644 --- a/utils/blkdiscard_test.go +++ b/utils/blkdiscard_test.go @@ -7,7 +7,7 @@ import ( "os/exec" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" ) diff --git a/utils/dmidecode.go b/utils/dmidecode.go index 466eaf959..31d6f254c 100644 --- a/utils/dmidecode.go +++ b/utils/dmidecode.go @@ -7,8 +7,8 @@ import ( "os/exec" "strings" - "github.com/bmc-toolbox/common" "github.com/dselans/dmidecode" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" diff --git a/utils/dmidecode_test.go b/utils/dmidecode_test.go index ec3b81073..be9a1d62e 100644 --- a/utils/dmidecode_test.go +++ b/utils/dmidecode_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/dsu.go b/utils/dsu.go index 16def03b6..bdb3e4c41 100644 --- a/utils/dsu.go +++ b/utils/dsu.go @@ -10,7 +10,7 @@ import ( "regexp" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/errs" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" diff --git a/utils/dsu_test.go b/utils/dsu_test.go index c6c879165..553c580b4 100644 --- a/utils/dsu_test.go +++ b/utils/dsu_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/fill_zero.go b/utils/fill_zero.go index 72ba8ae5b..9870f7738 100644 --- a/utils/fill_zero.go +++ b/utils/fill_zero.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/sirupsen/logrus" ) diff --git a/utils/fill_zero_test.go b/utils/fill_zero_test.go index 1c0542acb..4bba8a2f4 100644 --- a/utils/fill_zero_test.go +++ b/utils/fill_zero_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" ) diff --git a/utils/hdparm.go b/utils/hdparm.go index 5c48d8754..15c4ce0d3 100644 --- a/utils/hdparm.go +++ b/utils/hdparm.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/sirupsen/logrus" ) diff --git a/utils/hdparm_test.go b/utils/hdparm_test.go index a3d70d1b9..8145d8498 100644 --- a/utils/hdparm_test.go +++ b/utils/hdparm_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/lsblk.go b/utils/lsblk.go index f20f6e985..d47abb2b6 100644 --- a/utils/lsblk.go +++ b/utils/lsblk.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/lsblk_test.go b/utils/lsblk_test.go index d7a10f058..dbbc11b4f 100644 --- a/utils/lsblk_test.go +++ b/utils/lsblk_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/lshw.go b/utils/lshw.go index 216ae576b..b7ce1f7b9 100644 --- a/utils/lshw.go +++ b/utils/lshw.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/lshw_test.go b/utils/lshw_test.go index 56176d54c..9a456f1a6 100644 --- a/utils/lshw_test.go +++ b/utils/lshw_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" asrrFixtures "github.com/metal-toolbox/ironlib/fixtures/asrr" dellFixtures "github.com/metal-toolbox/ironlib/fixtures/dell" "github.com/stretchr/testify/assert" diff --git a/utils/misc.go b/utils/misc.go index 595547e0d..ca2d31edd 100644 --- a/utils/misc.go +++ b/utils/misc.go @@ -4,7 +4,7 @@ import ( "io" "os" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/errs" "github.com/pkg/errors" ) diff --git a/utils/misc_test.go b/utils/misc_test.go index 693c4f4c6..9671fc788 100644 --- a/utils/misc_test.go +++ b/utils/misc_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/mlxup.go b/utils/mlxup.go index d728d1c16..601129d98 100644 --- a/utils/mlxup.go +++ b/utils/mlxup.go @@ -8,7 +8,7 @@ import ( "os" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/mlxup_test.go b/utils/mlxup_test.go index 248f1e778..c2ccb24c5 100644 --- a/utils/mlxup_test.go +++ b/utils/mlxup_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/msecli.go b/utils/msecli.go index fe2693e00..7c7a53904 100644 --- a/utils/msecli.go +++ b/utils/msecli.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/msecli_test.go b/utils/msecli_test.go index 81d0acea7..785734cb6 100644 --- a/utils/msecli_test.go +++ b/utils/msecli_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) diff --git a/utils/mvcli.go b/utils/mvcli.go index 59b482409..b0cd3a23f 100644 --- a/utils/mvcli.go +++ b/utils/mvcli.go @@ -11,7 +11,7 @@ import ( "strconv" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/mvcli_test.go b/utils/mvcli_test.go index 02262317e..a3869d14f 100644 --- a/utils/mvcli_test.go +++ b/utils/mvcli_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/nvme.go b/utils/nvme.go index 2f9e9f07c..e17bc0047 100644 --- a/utils/nvme.go +++ b/utils/nvme.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/sirupsen/logrus" ) @@ -451,8 +451,8 @@ func (n *Nvme) createNS(ctx context.Context, logicalName string, size, blocksize return 0, fmt.Errorf("%w: size(%d) is not a multiple of blocksize(%d)", errInvalidCreateNSArgs, size, blocksize) } - _size := strconv.Itoa(int(size / blocksize)) - _blocksize := strconv.Itoa(int(blocksize)) + _size := strconv.FormatUint(uint64(size/blocksize), 10) + _blocksize := strconv.FormatUint(uint64(blocksize), 10) n.Executor.SetArgs("create-ns", logicalName, "--dps=0", "--nsze="+_size, "--ncap="+_size, "--blocksize="+_blocksize) result, err := n.Executor.Exec(ctx) if err != nil { @@ -465,27 +465,27 @@ func (n *Nvme) createNS(ctx context.Context, logicalName string, size, blocksize if len(parts) != 3 { return 0, fmt.Errorf("unable to parse nsid: %w", io.ErrUnexpectedEOF) } - nsid, err := strconv.Atoi(string(parts[2])) + nsid, err := strconv.ParseUint(string(parts[2]), 10, 32) return uint(nsid), err } func (n *Nvme) deleteNS(ctx context.Context, logicalName string, namespaceID uint) error { - nsid := strconv.Itoa(int(namespaceID)) + nsid := strconv.FormatUint(uint64(namespaceID), 10) n.Executor.SetArgs("delete-ns", logicalName, "--namespace-id="+nsid) _, err := n.Executor.Exec(ctx) return err } func (n *Nvme) attachNS(ctx context.Context, logicalName string, controllerID, namespaceID uint) error { - cntlid := strconv.Itoa(int(controllerID)) - nsid := strconv.Itoa(int(namespaceID)) + cntlid := strconv.FormatUint(uint64(controllerID), 10) + nsid := strconv.FormatUint(uint64(namespaceID), 10) n.Executor.SetArgs("attach-ns", logicalName, "--controllers="+cntlid, "--namespace-id="+nsid) _, err := n.Executor.Exec(ctx) return err } func (n *Nvme) idNS(ctx context.Context, logicalName string, namespaceID uint) ([]byte, error) { - nsid := strconv.Itoa(int(namespaceID)) + nsid := strconv.FormatUint(uint64(namespaceID), 10) n.Executor.SetArgs("id-ns", "--output-format=json", logicalName, "--namespace-id="+nsid) result, err := n.Executor.Exec(ctx) return result.Stdout, err diff --git a/utils/nvme_test.go b/utils/nvme_test.go index 488aee322..5536ff018 100644 --- a/utils/nvme_test.go +++ b/utils/nvme_test.go @@ -7,7 +7,7 @@ import ( "strconv" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" tlogrus "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/utils/smartctl.go b/utils/smartctl.go index 4c6884664..0c061a36f 100644 --- a/utils/smartctl.go +++ b/utils/smartctl.go @@ -10,7 +10,7 @@ import ( "path" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/smartctl_test.go b/utils/smartctl_test.go index 914a61f5d..7230260e7 100644 --- a/utils/smartctl_test.go +++ b/utils/smartctl_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/smc_ipmicfg.go b/utils/smc_ipmicfg.go index 44e4fa540..043e18888 100644 --- a/utils/smc_ipmicfg.go +++ b/utils/smc_ipmicfg.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "github.com/pkg/errors" ) diff --git a/utils/smc_ipmicfg_test.go b/utils/smc_ipmicfg_test.go index 27831e6ac..13c85cfa0 100644 --- a/utils/smc_ipmicfg_test.go +++ b/utils/smc_ipmicfg_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/smc_sum.go b/utils/smc_sum.go index 1f1e53557..903ca03d6 100644 --- a/utils/smc_sum.go +++ b/utils/smc_sum.go @@ -8,7 +8,7 @@ import ( "os" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" "golang.org/x/net/html/charset" ) diff --git a/utils/storecli.go b/utils/storecli.go index fe09c8de5..448f5a17c 100644 --- a/utils/storecli.go +++ b/utils/storecli.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/metal-toolbox/ironlib/model" ) diff --git a/utils/storecli_test.go b/utils/storecli_test.go index f3fed81db..03ccf9d92 100644 --- a/utils/storecli_test.go +++ b/utils/storecli_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" ) diff --git a/utils/watermark_disk.go b/utils/watermark_disk.go index e19d8c411..82f8bb0f6 100644 --- a/utils/watermark_disk.go +++ b/utils/watermark_disk.go @@ -9,7 +9,7 @@ import ( "os" "slices" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" ) var ErrIneffectiveWipe = errors.New("found left over data after wiping disk") diff --git a/utils/watermark_disk_test.go b/utils/watermark_disk_test.go index b988bf3a8..72ef5652f 100644 --- a/utils/watermark_disk_test.go +++ b/utils/watermark_disk_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/bmc-toolbox/common" + common "github.com/metal-toolbox/bmc-common" "github.com/stretchr/testify/assert" )