Browse Source

go: 1.22.1 -> 1.22.5

update fetch script
toolchain binaries update
fix instruction
go library update
codenv toolchain update pin
24c4d077a2fb5f87554c06c17f0a8f0947e710a2
psydvl 8 months ago
parent
commit
0281735672

+ 5 - 5
build/external_resources/go_tools/go1.22.json

@@ -1,19 +1,19 @@
 {
     "by_platform": {
         "darwin-arm64": {
-            "uri": "sbr:6067021677"
+            "uri": "sbr:6608868508"
         },
         "darwin-x86_64": {
-            "uri": "sbr:6067013969"
+            "uri": "sbr:6608867118"
         },
         "linux-x86_64": {
-            "uri": "sbr:6066996288"
+            "uri": "sbr:6608864313"
         },
         "linux-aarch64": {
-            "uri": "sbr:6067006318"
+            "uri": "sbr:6608865495"
         },
         "win32-x86_64": {
-            "uri": "sbr:6577190334"
+            "uri": "sbr:6608870313"
         }
     }
 }

+ 1 - 1
contrib/go/_std_1.22/src/crypto/tls/handshake_client.go

@@ -526,7 +526,7 @@ func (hs *clientHandshakeState) pickCipherSuite() error {
 		return errors.New("tls: server chose an unconfigured cipher suite")
 	}
 
-	if hs.c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
+	if hs.c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
 		tlsrsakex.IncNonDefault()
 	}
 

+ 1 - 1
contrib/go/_std_1.22/src/crypto/tls/handshake_server.go

@@ -370,7 +370,7 @@ func (hs *serverHandshakeState) pickCipherSuite() error {
 	}
 	c.cipherSuite = hs.suite.id
 
-	if c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
+	if c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
 		tlsrsakex.IncNonDefault()
 	}
 

+ 1 - 0
contrib/go/_std_1.22/src/crypto/x509/x509.go

@@ -780,6 +780,7 @@ type Certificate struct {
 	PolicyIdentifiers []asn1.ObjectIdentifier
 
 	// Policies contains all policy identifiers included in the certificate.
+	// In Go 1.22, encoding/gob cannot handle and ignores this field.
 	Policies []OID
 }
 

+ 8 - 0
contrib/go/_std_1.22/src/go/types/initorder.go

