diff --git a/pkg/metadata/go.mod b/pkg/metadata/go.mod index 0aead2e64..3b4db8550 100644 --- a/pkg/metadata/go.mod +++ b/pkg/metadata/go.mod @@ -3,9 +3,9 @@ module github.com/linuxkit/linuxkit/pkg/metadata go 1.16 require ( - github.com/diskfs/go-diskfs v1.1.1 + github.com/diskfs/go-diskfs v1.2.1-0.20230123115902-fce1828bbbfa github.com/packethost/packngo v0.1.0 - github.com/sirupsen/logrus v1.0.3 + github.com/sirupsen/logrus v1.7.0 github.com/stretchr/testify v1.7.0 // indirect github.com/vishvananda/netlink v0.0.0-20170808154308-f5a6f697a596 github.com/vishvananda/netns v0.0.0-20170707011535-86bef332bfc3 // indirect diff --git a/pkg/metadata/go.sum b/pkg/metadata/go.sum index d6b176b97..307370da2 100644 --- a/pkg/metadata/go.sum +++ b/pkg/metadata/go.sum @@ -1,32 +1,118 @@ +4d63.com/gochecknoinits v0.0.0-20200108094044-eb73b47b9fc4/go.mod h1:4o1i5aXtIF5tJFt3UD1knCVmWOXg7fLYdHVu6jeNcnM= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 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= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/diskfs/go-diskfs v1.1.1 h1:rMjLpaydtXGVZb7mdkRGK1+//30i76nKAit89zUzeaI= github.com/diskfs/go-diskfs v1.1.1/go.mod h1:afUPxxu+x1snp4aCY2bKR0CoZ/YFJewV3X2UEr2nPZE= +github.com/diskfs/go-diskfs v1.2.0 h1:Ow4xorEDw1VNYKbC+SA/qQNwi5gWIwdKUxmUcLFST24= +github.com/diskfs/go-diskfs v1.2.0/go.mod h1:ZTeTbzixuyfnZW5y5qKMtjV2o+GLLHo1KfMhotJI4Rk= +github.com/diskfs/go-diskfs v1.2.1-0.20230123115902-fce1828bbbfa h1:IjMOtaIqh7PYR3Pw06fMJp0UaWp4g1meiNTwcmH0Aho= +github.com/diskfs/go-diskfs v1.2.1-0.20230123115902-fce1828bbbfa/go.mod h1:3pUpCAz75Q11om5RsGpVKUgXp2Z+ATw1xV500glmCP0= +github.com/frankban/quicktest v1.13.0 h1:yNZif1OkDfNoDfb9zZa9aXIpejNR4F23Wely0c+Qdqk= +github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gordonklaus/ineffassign v0.0.0-20190601041439-ed7b1b5ee0f8/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= +github.com/jgautheron/goconst v0.0.0-20170703170152-9740945f5dcb/go.mod h1:82TxjOpWQiPmywlbIaB2ZkqJoSYJdLGPgAJDvM3PbKc= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mibk/dupl v1.0.0/go.mod h1:pCr4pNxxIbFGvtyCOi0c7LVjmV6duhKWV+ex5vh38ME= github.com/packethost/packngo v0.1.0 h1:G/5zumXb2fbPm5MAM3y8MmugE66Ehpio5qx0IhdhTPc= github.com/packethost/packngo v0.1.0/go.mod h1:otzZQXgoO96RTzDB/Hycg0qZcXZsWJGJRSXbmEIJ+4M= +github.com/pierrec/lz4 v2.3.0+incompatible h1:CZzRn4Ut9GbUkHlQ7jqBXeZQV41ZSKWFc302ZU6lUTk= +github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= +github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/xattr v0.4.1 h1:dhclzL6EqOXNaPDWqoeb9tIxATfBSmjqL0b4DpSjwRw= +github.com/pkg/xattr v0.4.1/go.mod h1:W2cGD0TBEus7MkUgv0tNZ9JutLtVO3cXu+IBRuHqnFs= +github.com/pkg/xattr v0.4.9 h1:5883YPCtkSd8LFbs13nXplj9g9tlrwoJRjgpgMu1/fE= +github.com/pkg/xattr v0.4.9/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.0.3 h1:B5C/igNWoiULof20pKfY4VntcIPqKuwEmoLZrabbUrc= github.com/sirupsen/logrus v1.0.3/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stripe/safesql v0.2.0/go.mod h1:q7b2n0JmzM1mVGfcYpanfVb2j23cXZeWFxcILPn3JV4= +github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk= +github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vishvananda/netlink v0.0.0-20170808154308-f5a6f697a596 h1:K6pwCps8j1ylaB37G0r6hGajvbNsdm+0ITJ6L88r65w= github.com/vishvananda/netlink v0.0.0-20170808154308-f5a6f697a596/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netns v0.0.0-20170707011535-86bef332bfc3 h1:NcYCJC+LbOrfvuf/uHeM/kxh6vOmiuInC4GAWRdc+P0= github.com/vishvananda/netns v0.0.0-20170707011535-86bef332bfc3/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= golang.org/x/crypto v0.0.0-20180515001509-1a580b3eff78 h1:uJIReYEB1ZZLarzi83Pmig1HhZ/cwFCysx05l0PFBIk= golang.org/x/crypto v0.0.0-20180515001509-1a580b3eff78/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181021155630-eda9bb28ed51/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20200102200121-6de373a2766c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/djherbis/times.v1 v1.2.0 h1:UCvDKl1L/fmBygl2Y7hubXCnY7t4Yj46ZrBFNUipFbM= gopkg.in/djherbis/times.v1 v1.2.0/go.mod h1:AQlg6unIsrsCEdQYhTzERy542dz6SFdQFZFv6mUY0P8= +gopkg.in/djherbis/times.v1 v1.3.0 h1:uxMS4iMtH6Pwsxog094W0FYldiNnfY/xba00vq6C2+o= +gopkg.in/djherbis/times.v1 v1.3.0/go.mod h1:AQlg6unIsrsCEdQYhTzERy542dz6SFdQFZFv6mUY0P8= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/pkg/metadata/provider_cdrom.go b/pkg/metadata/provider_cdrom.go index 872967880..f80146a62 100644 --- a/pkg/metadata/provider_cdrom.go +++ b/pkg/metadata/provider_cdrom.go @@ -77,7 +77,7 @@ func FindCIs() []string { dev = fmt.Sprintf("/dev/%s", dev) log.Debugf("checking device: %s", dev) // open readonly, ignore errors - disk, err := diskfs.OpenWithMode(dev, diskfs.ReadOnly) + disk, err := diskfs.Open(dev, diskfs.WithOpenMode(diskfs.ReadOnly)) if err != nil { log.Debugf("failed to open device read-only: %s: %v", dev, err) continue diff --git a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/.golangci.yml b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/.golangci.yml new file mode 100644 index 000000000..09ce72b20 --- /dev/null +++ b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/.golangci.yml @@ -0,0 +1,60 @@ +linters-settings: + errcheck: + check-type-assertions: true + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + govet: + check-shadowing: false + nolintlint: + require-explanation: true + require-specific: true + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - gocritic + - gofmt + - goimports + - gocyclo + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nolintlint + - nakedret + - prealloc + - predeclared + - revive + - staticcheck + - structcheck + - stylecheck + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - varcheck + - whitespace + # - wsl # лишние пустые строки и т.д., чистый стиль + # - goconst # проверка на наличие переменных, которых следовало бы вынести в const + # - gomnd # поиск всяких "магических" чисел, переменных + +run: + issues-exit-code: 1 \ No newline at end of file diff --git a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/Makefile b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/Makefile index 36173b2bf..78225dada 100644 --- a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/Makefile +++ b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/Makefile @@ -6,7 +6,7 @@ GOENV ?= GO111MODULE=on CGO_ENABLED=0 GO_FILES ?= $(shell $(GOENV) go list ./...) GOBIN ?= $(shell go env GOPATH)/bin LINTER ?= $(GOBIN)/golangci-lint - +LINTER_VERSION ?= v1.49.0 # BUILDARCH is the host architecture # ARCH is the target architecture @@ -59,8 +59,7 @@ test: image golangci-lint: $(LINTER) $(LINTER): - $(GOENV) go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1 - + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(LINTER_VERSION) ## Check the file format fmt-check: @@ -70,13 +69,8 @@ fmt-check: fi ## Lint the files -lint: golint golangci-lint - @$(BUILD_CMD) $(LINTER) run --disable-all --enable=golint ./... - -golint: -ifeq (, $(shell which golint)) - go get -u golang.org/x/lint/golint -endif +lint: golangci-lint + @$(BUILD_CMD) $(LINTER) run ./... ## Vet the files vet: diff --git a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/README.md b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/README.md index 6dd2a51c6..aa290f7b7 100644 --- a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/README.md +++ b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/README.md @@ -90,7 +90,7 @@ There are examples in the [examples/](./examples/) directory. Here is one to get The following example will create a fully bootable EFI disk image. It assumes you have a bootable EFI file (any modern Linux kernel compiled with `CONFIG_EFI_STUB=y` will work) available. ```go -import diskfs "github.com/diskfs/goi-diskfs" +import diskfs "github.com/diskfs/go-diskfs" espSize int := 100*1024*1024 // 100 MB diskSize int := espSize + 4*1024*1024 // 104 MB @@ -98,7 +98,7 @@ diskSize int := espSize + 4*1024*1024 // 104 MB // create a disk image diskImg := "/tmp/disk.img" -disk := diskfs.Create(diskImg, diskSize, diskfs.Raw) +disk := diskfs.Create(diskImg, diskSize, diskfs.Raw, diskfs.SectorSizeDefault) // create a partition table blkSize int := 512 partitionSectors int := espSize / blkSize @@ -117,7 +117,7 @@ err = disk.Partition(table) /* * create an ESP partition with some contents */ -kernel, err := ioutil.ReadFile("/some/kernel/file") +kernel, err := os.ReadFile("/some/kernel/file") fs, err := disk.CreateFilesystem(0, diskfs.TypeFat32) @@ -154,5 +154,5 @@ Future plans are to add the following: * `ext4` filesystem * `Joliet` extensions to `iso9660` * `Rock Ridge` sparse file support - supports the flag, but not yet reading or writing -* `squashfs` filesystem +* `squashfs` sparse file support - currently treats sparse files as regular files * `qcow` disk format diff --git a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk/disk.go b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk/disk.go index 82e74eba0..08c7dfe11 100644 --- a/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk/disk.go +++ b/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk/disk.go @@ -15,6 +15,7 @@ import ( "github.com/diskfs/go-diskfs/filesystem" "github.com/diskfs/go-diskfs/filesystem/fat32" "github.com/diskfs/go-diskfs/filesystem/iso9660" + "github.com/diskfs/go-diskfs/filesystem/squashfs" "github.com/diskfs/go-diskfs/partition" ) @@ -47,9 +48,16 @@ var ( // GetPartitionTable retrieves a PartitionTable for a Disk // +// If the table is able to be retrieved from the disk, it is saved in the instance. +// // returns an error if the Disk is invalid or does not exist, or the partition table is unknown func (d *Disk) GetPartitionTable() (partition.Table, error) { - return partition.Read(d.File, int(d.LogicalBlocksize), int(d.PhysicalBlocksize)) + t, err := partition.Read(d.File, int(d.LogicalBlocksize), int(d.PhysicalBlocksize)) + if err != nil { + return nil, err + } + d.Table = t + return t, nil } // Partition applies a partition.Table implementation to a Disk @@ -65,7 +73,7 @@ func (d *Disk) Partition(table partition.Table) error { // fill in the uuid err := table.Write(d.File, d.Size) if err != nil { - return fmt.Errorf("Failed to write partition table: %v", err) + return fmt.Errorf("failed to write partition table: %v", err) } d.Table = table // the partition table needs to be re-read only if @@ -73,7 +81,7 @@ func (d *Disk) Partition(table partition.Table) error { if d.Type == Device { err = d.ReReadPartitionTable() if err != nil { - return fmt.Errorf("Unable to re-read the partition table. Kernel still uses old partition table: %v", err) + return fmt.Errorf("unable to re-read the partition table. Kernel still uses old partition table: %v", err) } } return nil @@ -85,22 +93,22 @@ func (d *Disk) Partition(table partition.Table) error { // // returns an error if there was an error writing to the disk, reading from the reader, the table // is invalid, or the partition is invalid -func (d *Disk) WritePartitionContents(partition int, reader io.Reader) (int64, error) { +func (d *Disk) WritePartitionContents(part int, reader io.Reader) (int64, error) { if !d.Writable { return -1, errIncorrectOpenMode } if d.Table == nil { return -1, fmt.Errorf("cannot write contents of a partition on a disk without a partition table") } - if partition < 0 { + if part < 0 { return -1, fmt.Errorf("cannot write contents of a partition without specifying a partition") } partitions := d.Table.GetPartitions() // API indexes from 1, but slice from 0 - if partition > len(partitions) { - return -1, fmt.Errorf("cannot write contents of partition %d which is greater than max partition %d", partition, len(partitions)) + if part > len(partitions) { + return -1, fmt.Errorf("cannot write contents of partition %d which is greater than max partition %d", part, len(partitions)) } - written, err := partitions[partition-1].WriteContents(d.File, reader) + written, err := partitions[part-1].WriteContents(d.File, reader) return int64(written), err } @@ -110,19 +118,19 @@ func (d *Disk) WritePartitionContents(partition int, reader io.Reader) (int64, e // // returns an error if there was an error reading from the disk, writing to the writer, the table // is invalid, or the partition is invalid -func (d *Disk) ReadPartitionContents(partition int, writer io.Writer) (int64, error) { +func (d *Disk) ReadPartitionContents(part int, writer io.Writer) (int64, error) { if d.Table == nil { return -1, fmt.Errorf("cannot read contents of a partition on a disk without a partition table") } - if partition < 0 { + if part < 0 { return -1, fmt.Errorf("cannot read contents of a partition without specifying a partition") } partitions := d.Table.GetPartitions() // API indexes from 1, but slice from 0 - if partition > len(partitions) { - return -1, fmt.Errorf("cannot read contents of partition %d which is greater than max partition %d", partition, len(partitions)) + if part > len(partitions) { + return -1, fmt.Errorf("cannot read contents of partition %d which is greater than max partition %d", part, len(partitions)) } - return partitions[partition-1].ReadContents(d.File, writer) + return partitions[part-1].ReadContents(d.File, writer) } // FilesystemSpec represents the specification of a filesystem to be created @@ -130,18 +138,19 @@ type FilesystemSpec struct { Partition int FSType filesystem.Type VolumeLabel string + WorkDir string } // CreateFilesystem creates a filesystem on a disk image, the equivalent of mkfs. // // Required: -// * desired partition number, or 0 to create the filesystem on the entire block device or -// disk image, -// * the filesystem type from github.com/diskfs/go-diskfs/filesystem +// - desired partition number, or 0 to create the filesystem on the entire block device or +// disk image, +// - the filesystem type from github.com/diskfs/go-diskfs/filesystem // // Optional: -// * volume label for those filesystems that support it; under Linux this shows -// in '/dev/disks/by-label/