Skip to content

Commit 74348bb

Browse files
alnrory-bot
authored andcommitted
chore: bump to Go 1.26 massive cleanup in ory/x
GitOrigin-RevId: 7b23d25f2953d72bc2480bb8a8cac8f7cb08e0fb
1 parent 47a9384 commit 74348bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+241
-1685
lines changed

.docker/Dockerfile-local-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.25 AS builder
1+
FROM golang:1.26 AS builder
22

33
WORKDIR /go/src/github.com/ory/hydra
44

.docker/Dockerfile-test-hsm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
FROM golang:1.25-alpine3.21 AS builder
1+
FROM golang:1.26-alpine3.23 AS builder
22

33
RUN apk add --no-cache build-base git gcc bash
44

55
WORKDIR /go/src/github.com/ory/hydra
66
RUN mkdir -p ./internal/httpclient
77

8+
COPY oryx/go.mod oryx/go.mod
9+
COPY oryx/go.sum oryx/go.sum
10+
11+
812
COPY go.mod go.sum ./
913
COPY internal/httpclient/go.* ./internal/httpclient
1014

11-
ENV CGO_ENABLED 1
15+
ENV CGO_ENABLED=1
1216

1317
RUN go mod download
1418
COPY . .
@@ -23,7 +27,7 @@ ENV HSM_PIN=1234
2327
RUN apk add --no-cache softhsm opensc
2428
RUN pkcs11-tool --module "$HSM_LIBRARY" --slot 0 --init-token --so-pin 0000 --init-pin --pin "$HSM_PIN" --label "$HSM_TOKEN_LABEL"
2529

26-
FROM builder as test-hsm
30+
FROM builder AS test-hsm
2731

2832
RUN go test -p 1 -failfast -short -tags=sqlite,hsm ./...
2933

.github/workflows/ci.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
fetch-depth: 2
2727
- uses: actions/setup-go@v6
2828
with:
29-
go-version: "1.25"
29+
check-latest: true
30+
go-version-file: go.mod
3031
- name: Start service
3132
run: ./test/conformance/start.sh
3233
- name: Run tests
@@ -65,7 +66,8 @@ jobs:
6566
fetch-depth: 2
6667
- uses: actions/setup-go@v6
6768
with:
68-
go-version: "1.25"
69+
check-latest: true
70+
go-version-file: go.mod
6971
- run: go list -json > go.list
7072
- name: Run nancy
7173
uses: sonatype-nexus-community/nancy-github-action@v1.0.3
@@ -101,7 +103,8 @@ jobs:
101103
- uses: ory/ci/checkout@master
102104
- uses: actions/setup-go@v6
103105
with:
104-
go-version: "1.25"
106+
check-latest: true
107+
go-version-file: go.mod
105108
- name: Setup HSM libs and packages
106109
run: |
107110
sudo apt install -y softhsm2 opensc
@@ -150,7 +153,8 @@ jobs:
150153
- uses: ory/ci/checkout@master
151154
- uses: actions/setup-go@v6
152155
with:
153-
go-version: "1.25"
156+
check-latest: true
157+
go-version-file: go.mod
154158
- uses: actions/cache@v5
155159
with:
156160
path: ./test/e2e/hydra

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ jobs:
4444

4545
- uses: actions/setup-go@v6
4646
with:
47-
go-version: "1.25"
47+
check-latest: true
48+
go-version-file: go.mod
4849
- run: go version
4950

5051
# Initializes the CodeQL tools for scanning.

.github/workflows/format.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
- uses: actions/checkout@v6
1313
- uses: actions/setup-go@v6
1414
with:
15-
go-version: "1.25"
15+
check-latest: true
16+
go-version-file: go.mod
1617
- run: make format
1718
- name: Indicate formatting issues
1819
run: git diff HEAD --exit-code --color

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ version: "2"
22

33
linters:
44
enable:
5-
- gosec
65
- errcheck
76
- ineffassign
87
- staticcheck
@@ -11,6 +10,7 @@ linters:
1110
staticcheck:
1211
checks:
1312
- "-SA1019"
13+
1414
exclusions:
1515
rules:
1616
- path: '_test\.go'

DEVELOP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ We encourage all contributions. Before opening a pull request, read the
2626

2727
## Prerequisites
2828

29-
You need Go 1.13+ with `GO111MODULE=on` and, for the test suites:
29+
You need Go 1.26+. For the test suites:
3030

