mirror of https://github.com/golang/go.git
Compare commits
6 Commits
fcde8a618e
...
a6764c97a8
| Author | SHA1 | Date |
|---|---|---|
|
|
a6764c97a8 | |
|
|
49cdf0c42e | |
|
|
3bf1eecbd3 | |
|
|
8ed23a2936 | |
|
|
ef60769b46 | |
|
|
e693ddf520 |
|
|
@ -1235,6 +1235,8 @@
|
|||
// This flag is mainly for tools that understand Go version dependencies.
|
||||
// Users should prefer 'go get toolchain@version'.
|
||||
//
|
||||
// The -droptoolchain flag removes the toolchain directive from the go.mod file.
|
||||
//
|
||||
// The -exclude=path@version and -dropexclude=path@version flags
|
||||
// add and drop an exclusion for the given module path and version.
|
||||
// Note that -exclude=path@version is a no-op if that exclusion already exists.
|
||||
|
|
@ -1264,7 +1266,7 @@
|
|||
//
|
||||
// The -godebug, -dropgodebug, -require, -droprequire, -exclude, -dropexclude,
|
||||
// -replace, -dropreplace, -retract, -dropretract, -tool, -droptool, -ignore,
|
||||
// and -dropignore editing flags may be repeated, and the changes are applied
|
||||
// -dropignore, and -droptoolchain editing flags may be repeated, and the changes are applied
|
||||
// in the order given.
|
||||
//
|
||||
// The -print flag prints the final go.mod in its text format instead of
|
||||
|
|
@ -1806,7 +1808,7 @@
|
|||
// To view the current telemetry mode, run "go telemetry".
|
||||
// To disable telemetry uploading, but keep local data collection, run
|
||||
// "go telemetry local".
|
||||
// To enable both collection and uploading, run “go telemetry on”.
|
||||
// To enable both collection and uploading, run "go telemetry on".
|
||||
// To disable both collection and uploading, run "go telemetry off".
|
||||
//
|
||||
// The current telemetry mode is also available as the value of the
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ The -toolchain=version flag sets the Go toolchain to use.
|
|||
This flag is mainly for tools that understand Go version dependencies.
|
||||
Users should prefer 'go get toolchain@version'.
|
||||
|
||||
The -droptoolchain flag removes the toolchain directive from the go.mod file.
|
||||
|
||||
The -exclude=path@version and -dropexclude=path@version flags
|
||||
add and drop an exclusion for the given module path and version.
|
||||
Note that -exclude=path@version is a no-op if that exclusion already exists.
|
||||
|
|
@ -95,7 +97,7 @@ for the given path.
|
|||
|
||||
The -godebug, -dropgodebug, -require, -droprequire, -exclude, -dropexclude,
|
||||
-replace, -dropreplace, -retract, -dropretract, -tool, -droptool, -ignore,
|
||||
and -dropignore editing flags may be repeated, and the changes are applied
|
||||
-dropignore, and -droptoolchain editing flags may be repeated, and the changes are applied
|
||||
in the order given.
|
||||
|
||||
The -print flag prints the final go.mod in its text format instead of
|
||||
|
|
@ -169,13 +171,14 @@ See https://golang.org/ref/mod#go-mod-edit for more about 'go mod edit'.
|
|||
}
|
||||
|
||||
var (
|
||||
editFmt = cmdEdit.Flag.Bool("fmt", false, "")
|
||||
editGo = cmdEdit.Flag.String("go", "", "")
|
||||
editToolchain = cmdEdit.Flag.String("toolchain", "", "")
|
||||
editJSON = cmdEdit.Flag.Bool("json", false, "")
|
||||
editPrint = cmdEdit.Flag.Bool("print", false, "")
|
||||
editModule = cmdEdit.Flag.String("module", "", "")
|
||||
edits []func(*modfile.File) // edits specified in flags
|
||||
editFmt = cmdEdit.Flag.Bool("fmt", false, "")
|
||||
editGo = cmdEdit.Flag.String("go", "", "")
|
||||
editToolchain = cmdEdit.Flag.String("toolchain", "", "")
|
||||
editJSON = cmdEdit.Flag.Bool("json", false, "")
|
||||
editPrint = cmdEdit.Flag.Bool("print", false, "")
|
||||
editModule = cmdEdit.Flag.String("module", "", "")
|
||||
editDropToolchain = cmdEdit.Flag.Bool("droptoolchain", false, "drop the toolchain directive")
|
||||
edits []func(*modfile.File) // edits specified in flags
|
||||
)
|
||||
|
||||
type flagFunc func(string)
|
||||
|
|
@ -213,6 +216,7 @@ func runEdit(ctx context.Context, cmd *base.Command, args []string) {
|
|||
*editJSON ||
|
||||
*editPrint ||
|
||||
*editFmt ||
|
||||
*editDropToolchain ||
|
||||
len(edits) > 0
|
||||
|
||||
if !anyFlags {
|
||||
|
|
@ -223,6 +227,10 @@ func runEdit(ctx context.Context, cmd *base.Command, args []string) {
|
|||
base.Fatalf("go: cannot use both -json and -print")
|
||||
}
|
||||
|
||||
if *editToolchain != "" && *editDropToolchain {
|
||||
base.Fatalf("go: -toolchain and -droptoolchain are mutually exclusive")
|
||||
}
|
||||
|
||||
if len(args) > 1 {
|
||||
base.Fatalf("go: too many arguments")
|
||||
}
|
||||
|
|
@ -278,6 +286,9 @@ func runEdit(ctx context.Context, cmd *base.Command, args []string) {
|
|||
base.Fatalf("go: internal error: %v", err)
|
||||
}
|
||||
}
|
||||
if *editDropToolchain {
|
||||
modFile.DropToolchainStmt()
|
||||
}
|
||||
|
||||
if len(edits) > 0 {
|
||||
for _, edit := range edits {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# Test for go mod edit -droptoolchain
|
||||
|
||||
# Setup
|
||||
env GO111MODULE=on
|
||||
env GOFLAGS=-mod=mod
|
||||
|
||||
# Create a new module
|
||||
! exists go.mod
|
||||
go mod init example.com/test
|
||||
exists go.mod
|
||||
|
||||
# Check that the toolchain directive is not present initially
|
||||
! grep toolchain go.mod
|
||||
|
||||
# Add a toolchain directive
|
||||
go mod edit -toolchain=go1.21
|
||||
grep 'toolchain go1.21' go.mod
|
||||
|
||||
# Remove the toolchain directive using -droptoolchain
|
||||
go mod edit -droptoolchain
|
||||
! grep toolchain go.mod
|
||||
|
||||
# Add a toolchain directive again
|
||||
go mod edit -toolchain=go1.22
|
||||
grep 'toolchain go1.22' go.mod
|
||||
|
||||
# Make sure that -toolchain=none still works as before
|
||||
go mod edit -toolchain=none
|
||||
! grep toolchain go.mod
|
||||
|
||||
# Add a toolchain directive again and use -droptoolchain with an argument (should be ignored)
|
||||
go mod edit -toolchain=go1.23
|
||||
grep 'toolchain go1.23' go.mod
|
||||
go mod edit -droptoolchain
|
||||
! grep toolchain go.mod
|
||||
|
|
@ -82,7 +82,7 @@ func newGCM(cipher Block, nonceSize, tagSize int) (AEAD, error) {
|
|||
|
||||
// NewGCMWithRandomNonce returns the given cipher wrapped in Galois Counter
|
||||
// Mode, with randomly-generated nonces. The cipher must have been created by
|
||||
// [aes.NewCipher].
|
||||
// [crypto/aes.NewCipher].
|
||||
//
|
||||
// It generates a random 96-bit nonce, which is prepended to the ciphertext by Seal,
|
||||
// and is extracted from the ciphertext by Open. The NonceSize of the AEAD is zero,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
PACKAGE issue62640
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue62640
|
||||
|
||||
FILENAMES
|
||||
testdata/issue62640.go
|
||||
|
||||
TYPES
|
||||
//
|
||||
type E struct{}
|
||||
|
||||
// F should be hidden within S because of the S.F field.
|
||||
func (E) F()
|
||||
|
||||
//
|
||||
type S struct {
|
||||
E
|
||||
F int
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
PACKAGE issue62640
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue62640
|
||||
|
||||
FILENAMES
|
||||
testdata/issue62640.go
|
||||
|
||||
TYPES
|
||||
//
|
||||
type E struct{}
|
||||
|
||||
// F should be hidden within S because of the S.F field.
|
||||
func (E) F()
|
||||
|
||||
//
|
||||
type S struct {
|
||||
E
|
||||
F int
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
PACKAGE issue62640
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue62640
|
||||
|
||||
FILENAMES
|
||||
testdata/issue62640.go
|
||||
|
||||
TYPES
|
||||
//
|
||||
type E struct{}
|
||||
|
||||
// F should be hidden within S because of the S.F field.
|
||||
func (E) F()
|
||||
|
||||
//
|
||||
type S struct {
|
||||
E
|
||||
F int
|
||||
}
|
||||
|
||||
// F should be hidden within S because of the S.F field.
|
||||
func (S) F()
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2025 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.
|
||||
|
||||
package issue62640
|
||||
|
||||
type E struct{}
|
||||
|
||||
// F should be hidden within S because of the S.F field.
|
||||
func (E) F() {}
|
||||
|
||||
type S struct {
|
||||
E
|
||||
F int
|
||||
}
|
||||
|
|
@ -312,8 +312,10 @@ type heapArena struct {
|
|||
// during marking.
|
||||
pageSpecials [pagesPerArena / 8]uint8
|
||||
|
||||
// pageUseSpanDartboard is a bitmap that indicates which spans are
|
||||
// heap spans and also gcUsesSpanDartboard.
|
||||
// pageUseSpanInlineMarkBits is a bitmap where each bit corresponds
|
||||
// to a span, as only spans one page in size can have inline mark bits.
|
||||
// The bit indicates that the span has a spanInlineMarkBits struct
|
||||
// stored directly at the top end of the span's memory.
|
||||
pageUseSpanInlineMarkBits [pagesPerArena / 8]uint8
|
||||
|
||||
// checkmarks stores the debug.gccheckmark state. It is only
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2025 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.
|
||||
|
||||
package synctest_test
|
||||
|
||||
import "testing"
|
||||
|
||||
// helperLog is a t.Helper which logs.
|
||||
// Since it is a helper, the log prefix should contain
|
||||
// the caller's file, not helper_test.go.
|
||||
func helperLog(t *testing.T, s string) {
|
||||
t.Helper()
|
||||
t.Log(s)
|
||||
}
|
||||
|
|
@ -140,6 +140,18 @@ func TestRun(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestHelper(t *testing.T) {
|
||||
runTest(t, []string{"-test.v"}, func() {
|
||||
synctest.Test(t, func(t *testing.T) {
|
||||
helperLog(t, "log in helper")
|
||||
})
|
||||
}, `^=== RUN TestHelper
|
||||
synctest_test.go:.* log in helper
|
||||
--- PASS: TestHelper.*
|
||||
PASS
|
||||
$`)
|
||||
}
|
||||
|
||||
func wantPanic(t *testing.T, want string) {
|
||||
if e := recover(); e != nil {
|
||||
if got := fmt.Sprint(e); got != want {
|
||||
|
|
|
|||
|
|
@ -1261,6 +1261,9 @@ func (c *common) Skipped() bool {
|
|||
// When printing file and line information, that function will be skipped.
|
||||
// Helper may be called simultaneously from multiple goroutines.
|
||||
func (c *common) Helper() {
|
||||
if c.isSynctest {
|
||||
c = c.parent
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
if c.helperPCs == nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue