mirror of
https://github.com/regclient/regclient.git
synced 2025-04-18 22:44:00 +03:00
Chore: Update staticcheck and fix linter warnings for Go 1.23
Signed-off-by: Brandon Mitchell <git@bmitch.net>
This commit is contained in:
parent
8f3b5ca344
commit
d53ff8155b
2
Makefile
2
Makefile
@ -48,7 +48,7 @@ ifneq "$(SYFT_CMD_VER)" "$(SYFT_VERSION)"
|
||||
-u "$(shell id -u):$(shell id -g)" \
|
||||
$(SYFT_CONTAINER)
|
||||
endif
|
||||
STATICCHECK_VER?=v0.4.7
|
||||
STATICCHECK_VER?=v0.5.0
|
||||
CI_DISTRIBUTION_VER?=2.8.3
|
||||
CI_ZOT_VER?=v2.1.0
|
||||
|
||||
|
@ -826,7 +826,7 @@ func (rootOpts *rootCmd) processRef(ctx context.Context, s ConfigSync, src, tgt
|
||||
opts = append(opts, regclient.ImageWithDigestTags())
|
||||
}
|
||||
if s.Referrers != nil && *s.Referrers {
|
||||
if s.ReferrerFilters == nil || len(s.ReferrerFilters) == 0 {
|
||||
if len(s.ReferrerFilters) == 0 {
|
||||
opts = append(opts, regclient.ImageWithReferrers())
|
||||
} else {
|
||||
for _, filter := range s.ReferrerFilters {
|
||||
|
@ -349,7 +349,7 @@ func WithLayerRmCreatedBy(re regexp.Regexp) Opts {
|
||||
if dm.m.IsList() || dm.config.oc == nil {
|
||||
return nil
|
||||
}
|
||||
if dm.layers == nil || len(dm.layers) == 0 {
|
||||
if len(dm.layers) == 0 {
|
||||
return fmt.Errorf("no layers found")
|
||||
}
|
||||
delLayers := []int{}
|
||||
@ -399,7 +399,7 @@ func WithLayerRmIndex(index int) Opts {
|
||||
if !dm.top || dm.m.IsList() || dm.config.oc == nil {
|
||||
return fmt.Errorf("remove layer by index requires v2 image manifest")
|
||||
}
|
||||
if dm.layers == nil || len(dm.layers) == 0 {
|
||||
if len(dm.layers) == 0 {
|
||||
return fmt.Errorf("no layers found")
|
||||
}
|
||||
curLayer := 0
|
||||
|
@ -225,7 +225,7 @@ func (d Descriptor) Match(opt MatchOpt) bool {
|
||||
if opt.ArtifactType != "" && d.ArtifactType != opt.ArtifactType {
|
||||
return false
|
||||
}
|
||||
if opt.Annotations != nil && len(opt.Annotations) > 0 {
|
||||
if len(opt.Annotations) > 0 {
|
||||
if d.Annotations == nil {
|
||||
return false
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func (m *docker2Manifest) MarshalPretty() ([]byte, error) {
|
||||
}
|
||||
fmt.Fprintf(tw, "MediaType:\t%s\n", m.desc.MediaType)
|
||||
fmt.Fprintf(tw, "Digest:\t%s\n", m.desc.Digest.String())
|
||||
if m.Annotations != nil && len(m.Annotations) > 0 {
|
||||
if len(m.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(m.Annotations))
|
||||
for k := range m.Annotations {
|
||||
@ -211,7 +211,7 @@ func (m *docker2ManifestList) MarshalPretty() ([]byte, error) {
|
||||
}
|
||||
fmt.Fprintf(tw, "MediaType:\t%s\n", m.desc.MediaType)
|
||||
fmt.Fprintf(tw, "Digest:\t%s\n", m.desc.Digest.String())
|
||||
if m.Annotations != nil && len(m.Annotations) > 0 {
|
||||
if len(m.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(m.Annotations))
|
||||
for k := range m.Annotations {
|
||||
|
@ -226,7 +226,7 @@ func (m *oci1Manifest) MarshalPretty() ([]byte, error) {
|
||||
fmt.Fprintf(tw, "ArtifactType:\t%s\n", m.ArtifactType)
|
||||
}
|
||||
fmt.Fprintf(tw, "Digest:\t%s\n", m.desc.Digest.String())
|
||||
if m.Annotations != nil && len(m.Annotations) > 0 {
|
||||
if len(m.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(m.Annotations))
|
||||
for k := range m.Annotations {
|
||||
@ -283,7 +283,7 @@ func (m *oci1Index) MarshalPretty() ([]byte, error) {
|
||||
fmt.Fprintf(tw, "ArtifactType:\t%s\n", m.ArtifactType)
|
||||
}
|
||||
fmt.Fprintf(tw, "Digest:\t%s\n", m.desc.Digest.String())
|
||||
if m.Annotations != nil && len(m.Annotations) > 0 {
|
||||
if len(m.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(m.Annotations))
|
||||
for k := range m.Annotations {
|
||||
@ -332,7 +332,7 @@ func (m *oci1Artifact) MarshalPretty() ([]byte, error) {
|
||||
fmt.Fprintf(tw, "MediaType:\t%s\n", m.desc.MediaType)
|
||||
fmt.Fprintf(tw, "ArtifactType:\t%s\n", m.ArtifactType)
|
||||
fmt.Fprintf(tw, "Digest:\t%s\n", m.desc.Digest.String())
|
||||
if m.Annotations != nil && len(m.Annotations) > 0 {
|
||||
if len(m.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(m.Annotations))
|
||||
for k := range m.Annotations {
|
||||
|
@ -128,7 +128,7 @@ func (rl ReferrerList) MarshalPretty() ([]byte, error) {
|
||||
return []byte{}, err
|
||||
}
|
||||
}
|
||||
if rl.Annotations != nil && len(rl.Annotations) > 0 {
|
||||
if len(rl.Annotations) > 0 {
|
||||
fmt.Fprintf(tw, "Annotations:\t\n")
|
||||
keys := make([]string, 0, len(rl.Annotations))
|
||||
for k := range rl.Annotations {
|
||||
|
Loading…
x
Reference in New Issue
Block a user