3131
- Docker and Docker Compose
3232
- Makefile

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export PATH := .bin:${PATH}
44
export PWD := $(shell pwd)
55
export IMAGE_TAG := $(if $(IMAGE_TAG),$(IMAGE_TAG),latest)
66

7-
GOLANGCI_LINT_VERSION = 2.4.0
7+
GOLANGCI_LINT_VERSION = 2.10.1
88

99
.bin/golangci-lint: Makefile
1010
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b .bin v$(GOLANGCI_LINT_VERSION)
@@ -72,12 +72,12 @@ quicktest:
7272

7373
.PHONY: quicktest-hsm
7474
quicktest-hsm:
75-
DOCKER_CONTENT_TRUST=1 docker build --progress=plain -f .docker/Dockerfile-test-hsm --target test-hsm -t oryd/hydra:${IMAGE_TAG} --target test-hsm .
75+
DOCKER_CONTENT_TRUST=1 docker build --progress=plain -f .docker/Dockerfile-test-hsm --target test-hsm -t oryd/hydra:${IMAGE_TAG} --target test-hsm .
7676

7777
.PHONY: test-refresh
7878
test-refresh:
7979
UPDATE_SNAPSHOTS=true go test -short -tags sqlite,sqlite_omit_load_extension ./...
80-
DOCKER_CONTENT_TRUST=1 docker build --progress=plain -f .docker/Dockerfile-test-hsm --target test-refresh-hsm -t oryd/hydra:${IMAGE_TAG} --target test-refresh-hsm .
80+
DOCKER_CONTENT_TRUST=1 docker build --progress=plain -f .docker/Dockerfile-test-hsm --target test-refresh-hsm -t oryd/hydra:${IMAGE_TAG} --target test-refresh-hsm .
8181

8282
authors: # updates the AUTHORS file
8383
curl --retry 7 --retry-connrefused https://raw.githubusercontent.com/ory/ci/master/authors/authors.sh | env PRODUCT="Ory Hydra" bash