@@ -307,6 +307,14 @@ func (a nodeQueue) Swap(i, j int) {
 
 func (a nodeQueue) Less(i, j int) bool {
 	x, y := a[i], a[j]
+
+	// Prioritize all constants before non-constants. See go.dev/issue/66575/.
+	_, xConst := x.obj.(*Const)
+	_, yConst := y.obj.(*Const)
+	if xConst != yConst {
+		return xConst
+	}
+
 	// nodes are prioritized by number of incoming dependencies (1st key)
 	// and source order (2nd key)
 	return x.ndeps < y.ndeps || x.ndeps == y.ndeps && x.obj.order() < y.obj.order()

+ 42 - 18
contrib/go/_std_1.22/src/go/types/stmt.go

@@ -893,7 +893,7 @@ func (check *Checker) rangeStmt(inner stmtContext, s *ast.RangeStmt) {
 	lhs := [2]Expr{sKey, sValue} // sKey, sValue may be nil
 	rhs := [2]Type{key, val}     // key, val may be nil
 
-	constIntRange := x.mode == constant_ && isInteger(x.typ)
+	rangeOverInt := isInteger(x.typ)
 
 	if isDef {
 		// short variable declaration
@@ -918,19 +918,27 @@ func (check *Checker) rangeStmt(inner stmtContext, s *ast.RangeStmt) {
 				check.errorf(lhs, InvalidSyntaxTree, "cannot declare %s", lhs)
 				obj = NewVar(lhs.Pos(), check.pkg, "_", nil) // dummy variable
 			}
+			assert(obj.typ == nil)
 
-			// initialize lhs variable
-			if constIntRange {
-				check.initVar(obj, &x, "range clause")
-			} else if typ := rhs[i]; typ != nil {
-				x.mode = value
-				x.expr = lhs // we don't have a better rhs expression to use here
-				x.typ = typ
-				check.initVar(obj, &x, "assignment") // error is on variable, use "assignment" not "range clause"
-			} else {
+			// initialize lhs iteration variable, if any
+			typ := rhs[i]
+			if typ == nil {
 				obj.typ = Typ[Invalid]
 				obj.used = true // don't complain about unused variable
+				continue
+			}
+
+			if rangeOverInt {
+				assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
+				check.initVar(obj, &x, "range clause")
+			} else {
+				var y operand
+				y.mode = value
+				y.expr = lhs // we don't have a better rhs expression to use here
+				y.typ = typ
+				check.initVar(obj, &y, "assignment") // error is on variable, use "assignment" not "range clause"
 			}
+			assert(obj.typ != nil)
 		}
 
 		// declare variables
@@ -949,21 +957,36 @@ func (check *Checker) rangeStmt(inner stmtContext, s *ast.RangeStmt) {
 				continue
 			}
 
-			if constIntRange {
+			// assign to lhs iteration variable, if any
+			typ := rhs[i]
+			if typ == nil {
+				continue
+			}
+
+			if rangeOverInt {
+				assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
 				check.assignVar(lhs, nil, &x, "range clause")
-			} else if typ := rhs[i]; typ != nil {
-				x.mode = value
-				x.expr = lhs // we don't have a better rhs expression to use here
-				x.typ = typ
-				check.assignVar(lhs, nil, &x, "assignment") // error is on variable, use "assignment" not "range clause"
+				// If the assignment succeeded, if x was untyped before, it now
+				// has a type inferred via the assignment. It must be an integer.
+				// (go.dev/issues/67027)
+				if x.mode != invalid && !isInteger(x.typ) {
+					check.softErrorf(lhs, InvalidRangeExpr, "cannot use iteration variable of type %s", x.typ)
+				}
+			} else {
+				var y operand
+				y.mode = value
+				y.expr = lhs // we don't have a better rhs expression to use here
+				y.typ = typ
+				check.assignVar(lhs, nil, &y, "assignment") // error is on variable, use "assignment" not "range clause"
 			}
 		}
-	} else if constIntRange {
+	} else if rangeOverInt {
 		// If we don't have any iteration variables, we still need to
 		// check that a (possibly untyped) integer range expression x
 		// is valid.
 		// We do this by checking the assignment _ = x. This ensures
-		// that an untyped x can be converted to a value of type int.
+		// that an untyped x can be converted to a value of its default
+		// type (rune or int).
 		check.assignment(&x, nil, "range clause")
 	}
 
@@ -993,6 +1016,7 @@ func rangeKeyVal(typ Type, allowVersion func(goVersion) bool) (key, val Type, ca
 			return Typ[Int], universeRune, "", false, true // use 'rune' name
 		}
 		if isInteger(typ) {
+			// untyped numeric constants may be representable as integer values
 			if allowVersion != nil && !allowVersion(go1_22) {
 				return bad("requires go1.22 or later")
 			}

+ 12 - 0
contrib/go/_std_1.22/src/go/types/subst.go

@@ -97,6 +97,18 @@ func (subst *subster) typ(typ Type) Type {
 	case *Basic:
 		// nothing to do
 
+	case *Alias:
+		rhs := subst.typ(t.fromRHS)
+		if rhs != t.fromRHS {
+			// This branch cannot be reached because the RHS of an alias
+			// may only contain type parameters of an enclosing function.
+			// Such function bodies are never "instantiated" and thus
+			// substitution is not called on locally declared alias types.
+			// TODO(gri) adjust once parameterized aliases are supported
+			panic("unreachable for unparameterized aliases")
+			// return subst.check.newAlias(t.obj, rhs)
+		}
+
 	case *Array:
 		elem := subst.typOrNil(t.elem)
 		if elem != t.elem {

+ 1 - 1
contrib/go/_std_1.22/src/internal/buildcfg/zbootstrap.go

@@ -13,6 +13,6 @@ const defaultGOPPC64 = `power8`
 const defaultGOEXPERIMENT = ``
 const defaultGO_EXTLINK_ENABLED = ``
 const defaultGO_LDSO = ``
-const version = `go1.22.1`
+const version = `go1.22.5`
 const defaultGOOS = runtime.GOOS
 const defaultGOARCH = runtime.GOARCH

+ 1 - 0
contrib/go/_std_1.22/src/internal/godebugs/table.go

@@ -42,6 +42,7 @@ var All = []Info{
 	{Name: "multipartmaxparts", Package: "mime/multipart"},
 	{Name: "multipathtcp", Package: "net"},
 	{Name: "netdns", Package: "net", Opaque: true},
+	{Name: "netedns0", Package: "net", Changed: 19, Old: "0"},
 	{Name: "panicnil", Package: "runtime", Changed: 21, Old: "1"},
 	{Name: "randautoseed", Package: "math/rand"},
 	{Name: "tarinsecurepath", Package: "archive/tar"},

+ 21 - 11
contrib/go/_std_1.22/src/net/dnsclient_unix.go

@@ -16,6 +16,7 @@ import (
 	"context"
 	"errors"
 	"internal/bytealg"
+	"internal/godebug"
 	"internal/itoa"
 	"io"
 	"os"
@@ -51,6 +52,9 @@ var (
 	errServerTemporarilyMisbehaving = errors.New("server misbehaving")
 )
 
+// netedns0 controls whether we send an EDNS0 additional header.
+var netedns0 = godebug.New("netedns0")
+
 func newRequest(q dnsmessage.Question, ad bool) (id uint16, udpReq, tcpReq []byte, err error) {
 	id = uint16(randInt())
 	b := dnsmessage.NewBuilder(make([]byte, 2, 514), dnsmessage.Header{ID: id, RecursionDesired: true, AuthenticData: ad})
@@ -61,16 +65,20 @@ func newRequest(q dnsmessage.Question, ad bool) (id uint16, udpReq, tcpReq []byt
 		return 0, nil, nil, err
 	}
 
-	// Accept packets up to maxDNSPacketSize.  RFC 6891.
-	if err := b.StartAdditionals(); err != nil {
-		return 0, nil, nil, err
-	}
-	var rh dnsmessage.ResourceHeader
-	if err := rh.SetEDNS0(maxDNSPacketSize, dnsmessage.RCodeSuccess, false); err != nil {
-		return 0, nil, nil, err
-	}
-	if err := b.OPTResource(rh, dnsmessage.OPTResource{}); err != nil {
-		return 0, nil, nil, err
+	if netedns0.Value() == "0" {
+		netedns0.IncNonDefault()
+	} else {
+		// Accept packets up to maxDNSPacketSize.  RFC 6891.
+		if err := b.StartAdditionals(); err != nil {
+			return 0, nil, nil, err
+		}
+		var rh dnsmessage.ResourceHeader
+		if err := rh.SetEDNS0(maxDNSPacketSize, dnsmessage.RCodeSuccess, false); err != nil {
+			return 0, nil, nil, err
+		}
+		if err := b.OPTResource(rh, dnsmessage.OPTResource{}); err != nil {
+			return 0, nil, nil, err
+		}
 	}
 
 	tcpReq, err = b.Finish()
@@ -267,7 +275,9 @@ func extractExtendedRCode(p dnsmessage.Parser, hdr dnsmessage.Header) dnsmessage
 		if ahdr.Type == dnsmessage.TypeOPT {
 			return ahdr.ExtendedRCode(hdr.RCode)
 		}
-		p.SkipAdditional()
+		if err := p.SkipAdditional(); err != nil {
+			return hdr.RCode
+		}
 	}
 }
 

Some files were not shown because too many files changed in this diff