From 6e525db7a883348ae895df93dcb8ee455dba05bc Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sun, 22 Dec 2024 03:34:38 +0100 Subject: [PATCH] fix lint issues --- cmd/main.go | 2 +- internal/app/undock.go | 4 ++-- pkg/extractor/blob.go | 3 +-- pkg/extractor/image/image.go | 10 +++++----- pkg/image/ref.go | 6 ++---- .../mholt/archiver/v4/testdata/nodir.zip | Bin 9447 -> 0 bytes .../mholt/archiver/v4/testdata/test.zip | Bin 401 -> 0 bytes .../mholt/archiver/v4/testdata/unordered.zip | Bin 688 -> 0 bytes 8 files changed, 11 insertions(+), 14 deletions(-) delete mode 100644 vendor/github.com/mholt/archiver/v4/testdata/nodir.zip delete mode 100644 vendor/github.com/mholt/archiver/v4/testdata/test.zip delete mode 100644 vendor/github.com/mholt/archiver/v4/testdata/unordered.zip diff --git a/cmd/main.go b/cmd/main.go index 801bd531..50fb3463 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -33,7 +33,7 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) meta.Version = version - meta.UserAgent = fmt.Sprintf("%s/%s go/%s %s", meta.ID, meta.Version, runtime.Version()[2:], strings.Title(runtime.GOOS)) + meta.UserAgent = fmt.Sprintf("%s/%s go/%s %s", meta.ID, meta.Version, runtime.Version()[2:], strings.Title(runtime.GOOS)) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support _ = kong.Parse(&cli, kong.Name(meta.ID), diff --git a/internal/app/undock.go b/internal/app/undock.go index 167f0b89..fed89deb 100644 --- a/internal/app/undock.go +++ b/internal/app/undock.go @@ -9,7 +9,7 @@ import ( "github.com/crazy-max/undock/internal/config" ximage "github.com/crazy-max/undock/pkg/extractor/image" "github.com/crazy-max/undock/pkg/image" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) @@ -18,7 +18,7 @@ type Undock struct { ctx context.Context meta config.Meta cli config.Cli - platform specs.Platform + platform ocispecs.Platform } // New creates new undock instance diff --git a/pkg/extractor/blob.go b/pkg/extractor/blob.go index 9df8aa45..f80fe576 100644 --- a/pkg/extractor/blob.go +++ b/pkg/extractor/blob.go @@ -2,7 +2,6 @@ package extractor import ( "context" - "fmt" "io" "io/fs" "os" @@ -93,7 +92,7 @@ func ExtractBlob(filename string, dest string, opts ExtractBlobOpts) error { case f.FileInfo.Mode()&fs.ModeSymlink != 0: return writeSymlink(ctx, path, f) default: - return fmt.Errorf("cannot handle file mode: %v", f.FileInfo.Mode()) + return errors.Errorf("cannot handle file mode: %v", f.FileInfo.Mode()) } }) } diff --git a/pkg/extractor/image/image.go b/pkg/extractor/image/image.go index fe5dc0b6..0085d1c4 100644 --- a/pkg/extractor/image/image.go +++ b/pkg/extractor/image/image.go @@ -11,7 +11,7 @@ import ( "github.com/containerd/containerd/platforms" "github.com/containers/image/v5/manifest" "github.com/crazy-max/undock/pkg/extractor" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -31,7 +31,7 @@ type Options struct { // Source image reference Source string // Platform to enforce for Source image - Platform specs.Platform + Platform ocispecs.Platform // Includes a subset of files/dirs from the Source image Includes []string // All extracts all architectures if Source image is a manifest list @@ -102,14 +102,14 @@ func (c *Client) Extract() error { } type manifestEntry struct { - platform specs.Platform + platform ocispecs.Platform manifest *manifest.OCI1 } var mans []manifestEntry mtype := manifest.GuessMIMEType(manblob) - if mtype == specs.MediaTypeImageManifest { + if mtype == ocispecs.MediaTypeImageManifest { man, err := manifest.OCI1FromManifest(manblob) if err != nil { return errors.Wrap(err, "cannot create OCI manifest instance from blob") @@ -118,7 +118,7 @@ func (c *Client) Extract() error { platform: c.opts.Platform, manifest: man, }) - } else if mtype == specs.MediaTypeImageIndex { + } else if mtype == ocispecs.MediaTypeImageIndex { ocindex, err := manifest.OCI1IndexFromManifest(manblob) if err != nil { return errors.Wrap(err, "cannot create OCI manifest index instance from blob") diff --git a/pkg/image/ref.go b/pkg/image/ref.go index b67205c7..8314da8b 100644 --- a/pkg/image/ref.go +++ b/pkg/image/ref.go @@ -28,10 +28,8 @@ func Reference(name string) (reference.Named, error) { ref, err := reference.ParseNormalizedNamed(name) if err != nil { return nil, errors.Wrapf(err, "parsing normalized named %q", name) - } - - if _, ok := ref.(reference.Named); !ok { - return nil, fmt.Errorf("%q is not a named reference", name) + } else if ref == nil { + return nil, errors.Errorf("%q is not a named reference", name) } if _, hasTag := ref.(reference.NamedTagged); hasTag { diff --git a/vendor/github.com/mholt/archiver/v4/testdata/nodir.zip b/vendor/github.com/mholt/archiver/v4/testdata/nodir.zip deleted file mode 100644 index ccda2c5ba0872c88ccd718a46b90b1055b5c9a59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9447 zcma)?bxd%R%`UrfJ2Q8AlpITgEHxK_CBFUUP_45#i~(8;s30dCQYr?EhW zFGmAt=|O4ITw=J%ZFXb8*jvx-)v)uGPYe2a_vuo7Sni!yYkg@Sn&f^-?>gIp$BDPX ztRV^Q4pSo;C|#k@92aDFUQ?`9DzhicD1dILjDg+k$AbXtf|o9*JMp^$5F$Bt ztg1h4<=ABII&HNSAaH_>_CWJ6b-k{AQ%p|GDvH2L9f>U+KzyJkCx++?SS8EDjr3%d z!8=60eRza#p6u33S7tBwF?d$^r%L6^{8;DC@EUI|P~bV&ZI4zKH#U!t3m(Ar+JH{oE_J0QmF;)X?m)Nq@PEOb!`S2J>? zu%xgFKENIkqN|u|nM*$Ayge!**4?eTXdVm>U%?R)D%Nt_3ewiId17udVt7*bZAvG{ z*_o4ClBG?Z<;T-2=@_!ACWrbWk8Be-e^0-Zgp2I4nNM?9EMZ@&^J=95a` zLl_l4?i-0!Q8?5?zKKZu=6$9rD+hg}c@QBxFiEQM8OLFPny*gkB4iP*H=Yxp;Lg1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tUG$sxYhV!C%>*QWv1&to(6c*`~#x4m;BLz7Ej)%MXtx(aXxb2dkUgb_O z?cE~nU+EDFej(BEbQnH{7@7A}SS^we{bUEMu@}xR>`vjq zGXhzM>8~j9j$rENDzg-IuR;oreKsZ&q11z|ElE^TN+0~bsUu?6B20~aCxfsM1 zp-tm23%fFiUKJPZ3e0(m%v$6EC7DEz<6?^PRPPi0$@7#Q1%ybY2%T?yQX)QI&z+t7 za_ijta46(n6L#(uL4N1gi%$4uZZ}pY405@mN@ar!{OgXV3gaptqtP_7pvMGtDio)L z(5+|Wry%66T`+e!(k9owU`ABGtw$@`@6(7P4eG`T#hK^o%?_tA3se=sG^N}l{Ml@%j382NA_FMgGqk)1bh=q0q?OH zBr}-}#oMz$R&Jy!ldO&Rl=)-TtJ$z0DOTE)?Iu)g|(qPqULThhNcTQ_@0Ycm^rHz!6HBNsbo7kV2*XHzHV|DV&fRpe9XXF>+O z(b|0-h+TvA5N0BFO)rPzj!nVF=Xvx7Q@!gprmQZPOzGI*>yGo%j}heYaC(* zn*V#a>$jB%Q2)1p&mQ}x65oj{@-rMTwztz7YY3AZ5%q-^$=Rrcj+0&Lgpw?FecZDi zFh1%mTe5d9oXc?rU4Tcd>)8BA;(n0QKSa#!JWrkr-0eygib|wMHO9`mT%kSBa4}q1 zX-*rSQtw^4KgMWc0J#AYMZj=znBI3VMHw(~!cYI|lnM5q!~y_+G7BgS_{Y=V&YVF0 z=b4j#VtjuU{GW97uYy{COz?lP)<0VR56=2mt^bK0|Ed*^2>72M@{j00c*g&-!GDPU z9S#0fln)8;Z-T;qZ>7IOn7^%r`rj-44axj_!hc5!e-$1<1N;>*{CjeLZ>hh^VUhgz cKL6JS`&SD=Lj9wRp#NO9e@K+c=YPEYADuE)C;$Ke diff --git a/vendor/github.com/mholt/archiver/v4/testdata/test.zip b/vendor/github.com/mholt/archiver/v4/testdata/test.zip deleted file mode 100644 index 88bbd4cc341bd97ab090c8e7426357dcf3526c3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 401 zcmWIWW@Zs#U|`^2_-1lGvy2Q3Yz#6C>G^uO`6;0xoD9qx>Q*L!aA^fM z10%}|W(Ec@Q998(uh~GL?fO%ZxNY4P4ML{Z4GoOKdXCH5bIsYOmgBT!P0q>t|7U#k zN#3Nfr8D@|QwQTS!Z$g(+E1pWoQMt06za{%3qAT{HqYW8YwYHUoa)V9pL6l-1!LE2 zm%J3+-NL49?SiMy8n-DF#dbV%xwF>mU~t7UuXmww_Y>mskG=Q#-L%90sV-Z>QDr_8 zr6*xewy9j3F1L8nTh4xAqrf}CQ==1a_WgTac5+sAky>8=_o%qk;PCkOWs6Q~EmyR7 z`nQVb_Fjf1y3-yTo%#1+_gsej36ks^qQmVRpZHCSeIv)8?ztwhvBUe$(fgm4m;7W8 w@MdI^W5yL=62PEiU;u_4!;(f23l@B=kl;fLx&UuhHjpYtAoKy!`XG%A0O^mJU;qFB diff --git a/vendor/github.com/mholt/archiver/v4/testdata/unordered.zip b/vendor/github.com/mholt/archiver/v4/testdata/unordered.zip deleted file mode 100644 index 1651028c09a7d320176bb8f67d5afd2f7c8a924c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcmWIWW@h1H0D+A&{6oPED8a-a!(gZ%8p6rI{BN>XGQ$+F;dF_k|R_Ad8LkiL@Bq#}HQ=!MzOfHioMindF#p z1(*ah=mZ$vI)a#>;A4dZA0Bfs0}o~n1H+O=8?ZS*9{~-*8jJ`Bp&P`+05b^Wph}=Y zpkO849A>yVAO~#)n?sa?FasFoAdo?yz&-;8H?AOJWdo{UU