From 2aafe9199571454997545f38943b7fb0f3be1f9a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 20 Mar 2026 15:16:07 -0700 Subject: [PATCH] Apply improvements from `go fix` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These all seem pretty uncontroversial. 👀 Signed-off-by: Tianon Gravi --- ociregistry/ociauth/authfile.go | 8 ++++---- ociregistry/ociauth/scope.go | 4 ++-- ociregistry/ociserver/range.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ociregistry/ociauth/authfile.go b/ociregistry/ociauth/authfile.go index 0d4e898..ccf8150 100644 --- a/ociregistry/ociauth/authfile.go +++ b/ociregistry/ociauth/authfile.go @@ -289,10 +289,10 @@ func decodeConfigFile(data []byte) (configData, error) { // to keep the logic the same as that. func urlHost(url string) string { stripped := url - if strings.HasPrefix(url, "http://") { - stripped = strings.TrimPrefix(url, "http://") - } else if strings.HasPrefix(url, "https://") { - stripped = strings.TrimPrefix(url, "https://") + if after, ok := strings.CutPrefix(url, "http://"); ok { + stripped = after + } else if after, ok := strings.CutPrefix(url, "https://"); ok { + stripped = after } hostName, _, _ := strings.Cut(stripped, "/") diff --git a/ociregistry/ociauth/scope.go b/ociregistry/ociauth/scope.go index 6b37cd5..ccf95b1 100644 --- a/ociregistry/ociauth/scope.go +++ b/ociregistry/ociauth/scope.go @@ -143,7 +143,7 @@ func ParseScope(s string) Scope { }) continue } - for _, action := range strings.Split(parts[2], ",") { + for action := range strings.SplitSeq(parts[2], ",") { rscopes = append(rscopes, ResourceScope{ ResourceType: parts[0], Resource: parts[1], @@ -252,7 +252,7 @@ func (s Scope) Iter() func(yield func(ResourceScope) bool) { continue } acts := s.actions[i] - for k := knownAction(0); k < numActions; k++ { + for k := range numActions { if acts&(1<