client/sdk_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ import (
3232

3333
func createTestClient(prefix string) hydra.OAuth2Client {
3434
return hydra.OAuth2Client{
35-
ClientName: pointerx.Ptr(prefix + "name"),
36-
ClientSecret: pointerx.Ptr(prefix + "secret"),
37-
ClientUri: pointerx.Ptr("https://example.org/" + prefix + "uri"),
35+
ClientName: new(prefix + "name"),
36+
ClientSecret: new(prefix + "secret"),
37+
ClientUri: new("https://example.org/" + prefix + "uri"),
3838
Contacts: []string{prefix + "peter", prefix + "pan"},
3939
GrantTypes: []string{prefix + "client_credentials", prefix + "authorize_code"},
40-
LogoUri: pointerx.Ptr("https://example.org/" + prefix + "logo"),
41-
Owner: pointerx.Ptr(prefix + "an-owner"),
42-
PolicyUri: pointerx.Ptr("https://example.org/" + prefix + "policy-uri"),
43-
Scope: pointerx.Ptr(prefix + "foo bar baz"),
44-
TosUri: pointerx.Ptr("https://example.org/" + prefix + "tos"),
40+
LogoUri: new("https://example.org/" + prefix + "logo"),
41+
Owner: new(prefix + "an-owner"),
42+
PolicyUri: new("https://example.org/" + prefix + "policy-uri"),
43+
Scope: new(prefix + "foo bar baz"),
44+
TosUri: new("https://example.org/" + prefix + "tos"),
4545
ResponseTypes: []string{prefix + "id_token", prefix + "code"},
4646
RedirectUris: []string{"https://" + prefix + "redirect-url", "https://" + prefix + "redirect-uri"},
47-
ClientSecretExpiresAt: pointerx.Ptr[int64](0),
48-
TokenEndpointAuthMethod: pointerx.Ptr("client_secret_basic"),
49-
UserinfoSignedResponseAlg: pointerx.Ptr("none"),
50-
SubjectType: pointerx.Ptr("public"),
47+
ClientSecretExpiresAt: new(int64(0)),
48+
TokenEndpointAuthMethod: new("client_secret_basic"),
49+
UserinfoSignedResponseAlg: new("none"),
50+
SubjectType: new("public"),
5151
Metadata: map[string]interface{}{"foo": "bar"},
5252
// because these values are not nullable in the SQL schema, we have to set them not nil
5353
AllowedCorsOrigins: []string{},
5454
Audience: []string{},
5555
Jwks: &hydra.JsonWebKeySet{},
56-
SkipConsent: pointerx.Ptr(false),
56+
SkipConsent: new(false),
5757
}
5858
}
5959

@@ -118,7 +118,7 @@ func TestClientSDK(t *testing.T) {
118118
assert.EqualValues(t, "bar", result.Metadata.(map[string]interface{})["foo"])
119119

120120
// secret is not returned on GetOAuth2Client
121-
compareClient.ClientSecret = pointerx.Ptr("")
121+
compareClient.ClientSecret = new("")
122122
gresult, _, err := c.OAuth2API.GetOAuth2Client(context.Background(), *createClient.ClientId).Execute()
123123
require.NoError(t, err)
124124
assertx.EqualAsJSONExcept(t, compareClient, gresult, append(defaultIgnoreFields, "client_secret"))
@@ -151,7 +151,7 @@ func TestClientSDK(t *testing.T) {
151151

152152
// again, test if secret is not returned on Get
153153
compareClient = updateClient
154-
compareClient.ClientSecret = pointerx.Ptr("")
154+
compareClient.ClientSecret = new("")
155155
gresult, _, err = c.OAuth2API.GetOAuth2Client(context.Background(), *updateClient.ClientId).Execute()
156156
require.NoError(t, err)
157157
assertx.EqualAsJSONExcept(t, compareClient, gresult, append(defaultIgnoreFields, "client_secret"))
@@ -166,7 +166,7 @@ func TestClientSDK(t *testing.T) {
166166

167167
t.Run("case=public client is transmitted without secret", func(t *testing.T) {
168168
result, _, err := c.OAuth2API.CreateOAuth2Client(context.Background()).OAuth2Client(hydra.OAuth2Client{
169-
TokenEndpointAuthMethod: pointerx.Ptr("none"),
169+
TokenEndpointAuthMethod: new("none"),
170170
}).Execute()
171171
require.NoError(t, err)
172172

@@ -180,7 +180,7 @@ func TestClientSDK(t *testing.T) {
180180

181181
t.Run("case=id can be set", func(t *testing.T) {
182182
id := uuidx.NewV4().String()
183-
result, _, err := c.OAuth2API.CreateOAuth2Client(context.Background()).OAuth2Client(hydra.OAuth2Client{ClientId: pointerx.Ptr(id)}).Execute()
183+
result, _, err := c.OAuth2API.CreateOAuth2Client(context.Background()).OAuth2Client(hydra.OAuth2Client{ClientId: new(id)}).Execute()
184184
require.NoError(t, err)
185185

186186
assert.Equal(t, id, pointerx.Deref(result.ClientId))

cmd/cmd_create_client.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/ory/hydra/v2/cmd/cliclient"
1212
"github.com/ory/x/cmdx"
1313
"github.com/ory/x/flagx"
14-
"github.com/ory/x/pointerx"
1514

1615
"github.com/ory/hydra/v2/cmd/cli"
1716
)
@@ -93,7 +92,7 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags ` + "`--pgp-key`" +
9392
if err != nil {
9493
return err
9594
}
96-
cl.ClientId = pointerx.Ptr(flagx.MustGetString(cmd, flagClientId))
95+
cl.ClientId = new(flagx.MustGetString(cmd, flagClientId))
9796

9897
//nolint:bodyclose
9998
client, _, err := m.OAuth2API.CreateOAuth2Client(cmd.Context()).OAuth2Client(cl).Execute()
@@ -102,7 +101,7 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags ` + "`--pgp-key`" +
102101
}
103102

104103
if client.ClientSecret == nil && len(secret) > 0 {
105-
client.ClientSecret = pointerx.Ptr(secret)
104+
client.ClientSecret = new(secret)
106105
}
107106

108107
if encryptSecret && client.ClientSecret != nil {
@@ -112,7 +111,7 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags ` + "`--pgp-key`" +
112111
return cmdx.FailSilently(cmd)
113112
}
114113

115-
client.ClientSecret = pointerx.Ptr(enc.Base64Encode())
114+
client.ClientSecret = new(enc.Base64Encode())
116115
}
117116

118117
cmdx.PrintRow(cmd, (*outputOAuth2Client)(client))

0 commit comments

Comments
 (0)