Skip to content

Commit 59a1e80

Browse files
Update golangci-lint (#11)
Update golangci-lint --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Antoine Gelloz <[email protected]>
1 parent c1d7f22 commit 59a1e80

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

.github/workflows/qa.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
env:
2323
# renovate: datasource=github-releases depName=radiofrance/lint-config
24-
LINT_CONFIG_VERSION: v1.1.0
24+
LINT_CONFIG_VERSION: v1.1.1
2525
steps:
2626
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
@@ -32,4 +32,4 @@ jobs:
3232
- uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3333
with:
3434
# renovate: datasource=github-releases depName=golangci/golangci-lint
35-
version: v2.0.2
35+
version: v2.1.5

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ help: ## Display this message
1919
qa: lint ## Run all Q.A.
2020

2121
# renovate: datasource=github-tags depName=radiofrance/lint-config
22-
LINT_CONFIG_VERSION = v1.1.0
22+
LINT_CONFIG_VERSION = v1.1.1
2323

2424
lint: ## Lint source code
2525
curl -o .golangci.yml https://raw.githubusercontent.com/radiofrance/lint-config/$(LINT_CONFIG_VERSION)/.golangci.yml

registry.go

+31-31
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,6 @@ func (r *Registry) RegistryStr() string {
4343
return strings.Split(r.URL, "/")[0]
4444
}
4545

46-
// initAuthenticator returns an authn.Authenticator used by the docker golang library
47-
// to authenticate with a docker registry
48-
//
49-
// We generate the authn.Authenticator once, otherwise the resolver will try to resolve
50-
// the gcloud credentials before each api call. We check for the presence of an environment
51-
// variable GCR_JSON_KEY_PATH. If present, we use it, otherwise, we default to the default
52-
// keychain mechanism.
53-
func (r *Registry) initAuthenticator() error {
54-
gcrJSONKeyPath := os.Getenv(EnvGcrJSONKeyPath)
55-
if gcrJSONKeyPath != "" {
56-
key, err := os.ReadFile(gcrJSONKeyPath) //nolint:gosec
57-
if err != nil {
58-
return fmt.Errorf("failed to resolve authenticator using gcr json key at %s: %w", gcrJSONKeyPath, err)
59-
}
60-
r.authenticator = &authn.Basic{
61-
Username: "_json_key",
62-
Password: string(key),
63-
}
64-
65-
return nil
66-
}
67-
68-
var err error
69-
r.authenticator, err = authn.DefaultKeychain.Resolve(r)
70-
if err != nil {
71-
return fmt.Errorf("failed to resolve authenticator using default keychain: %w", err)
72-
}
73-
74-
return nil
75-
}
76-
7746
// Head is a wrapper to the remote.Head method.
7847
func (r *Registry) Head(imageRef string) (*v1.Descriptor, error) {
7948
ref, err := name.ParseReference(imageRef)
@@ -152,3 +121,34 @@ func (r *Registry) Retag(existingRef, toCreateRef string) error {
152121

153122
return nil
154123
}
124+
125+
// initAuthenticator returns an authn.Authenticator used by the docker golang library
126+
// to authenticate with a docker registry
127+
//
128+
// We generate the authn.Authenticator once, otherwise the resolver will try to resolve
129+
// the gcloud credentials before each api call. We check for the presence of an environment
130+
// variable GCR_JSON_KEY_PATH. If present, we use it, otherwise, we default to the default
131+
// keychain mechanism.
132+
func (r *Registry) initAuthenticator() error {
133+
gcrJSONKeyPath := os.Getenv(EnvGcrJSONKeyPath)
134+
if gcrJSONKeyPath != "" {
135+
key, err := os.ReadFile(gcrJSONKeyPath) //nolint:gosec
136+
if err != nil {
137+
return fmt.Errorf("failed to resolve authenticator using gcr json key at %s: %w", gcrJSONKeyPath, err)
138+
}
139+
r.authenticator = &authn.Basic{
140+
Username: "_json_key",
141+
Password: string(key),
142+
}
143+
144+
return nil
145+
}
146+
147+
var err error
148+
r.authenticator, err = authn.DefaultKeychain.Resolve(r)
149+
if err != nil {
150+
return fmt.Errorf("failed to resolve authenticator using default keychain: %w", err)
151+
}
152+
153+
return nil
154+
}

0 commit comments

Comments
 (0)