Skip to content

Commit 9909db8

Browse files
Merge pull request #14442 from cli/bump-go-1.27.1
Bump Go to 1.27.1
2 parents 97de969 + a4f0de0 commit 9909db8

54 files changed

Lines changed: 369 additions & 517 deletions

File tree

Some content is hidden

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

‎.github/golangci-lint-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.12.2
1+
v2.13.2

‎.github/govulncheck-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# This pin lives outside .github/workflows so bump-go can update it with the
22
# workflow GITHUB_TOKEN, which cannot push workflow-file changes. govulncheck
33
# embeds x/tools and is refreshed on Go language bumps to support new syntax.
4-
v1.1.4
4+
v1.8.0

‎api/client.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ func handleResponse(err error) error {
320320
return nil
321321
}
322322

323-
var restErr *ghAPI.HTTPError
324-
if errors.As(err, &restErr) {
323+
if restErr, ok := errors.AsType[*ghAPI.HTTPError](err); ok {
325324
return HTTPError{
326325
HTTPError: restErr,
327326
scopesSuggestion: generateScopesSuggestion(restErr.StatusCode,
@@ -331,8 +330,7 @@ func handleResponse(err error) error {
331330
}
332331
}
333332

334-
var gqlErr *ghAPI.GraphQLError
335-
if errors.As(err, &gqlErr) {
333+
if gqlErr, ok := errors.AsType[*ghAPI.GraphQLError](err); ok {
336334
return GraphQLError{
337335
GraphQLError: gqlErr,
338336
}

‎api/queries_repo.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,7 @@ func RepoNetwork(client *Client, repos []ghrepo.Interface) (RepoNetworkResult, e
515515
%s
516516
}
517517
`, strings.Join(queries, "")), nil, &graphqlResult)
518-
var graphqlError GraphQLError
519-
if errors.As(err, &graphqlError) {
518+
if graphqlError, ok := errors.AsType[GraphQLError](err); ok {
520519
// If the only errors are that certain repositories are not found,
521520
// continue processing this response instead of returning an error
522521
tolerated := true

‎git/client_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,7 @@ func TestClientParsePushRevision(t *testing.T) {
11271127
}
11281128
trackingRef, err := client.PushRevision(context.Background(), tt.branch)
11291129
if tt.wantError != nil {
1130-
var wantErrorAsGit *GitError
1131-
if errors.As(err, &wantErrorAsGit) {
1130+
if wantErrorAsGit, ok := errors.AsType[*GitError](err); ok {
11321131
var gitError *GitError
11331132
require.ErrorAs(t, err, &gitError)
11341133
assert.Equal(t, wantErrorAsGit.ExitCode, gitError.ExitCode)

‎git/command.go‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ func (gc *Command) Run() error {
2626
err := run.PrepareCmd(gc.Cmd).Run()
2727
if err != nil {
2828
ge := GitError{err: err, Stderr: stderr.String()}
29-
var exitError *exec.ExitError
30-
if errors.As(err, &exitError) {
29+
if exitError, ok := errors.AsType[*exec.ExitError](err); ok {
3130
ge.ExitCode = exitError.ExitCode()
3231
}
3332
return &ge
@@ -50,13 +49,11 @@ func (gc *Command) Output() ([]byte, error) {
5049
// is not a method and so tests can't access it.
5150
// THIS MEANS THAT TESTS WILL NOT CORRECTLY HAVE STDERR SET,
5251
// but at least tests can get the exit code.
53-
var exitErrorWithExitCode errWithExitCode
54-
if errors.As(err, &exitErrorWithExitCode) {
52+
if exitErrorWithExitCode, ok := errors.AsType[errWithExitCode](err); ok {
5553
ge.ExitCode = exitErrorWithExitCode.ExitCode()
5654
}
5755

58-
var exitError *exec.ExitError
59-
if errors.As(err, &exitError) {
56+
if exitError, ok := errors.AsType[*exec.ExitError](err); ok {
6057
ge.Stderr = string(exitError.Stderr)
6158
}
6259
err = &ge

‎go.mod‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/cli/cli/v2
22

3-
go 1.26.0
3+
go 1.27.0
44

5-
toolchain go1.26.8
5+
toolchain go1.27.1
66

77
require (
88
charm.land/bubbles/v2 v2.2.1

‎internal/codespaces/codespaces.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ func waitUntilCodespaceConnectionReady(ctx context.Context, progress progressInd
117117
}, backoff.WithContext(codespaceStatePollingBackoff, ctx))
118118

119119
if err != nil {
120-
var timeoutErr *TimeoutError
121-
if errors.As(err, &timeoutErr) {
120+
if _, ok := errors.AsType[*TimeoutError](err); ok {
122121
return nil, errors.New("timed out while waiting for the codespace to start")
123122
}
124123

‎internal/codespaces/connection/tunnels_api_server_mock.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ func NewMockHttpClient(opts ...mockClientOpt) (*http.Client, error) {
6464
},
6565
Endpoints: []tunnels.TunnelEndpoint{
6666
{
67-
HostID: "host1",
68-
TunnelRelayTunnelEndpoint: tunnels.TunnelRelayTunnelEndpoint{
69-
ClientRelayURI: hostURL,
70-
},
67+
HostID: "host1",
68+
ClientRelayURI: hostURL,
7169
},
7270
},
7371
}

‎internal/config/migration/multi_account.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ func (m MultiAccountDeprecated) Do(c *config.Config) error {
9797
// [github.com, github.localhost]
9898
// We wouldn't expect to have a hosts key when this is the first time anyone
9999
// is logging in with the CLI.
100-
var keyNotFoundError *config.KeyNotFoundError
101-
if errors.As(err, &keyNotFoundError) {
100+
if _, ok := errors.AsType[*config.KeyNotFoundError](err); ok {
102101
return nil
103102
}
104103
if err != nil {
@@ -211,9 +210,8 @@ func migrateConfig(c *config.Config, hostname, username string) error {
211210
c.Set(append(hostsKey, hostname, "users", username), "")
212211

213212
insecureToken, err := c.Get(append(hostsKey, hostname, "oauth_token"))
214-
var keyNotFoundError *config.KeyNotFoundError
215213
// If there is no token then we're done here
216-
if errors.As(err, &keyNotFoundError) {
214+
if _, ok := errors.AsType[*config.KeyNotFoundError](err); ok {
217215
return nil
218216
}
219217

0 commit comments

Comments
 (0)