Updates #54265.
Change-Id: Ia1c9486484c73c565bb4f78234dedff6d929ed42
Reviewed-on: https://go-review.googlesource.com/c/go/+/511656
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || (solaris && go1.20)
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package base
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !(solaris && go1.20)
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
package base
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build go1.19
-// +build go1.19
-
package main
import (
+++ /dev/null
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.19
-// +build !go1.19
-
-package main
-
-import (
- "os"
- "os/exec"
- "strings"
-)
-
-// setDir sets cmd.Dir to dir, and also adds PWD=dir to cmd's environment.
-func setDir(cmd *exec.Cmd, dir string) {
- cmd.Dir = dir
- setEnv(cmd, "PWD", dir)
-}
-
-// setEnv sets cmd.Env so that key = value.
-func setEnv(cmd *exec.Cmd, key, value string) {
- kv := key + "=" + value
- if cmd.Env == nil {
- cmd.Env = os.Environ()
- }
- cmd.Env = append(cmd.Env, kv)
-}
-
-// unsetEnv sets cmd.Env so that key is not present in the environment.
-func unsetEnv(cmd *exec.Cmd, key string) {
- if cmd.Env == nil {
- cmd.Env = os.Environ()
- }
-
- prefix := key + "="
- newEnv := []string{}
- for _, entry := range cmd.Env {
- if strings.HasPrefix(entry, prefix) {
- continue
- }
- newEnv = append(newEnv, entry)
- // key may appear multiple times, so keep going.
- }
- cmd.Env = newEnv
-}
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Go 1.20 and later requires Go 1.17 as the bootstrap toolchain.
+// Go 1.22 and later requires Go 1.20 as the bootstrap toolchain.
// If cmd/dist is built using an earlier Go version, this file will be
// included in the build and cause an error like:
//
// % GOROOT_BOOTSTRAP=$HOME/sdk/go1.16 ./make.bash
// Building Go cmd/dist using /Users/rsc/sdk/go1.16. (go1.16 darwin/amd64)
-// found packages main (build.go) and building_Go_requires_Go_1_17_13_or_later (notgo117.go) in /Users/rsc/go/src/cmd/dist
+// found packages main (build.go) and building_Go_requires_Go_1_20_6_or_later (notgo120.go) in /Users/rsc/go/src/cmd/dist
// %
//
// which is the best we can do under the circumstances.
// See go.dev/issue/44505 for more background on
// why Go moved on from Go 1.4 for bootstrap.
-//go:build !go1.17
-// +build !go1.17
+//go:build !go1.20
+// +build !go1.20
-package building_Go_requires_Go_1_17_13_or_later
+package building_Go_requires_Go_1_20_6_or_later
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || (solaris && go1.20)
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package bio
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !(solaris && go1.20)
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
package bio
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build darwin && go1.20
+//go:build darwin
package ld
+++ /dev/null
-// Copyright 2022 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build darwin && !go1.20
-
-package ld
-
-import (
- "syscall"
- "unsafe"
-)
-
-func msync(b []byte, flags int) (err error) {
- var p unsafe.Pointer
- if len(b) > 0 {
- p = unsafe.Pointer(&b[0])
- }
- _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(p), uintptr(len(b)), uintptr(flags))
- if errno != 0 {
- return errno
- }
- return nil
-}
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || (solaris && go1.20)
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package ld
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !(solaris && go1.20) && !windows
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows
package ld
}
func (t *Type) GcSlice(begin, end uintptr) []byte {
- return unsafeSliceFor(t.GCData, int(end))[begin:]
+ return unsafe.Slice(t.GCData, int(end))[begin:]
}
// Method on non-interface type
return ""
}
i, l := n.ReadVarint(1)
- return unsafeStringFor(n.DataChecked(1+i, "non-empty string"), l)
+ return unsafe.String(n.DataChecked(1+i, "non-empty string"), l)
}
// Tag returns the tag string for n, or empty if there is none.
}
i, l := n.ReadVarint(1)
i2, l2 := n.ReadVarint(1 + i + l)
- return unsafeStringFor(n.DataChecked(1+i+l+i2, "non-empty string"), l2)
+ return unsafe.String(n.DataChecked(1+i+l+i2, "non-empty string"), l2)
}
func NewName(n, tag string, exported, embedded bool) Name {
+++ /dev/null
-// Copyright 2023 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.20
-// +build !go1.20
-
-package abi
-
-import "unsafe"
-
-type (
- stringHeader struct {
- Data *byte
- Len int
- }
- sliceHeader struct {
- Data *byte
- Len int
- Cap int
- }
-)
-
-func unsafeStringFor(b *byte, l int) string {
- h := stringHeader{Data: b, Len: l}
- return *(*string)(unsafe.Pointer(&h))
-}
-
-func unsafeSliceFor(b *byte, l int) []byte {
- h := sliceHeader{Data: b, Len: l, Cap: l}
- return *(*[]byte)(unsafe.Pointer(&h))
-}
+++ /dev/null
-// Copyright 2023 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.20
-// +build go1.20
-
-package abi
-
-import "unsafe"
-
-func unsafeStringFor(b *byte, l int) string {
- return unsafe.String(b, l)
-}
-
-func unsafeSliceFor(b *byte, l int) []byte {
- return unsafe.Slice(b, l)
-}