Skip to content

Commit 7717182

Browse files
authored
Merge branch 'golang:master' into master
2 parents 090372e + ed08d2a commit 7717182

39 files changed

+891
-186
lines changed

api/next/73088.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pkg go/ast, const FilterFuncDuplicates //deprecated #73088
2+
pkg go/ast, const FilterImportDuplicates //deprecated #73088
3+
pkg go/ast, const FilterUnassociatedComments //deprecated #73088
4+
pkg go/ast, func FilterPackage //deprecated #73088
5+
pkg go/ast, func MergePackageFiles //deprecated #73088
6+
pkg go/ast, func PackageExports //deprecated #73088
7+
pkg go/ast, type MergeMode //deprecated #73088
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The [ast.FilterPackage], [ast.PackageExports], and
2+
[ast.MergePackageFiles] functions, and the [MergeMode] type and its
3+
constants, are all deprecated, as they are for use only with the
4+
long-deprecated [ast.Object] and [ast.Package] machinery.

doc/next/9-todo.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<!--
22
Output from relnote todo that was generated and reviewed on 2025-05-23, plus summary info from bug/CL: -->
33

4+
### TODO
5+
6+
**Please turn these into proper release notes**
7+
48
<!-- TODO: CL 420114 has a RELNOTE comment without a suggested text (from RELNOTE comment in https://go.dev/cl/420114) -->
59
all: implement plugin build mode for riscv64
610

src/cmd/compile/internal/ir/expr.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,10 @@ func IsAddressable(n Node) bool {
853853
//
854854
// calling StaticValue on the "int(y)" expression returns the outer
855855
// "g()" expression.
856+
//
857+
// NOTE: StaticValue can return a result with a different type than
858+
// n's type because it can traverse through OCONVNOP operations.
859+
// TODO: consider reapplying OCONVNOP operations to the result. See https://go.dev/cl/676517.
856860
func StaticValue(n Node) Node {
857861
for {
858862
switch n1 := n.(type) {

src/cmd/compile/internal/walk/order.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ func (o *orderState) addrTemp(n ir.Node) ir.Node {
249249
if (v.Op() == ir.OSTRUCTLIT || v.Op() == ir.OARRAYLIT) && !base.Ctxt.IsFIPS() {
250250
if ir.IsZero(v) && 0 < v.Type().Size() && v.Type().Size() <= abi.ZeroValSize {
251251
// This zero value can be represented by the read-only zeroVal.
252-
zeroVal := ir.NewLinksymExpr(v.Pos(), ir.Syms.ZeroVal, v.Type())
252+
zeroVal := ir.NewLinksymExpr(v.Pos(), ir.Syms.ZeroVal, n.Type())
253253
vstat := typecheck.Expr(zeroVal).(*ir.LinksymOffsetExpr)
254254
return vstat
255255
}
256256
if isStaticCompositeLiteral(v) {
257257
// v can be directly represented in the read-only data section.
258258
lit := v.(*ir.CompLitExpr)
259-
vstat := readonlystaticname(lit.Type())
259+
vstat := readonlystaticname(n.Type())
260260
fixedlit(inInitFunction, initKindStatic, lit, vstat, nil) // nil init
261261
vstat = typecheck.Expr(vstat).(*ir.Name)
262262
return vstat

src/cmd/go/internal/modget/get.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
337337
r.performLocalQueries(ctx)
338338
r.performPathQueries(ctx)
339339
r.performToolQueries(ctx)
340+
r.performWorkQueries(ctx)
340341

341342
for {
342343
r.performWildcardQueries(ctx)
@@ -513,6 +514,7 @@ type resolver struct {
513514
pathQueries []*query // package path literal queries in original order
514515
wildcardQueries []*query // path wildcard queries in original order
515516
patternAllQueries []*query // queries with the pattern "all"
517+
workQueries []*query // queries with the pattern "work"
516518
toolQueries []*query // queries with the pattern "tool"
517519

518520
// Indexed "none" queries. These are also included in the slices above;
@@ -578,6 +580,8 @@ func newResolver(ctx context.Context, queries []*query) *resolver {
578580
for _, q := range queries {
579581
if q.pattern == "all" {
580582
r.patternAllQueries = append(r.patternAllQueries, q)
583+
} else if q.pattern == "work" {
584+
r.workQueries = append(r.workQueries, q)
581585
} else if q.pattern == "tool" {
582586
r.toolQueries = append(r.toolQueries, q)
583587
} else if q.patternIsLocal {
@@ -1070,6 +1074,37 @@ func (r *resolver) performToolQueries(ctx context.Context) {
10701074
}
10711075
}
10721076

1077+
// performWorkQueries populates the candidates for each query whose pattern is "work".
1078+
// The candidate module to resolve the work pattern is exactly the single main module.
1079+
func (r *resolver) performWorkQueries(ctx context.Context) {
1080+
for _, q := range r.workQueries {
1081+
q.pathOnce(q.pattern, func() pathSet {
1082+
// TODO(matloob): Maybe export MainModules.mustGetSingleMainModule and call that.
1083+
// There are a few other places outside the modload package where we expect
1084+
// a single main module.
1085+
if len(modload.MainModules.Versions()) != 1 {
1086+
panic("internal error: number of main modules is not exactly one in resolution phase of go get")
1087+
}
1088+
mainModule := modload.MainModules.Versions()[0]
1089+
1090+
// We know what the result is going to be, assuming the main module is not
1091+
// empty, (it's the main module itself) but first check to see that there
1092+
// are packages in the main module, so that if there aren't any, we can
1093+
// return the expected warning that the pattern matched no packages.
1094+
match := modload.MatchInModule(ctx, q.pattern, mainModule, imports.AnyTags())
1095+
if len(match.Errs) > 0 {
1096+
return pathSet{err: match.Errs[0]}
1097+
}
1098+
if len(match.Pkgs) == 0 {
1099+
search.WarnUnmatched([]*search.Match{match})
1100+
return pathSet{} // There are no packages in the main module, so the main module isn't needed to resolve them.
1101+
}
1102+
1103+
return pathSet{pkgMods: []module.Version{mainModule}}
1104+
})
1105+
}
1106+
}
1107+
10731108
// performPatternAllQueries populates the candidates for each query whose
10741109
// pattern is "all".
10751110
//

src/cmd/go/testdata/script/mod_get_nopkgs.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ stderr '^go: example\.net/emptysubdir/subdir/\.\.\.: module example\.net/emptysu
2929
! go get builtin/... # in GOROOT/src, but contains no packages
3030
stderr '^go: builtin/...: malformed module path "builtin": missing dot in first path element$'
3131

32+
cd ../subdirmod
33+
go get work
34+
stderr -count=1 'matched no packages'
35+
3236
-- go.mod --
3337
module example.net/emptysubdir
3438

@@ -38,3 +42,7 @@ go 1.16
3842
package emptysubdir
3943
-- subdir/README.txt --
4044
This module intentionally does not contain any p
45+
-- subdirmod/go.mod --
46+
module example.net/emptysubdir/subdirmod
47+
48+
go 1.16
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Test go get with the work pattern.
2+
3+
# go get work gets dependencies to satisfy missing imports in the
4+
# main modules' package graph. Before the 'work' pattern existed, users
5+
# would have to run './...' in the root of the work (main) module.
6+
cp go.mod go.mod.orig
7+
go get work
8+
cmp go.mod go.mod.want
9+
10+
# 'go get work' and 'go get all' behave very differently. Because
11+
# 'all' evaluates to work packages but also to their dependencies,
12+
# 'go get all' will run the 'get' logic on all the dependency module
13+
# packages, bumping all their modules to the latest versions.
14+
cp go.mod.orig go.mod
15+
go get all
16+
cmp go.mod go.mod.all.want
17+
-- go.mod --
18+
module example.com/a
19+
20+
go 1.25
21+
-- go.mod.want --
22+
module example.com/a
23+
24+
go 1.25
25+
26+
require rsc.io/quote v1.5.2
27+
28+
require (
29+
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
30+
rsc.io/sampler v1.3.0 // indirect
31+
)
32+
-- go.mod.all.want --
33+
module example.com/a
34+
35+
go 1.25
36+
37+
require rsc.io/quote v1.5.2
38+
39+
require (
40+
golang.org/x/text v0.3.0 // indirect
41+
rsc.io/sampler v1.99.99 // indirect
42+
)
43+
-- a.go --
44+
package a
45+
46+
import _ "rsc.io/quote"

src/cmd/go/testdata/script/mod_get_work_incomplete.txt renamed to src/cmd/go/testdata/script/mod_get_workspace_incomplete.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ go get ./...
2020
cmp go.mod go.mod.want
2121
cmp go.sum go.sum.want
2222

23+
# Test go get with an incomplete module using a "work" query.
24+
cp go.mod.orig go.mod
25+
rm go.sum
26+
go get work
27+
cmp go.mod go.mod.want
28+
cmp go.sum go.sum.want
29+
2330
# Test go get with an incomplete module using a path query that can be resolved.
2431
cp go.mod.orig go.mod
2532
rm go.sum

src/crypto/tls/auth.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,18 @@ func legacyTypeAndHashFromPublicKey(pub crypto.PublicKey) (sigType uint8, hash c
149149
var rsaSignatureSchemes = []struct {
150150
scheme SignatureScheme
151151
minModulusBytes int
152-
maxVersion uint16
153152
}{
154153
// RSA-PSS is used with PSSSaltLengthEqualsHash, and requires
155154
// emLen >= hLen + sLen + 2
156-
{PSSWithSHA256, crypto.SHA256.Size()*2 + 2, VersionTLS13},
157-
{PSSWithSHA384, crypto.SHA384.Size()*2 + 2, VersionTLS13},
158-
{PSSWithSHA512, crypto.SHA512.Size()*2 + 2, VersionTLS13},
155+
{PSSWithSHA256, crypto.SHA256.Size()*2 + 2},
156+
{PSSWithSHA384, crypto.SHA384.Size()*2 + 2},
157+
{PSSWithSHA512, crypto.SHA512.Size()*2 + 2},
159158
// PKCS #1 v1.5 uses prefixes from hashPrefixes in crypto/rsa, and requires
160159
// emLen >= len(prefix) + hLen + 11
161-
// TLS 1.3 dropped support for PKCS #1 v1.5 in favor of RSA-PSS.
162-
{PKCS1WithSHA256, 19 + crypto.SHA256.Size() + 11, VersionTLS12},
163-
{PKCS1WithSHA384, 19 + crypto.SHA384.Size() + 11, VersionTLS12},
164-
{PKCS1WithSHA512, 19 + crypto.SHA512.Size() + 11, VersionTLS12},
165-
{PKCS1WithSHA1, 15 + crypto.SHA1.Size() + 11, VersionTLS12},
160+
{PKCS1WithSHA256, 19 + crypto.SHA256.Size() + 11},
161+
{PKCS1WithSHA384, 19 + crypto.SHA384.Size() + 11},
162+
{PKCS1WithSHA512, 19 + crypto.SHA512.Size() + 11},
163+
{PKCS1WithSHA1, 15 + crypto.SHA1.Size() + 11},
166164
}
167165

168166
// signatureSchemesForCertificate returns the list of supported SignatureSchemes
@@ -202,7 +200,7 @@ func signatureSchemesForCertificate(version uint16, cert *Certificate) []Signatu
202200
size := pub.Size()
203201
sigAlgs = make([]SignatureScheme, 0, len(rsaSignatureSchemes))
204202
for _, candidate := range rsaSignatureSchemes {
205-
if size >= candidate.minModulusBytes && version <= candidate.maxVersion {
203+
if size >= candidate.minModulusBytes {
206204
sigAlgs = append(sigAlgs, candidate.scheme)
207205
}
208206
}
@@ -219,10 +217,9 @@ func signatureSchemesForCertificate(version uint16, cert *Certificate) []Signatu
219217
}
220218

221219
// Filter out any unsupported signature algorithms, for example due to
222-
// FIPS 140-3 policy, tlssha1=0, or any downstream changes to defaults.go.
223-
supportedAlgs := supportedSignatureAlgorithms(version)
220+
// FIPS 140-3 policy, tlssha1=0, or protocol version.
224221
sigAlgs = slices.DeleteFunc(sigAlgs, func(sigAlg SignatureScheme) bool {
225-
return !isSupportedSignatureAlgorithm(sigAlg, supportedAlgs)
222+
return isDisabledSignatureAlgorithm(version, sigAlg, false)
226223
})
227224

228225
return sigAlgs

src/crypto/tls/bogo_config.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
"TLS-ECH-Client-Reject-NoChannelID-TLS13": "We don't support sending channel ID",
2121
"TLS-ECH-Client-Reject-NoChannelID-TLS12": "We don't support sending channel ID",
2222

23-
"ServerAuth-SHA1-Fallback*": "We don't ever support SHA-1 in TLS 1.2, so we fail if there are no signature_algorithms",
24-
2523
"TLS-ECH-Client-GREASE-IgnoreHRRExtension": "We don't support ECH GREASE because we don't fallback to plaintext",
2624
"TLS-ECH-Client-NoSupportedConfigs-GREASE": "We don't support ECH GREASE because we don't fallback to plaintext",
2725
"TLS-ECH-Client-GREASEExtensions": "We don't support ECH GREASE because we don't fallback to plaintext",
@@ -40,7 +38,19 @@
4038
"PostQuantumNotEnabledByDefaultInClients": "We do enable it by default!",
4139
"*-Kyber-TLS13": "We don't support Kyber, only ML-KEM (BoGo bug ignoring AllCurves?)",
4240

43-
"*-SignDefault-*": "TODO, partially it encodes BoringSSL defaults, partially we might be missing some implicit behavior of a missing flag",
41+
"*-RSA_PKCS1_SHA256_LEGACY-TLS13": "We don't support the legacy PKCS#1 v1.5 codepoint for TLS 1.3",
42+
"*-Verify-RSA_PKCS1_SHA256_LEGACY-TLS12": "Likewise, we don't know how to handle it in TLS 1.2, so we send the wrong alert",
43+
"*-VerifyDefault-*": "Our signature algorithms are not configurable, so there is no difference between default and supported",
44+
"Ed25519DefaultDisable-*": "We support Ed25519 by default",
45+
"NoCommonSignatureAlgorithms-TLS12-Fallback": "We don't support the legacy RSA exchange (without tlsrsakex=1)",
46+
47+
"*_SHA1-TLS12": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1)",
48+
"Agree-Digest-SHA1": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1)",
49+
"ServerAuth-SHA1-Fallback*": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1), so we fail if there are no signature_algorithms",
50+
51+
"Agree-Digest-SHA256": "We select signature algorithms in peer preference order. We should consider changing this.",
52+
"ECDSACurveMismatch-Verify-TLS13": "We don't enforce the curve when verifying. This is a bug. We need to fix this.",
53+
"*-Verify-ECDSA_P224_SHA256-TLS13": "Side effect of the bug above. BoGo sends a P-256 sigAlg with a P-224 key, and we allow it.",
4454

4555
"V2ClientHello-*": "We don't support SSLv2",
4656
"SendV2ClientHello*": "We don't support SSLv2",
@@ -62,8 +72,10 @@
6272
"CurveID-Resume*": "unexposed curveID is not stored in the ticket yet",
6373
"BadRSAClientKeyExchange-4": "crypto/tls doesn't check the version number in the premaster secret - see processClientKeyExchange comment",
6474
"BadRSAClientKeyExchange-5": "crypto/tls doesn't check the version number in the premaster secret - see processClientKeyExchange comment",
65-
"CheckLeafCurve": "TODO: first pass, this should be fixed",
6675
"SupportTicketsWithSessionID": "We don't support session ID resumption",
76+
"ResumeTLS12SessionID-TLS13": "We don't support session ID resumption",
77+
78+
"CheckLeafCurve": "TODO: first pass, this should be fixed",
6779
"KeyUpdate-RequestACK": "TODO: first pass, this should be fixed",
6880
"SupportedVersionSelection-TLS12": "TODO: first pass, this should be fixed",
6981
"UnsolicitedServerNameAck-TLS-TLS1": "TODO: first pass, this should be fixed",
@@ -88,19 +100,6 @@
88100
"Resume-Server-OmitPSKsOnSecondClientHello": "TODO: first pass, this should be fixed",
89101
"Renegotiate-Server-Forbidden": "TODO: first pass, this should be fixed",
90102
"Renegotiate-Client-Forbidden-1": "TODO: first pass, this should be fixed",
91-
"Client-Sign-RSA_PKCS1_SHA1-TLS13": "TODO: first pass, this should be fixed",
92-
"Client-Sign-RSA_PKCS1_SHA256-TLS13": "TODO: first pass, this should be fixed",
93-
"Client-Sign-RSA_PKCS1_SHA384-TLS13": "TODO: first pass, this should be fixed",
94-
"Client-Sign-RSA_PKCS1_SHA512-TLS13": "TODO: first pass, this should be fixed",
95-
"Client-Sign-ECDSA_SHA1-TLS13": "TODO: first pass, this should be fixed",
96-
"Client-Sign-ECDSA_P224_SHA256-TLS13": "TODO: first pass, this should be fixed",
97-
"ClientAuth-NoFallback-TLS13": "TODO: first pass, this should be fixed",
98-
"ClientAuth-NoFallback-ECDSA": "TODO: first pass, this should be fixed",
99-
"ClientAuth-NoFallback-RSA": "TODO: first pass, this should be fixed",
100-
"ECDSACurveMismatch-Verify-TLS13": "TODO: first pass, this should be fixed",
101-
"Ed25519DefaultDisable-NoAdvertise": "TODO: first pass, this should be fixed",
102-
"Ed25519DefaultDisable-NoAccept": "TODO: first pass, this should be fixed",
103-
"NoCommonSignatureAlgorithms-TLS12-Fallback": "TODO: first pass, this should be fixed",
104103
"UnknownExtension-Client": "TODO: first pass, this should be fixed",
105104
"UnknownUnencryptedExtension-Client-TLS13": "TODO: first pass, this should be fixed",
106105
"UnofferedExtension-Client-TLS13": "TODO: first pass, this should be fixed",
@@ -153,7 +152,6 @@
153152
"TrailingMessageData-TLS13-ClientCertificate-TLS": "TODO: first pass, this should be fixed",
154153
"TrailingMessageData-TLS13-ClientCertificateVerify-TLS": "TODO: first pass, this should be fixed",
155154
"TrailingMessageData-TLS13-ServerCertificate-TLS": "TODO: first pass, this should be fixed",
156-
"ResumeTLS12SessionID-TLS13": "We don't support session ID resumption",
157155
"SkipEarlyData-TLS13": "TODO: first pass, this should be fixed",
158156
"DuplicateKeyShares-TLS13": "TODO: first pass, this should be fixed",
159157
"Server-TooLongSessionID-TLS13": "TODO: first pass, this should be fixed",

0 commit comments

Comments
 (0)