diff -Nru golang-1.12-1.12.4/debian/changelog golang-1.12-1.12.5/debian/changelog
--- golang-1.12-1.12.4/debian/changelog 2019-04-13 18:11:24.000000000 +0000
+++ golang-1.12-1.12.5/debian/changelog 2019-05-10 03:30:59.000000000 +0000
@@ -1,8 +1,14 @@
-golang-1.12 (1.12.4-1~201904131219~delta1~ubuntu19.04.1) disco; urgency=low
+golang-1.12 (1.12.5-1~201905092035~delta1~ubuntu19.04.1) disco; urgency=low
* Auto build.
- -- Launchpad Package Builder Sat, 13 Apr 2019 18:11:24 +0000
+ -- Launchpad Package Builder Fri, 10 May 2019 03:30:59 +0000
+
+golang-1.12 (1.12.5-1) unstable; urgency=medium
+
+ * New upstream version 1.12.5
+
+ -- Dr. Tobias Quathamer Thu, 09 May 2019 22:34:40 +0200
golang-1.12 (1.12.4-1) unstable; urgency=medium
diff -Nru golang-1.12-1.12.4/debian/git-build-recipe.manifest golang-1.12-1.12.5/debian/git-build-recipe.manifest
--- golang-1.12-1.12.4/debian/git-build-recipe.manifest 2019-04-13 18:11:24.000000000 +0000
+++ golang-1.12-1.12.5/debian/git-build-recipe.manifest 2019-05-10 03:30:59.000000000 +0000
@@ -1,2 +1,2 @@
-# git-build-recipe format 0.4 deb-version {debversion}~201904131219~delta1
-lp:~canonical-is-delta/golang/+git/golang-deb git-commit:315c705ca1fe6a7494aa3c21c76a97df0265c985
+# git-build-recipe format 0.4 deb-version {debversion}~201905092035~delta1
+lp:~canonical-is-delta/golang/+git/golang-deb git-commit:471ca4410048bbe1afa24b08dfc4c9635961e585
diff -Nru golang-1.12-1.12.4/doc/contribute.html golang-1.12-1.12.5/doc/contribute.html
--- golang-1.12-1.12.4/doc/contribute.html 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/doc/contribute.html 2019-05-06 21:14:48.000000000 +0000
@@ -46,7 +46,8 @@
Step 2: Configure authentication credentials for the Go Git repository.
Visit go.googlesource.com, click
-on "Generate Password" (top right), and follow the instructions.
+on the gear icon (top right), then on "Obtain password", and follow the
+instructions.
Step 3: Register for Gerrit, the code review tool used by the Go team,
diff -Nru golang-1.12-1.12.4/doc/devel/release.html golang-1.12-1.12.5/doc/devel/release.html
--- golang-1.12-1.12.4/doc/devel/release.html 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/doc/devel/release.html 2019-05-06 21:14:48.000000000 +0000
@@ -62,6 +62,13 @@
Only Linux users who hit this issue need to update.
+
+go1.12.5 (released 2019/05/06) includes fixes to the compiler, the linker,
+the go command, the runtime, and the os
package. See the
+Go
+1.12.5 milestone on our issue tracker for details.
+
+
go1.11 (released 2018/08/24)
@@ -141,6 +148,12 @@
Only Linux users who hit this issue need to update.
+
+go1.11.10 (released 2019/05/06) includes fixes to the runtime and the linker.
+See the Go
+1.11.10 milestone on our issue tracker for details.
+
+
go1.10 (released 2018/02/16)
diff -Nru golang-1.12-1.12.4/doc/go1.12.html golang-1.12-1.12.5/doc/go1.12.html
--- golang-1.12-1.12.4/doc/go1.12.html 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/doc/go1.12.html 2019-05-06 21:14:49.000000000 +0000
@@ -791,7 +791,7 @@
A new BuildInfo
type
exposes the build information read from the running binary, available only in
binaries built with module support. This includes the main package path, main
- module information, and the module dependencies. This type is given though the
+ module information, and the module dependencies. This type is given through the
ReadBuildInfo
function
on BuildInfo
.
diff -Nru golang-1.12-1.12.4/src/cmd/compile/internal/gc/obj.go golang-1.12-1.12.5/src/cmd/compile/internal/gc/obj.go
--- golang-1.12-1.12.4/src/cmd/compile/internal/gc/obj.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/compile/internal/gc/obj.go 2019-05-06 21:14:49.000000000 +0000
@@ -287,7 +287,7 @@
}
}
if x := s.Func.StackObjects; x != nil {
- ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.LOCAL)
+ ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.DUPOK)
}
}
}
diff -Nru golang-1.12-1.12.4/src/cmd/compile/internal/gc/pgen.go golang-1.12-1.12.5/src/cmd/compile/internal/gc/pgen.go
--- golang-1.12-1.12.4/src/cmd/compile/internal/gc/pgen.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/compile/internal/gc/pgen.go 2019-05-06 21:14:49.000000000 +0000
@@ -267,7 +267,7 @@
// Also make sure we allocate a linker symbol
// for the stack object data, for the same reason.
if fn.Func.lsym.Func.StackObjects == nil {
- fn.Func.lsym.Func.StackObjects = lookup(fmt.Sprintf("%s.stkobj", fn.funcname())).Linksym()
+ fn.Func.lsym.Func.StackObjects = Ctxt.Lookup(fn.Func.lsym.Name + ".stkobj")
}
}
}
diff -Nru golang-1.12-1.12.4/src/cmd/go/internal/get/vcs.go golang-1.12-1.12.5/src/cmd/go/internal/get/vcs.go
--- golang-1.12-1.12.4/src/cmd/go/internal/get/vcs.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/go/internal/get/vcs.go 2019-05-06 21:14:49.000000000 +0000
@@ -424,8 +424,8 @@
cmd.Dir = dir
cmd.Env = base.EnvForDir(cmd.Dir, os.Environ())
if cfg.BuildX {
- fmt.Printf("cd %s\n", dir)
- fmt.Printf("%s %s\n", v.cmd, strings.Join(args, " "))
+ fmt.Fprintf(os.Stderr, "cd %s\n", dir)
+ fmt.Fprintf(os.Stderr, "%s %s\n", v.cmd, strings.Join(args, " "))
}
out, err := cmd.Output()
if err != nil {
diff -Nru golang-1.12-1.12.4/src/cmd/go/internal/imports/scan.go golang-1.12-1.12.5/src/cmd/go/internal/imports/scan.go
--- golang-1.12-1.12.4/src/cmd/go/internal/imports/scan.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/go/internal/imports/scan.go 2019-05-06 21:14:49.000000000 +0000
@@ -26,7 +26,7 @@
// If the directory entry is a symlink, stat it to obtain the info for the
// link target instead of the link itself.
if info.Mode()&os.ModeSymlink != 0 {
- info, err = os.Stat(name)
+ info, err = os.Stat(filepath.Join(dir, name))
if err != nil {
continue // Ignore broken symlinks.
}
diff -Nru golang-1.12-1.12.4/src/cmd/go/testdata/script/mod_symlink.txt golang-1.12-1.12.5/src/cmd/go/testdata/script/mod_symlink.txt
--- golang-1.12-1.12.4/src/cmd/go/testdata/script/mod_symlink.txt 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/go/testdata/script/mod_symlink.txt 2019-05-06 21:14:49.000000000 +0000
@@ -2,16 +2,31 @@
[!symlink] skip
# 'go list' should resolve modules of imported packages.
-go list -deps -f '{{.Module}}'
+go list -deps -f '{{.Module}}' .
stdout golang.org/x/text
-# They should continue to resolve if the importing file is a symlink.
+go list -deps -f '{{.Module}}' ./subpkg
+stdout golang.org/x/text
+
+# Create a copy of the module using symlinks in src/links.
mkdir links
-cd links
-symlink go.mod -> ../go.mod
-symlink issue.go -> ../issue.go
+symlink links/go.mod -> $GOPATH/src/go.mod
+symlink links/issue.go -> $GOPATH/src/issue.go
+mkdir links/subpkg
+symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go
-go list -deps -f '{{.Module}}'
+# We should see the copy as a valid module root.
+cd links
+go env GOMOD
+stdout links[/\\]go.mod
+go list -m
+stdout golang.org/issue/28107
+
+# The symlink-based copy should contain the same packages
+# and have the same dependencies as the original.
+go list -deps -f '{{.Module}}' .
+stdout golang.org/x/text
+go list -deps -f '{{.Module}}' ./subpkg
stdout golang.org/x/text
-- go.mod --
@@ -21,3 +36,7 @@
package issue
import _ "golang.org/x/text/language"
+-- subpkg/issue.go --
+package issue
+
+import _ "golang.org/x/text/language"
diff -Nru golang-1.12-1.12.4/src/cmd/link/elf_test.go golang-1.12-1.12.5/src/cmd/link/elf_test.go
--- golang-1.12-1.12.4/src/cmd/link/elf_test.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/link/elf_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,113 @@
+// Copyright 2019 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.
+
+// +build dragonfly freebsd linux netbsd openbsd
+
+package main
+
+import (
+ "internal/testenv"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+var asmSource = `
+ .section .text1,"ax"
+s1:
+ .byte 0
+ .section .text2,"ax"
+s2:
+ .byte 0
+`
+
+var goSource = `
+package main
+func main() {}
+`
+
+// The linker used to crash if an ELF input file had multiple text sections
+// with the same name.
+func TestSectionsWithSameName(t *testing.T) {
+ testenv.MustHaveGoBuild(t)
+ testenv.MustHaveCGO(t)
+ t.Parallel()
+
+ objcopy, err := exec.LookPath("objcopy")
+ if err != nil {
+ t.Skipf("can't find objcopy: %v", err)
+ }
+
+ dir, err := ioutil.TempDir("", "go-link-TestSectionsWithSameName")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(dir)
+
+ gopath := filepath.Join(dir, "GOPATH")
+ env := append(os.Environ(), "GOPATH="+gopath)
+
+ if err := ioutil.WriteFile(filepath.Join(dir, "go.mod"), []byte("module elf_test\n"), 0666); err != nil {
+ t.Fatal(err)
+ }
+
+ asmFile := filepath.Join(dir, "x.s")
+ if err := ioutil.WriteFile(asmFile, []byte(asmSource), 0444); err != nil {
+ t.Fatal(err)
+ }
+
+ goTool := testenv.GoToolPath(t)
+ cmd := exec.Command(goTool, "env", "CC")
+ cmd.Env = env
+ ccb, err := cmd.Output()
+ if err != nil {
+ t.Fatal(err)
+ }
+ cc := strings.TrimSpace(string(ccb))
+
+ cmd = exec.Command(goTool, "env", "GOGCCFLAGS")
+ cmd.Env = env
+ cflagsb, err := cmd.Output()
+ if err != nil {
+ t.Fatal(err)
+ }
+ cflags := strings.Fields(string(cflagsb))
+
+ asmObj := filepath.Join(dir, "x.o")
+ t.Logf("%s %v -c -o %s %s", cc, cflags, asmObj, asmFile)
+ if out, err := exec.Command(cc, append(cflags, "-c", "-o", asmObj, asmFile)...).CombinedOutput(); err != nil {
+ t.Logf("%s", out)
+ t.Fatal(err)
+ }
+
+ asm2Obj := filepath.Join(dir, "x2.syso")
+ t.Logf("%s --rename-section .text2=.text1 %s %s", objcopy, asmObj, asm2Obj)
+ if out, err := exec.Command(objcopy, "--rename-section", ".text2=.text1", asmObj, asm2Obj).CombinedOutput(); err != nil {
+ t.Logf("%s", out)
+ t.Fatal(err)
+ }
+
+ for _, s := range []string{asmFile, asmObj} {
+ if err := os.Remove(s); err != nil {
+ t.Fatal(err)
+ }
+ }
+
+ goFile := filepath.Join(dir, "main.go")
+ if err := ioutil.WriteFile(goFile, []byte(goSource), 0444); err != nil {
+ t.Fatal(err)
+ }
+
+ cmd = exec.Command(goTool, "build")
+ cmd.Dir = dir
+ cmd.Env = env
+ t.Logf("%s build", goTool)
+ if out, err := cmd.CombinedOutput(); err != nil {
+ t.Logf("%s", out)
+ t.Fatal(err)
+ }
+}
diff -Nru golang-1.12-1.12.4/src/cmd/link/internal/loadelf/ldelf.go golang-1.12-1.12.5/src/cmd/link/internal/loadelf/ldelf.go
--- golang-1.12-1.12.4/src/cmd/link/internal/loadelf/ldelf.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/link/internal/loadelf/ldelf.go 2019-05-06 21:14:49.000000000 +0000
@@ -678,6 +678,8 @@
// as well use one large chunk.
// create symbols for elfmapped sections
+ sectsymNames := make(map[string]bool)
+ counter := 0
for i := 0; uint(i) < elfobj.nsect; i++ {
sect = &elfobj.sect[i]
if sect.type_ == SHT_ARM_ATTRIBUTES && sect.name == ".ARM.attributes" {
@@ -709,6 +711,12 @@
}
name := fmt.Sprintf("%s(%s)", pkg, sect.name)
+ for sectsymNames[name] {
+ counter++
+ name = fmt.Sprintf("%s(%s%d)", pkg, sect.name, counter)
+ }
+ sectsymNames[name] = true
+
s := syms.Lookup(name, localSymVersion)
switch int(sect.flags) & (ElfSectFlagAlloc | ElfSectFlagWrite | ElfSectFlagExec) {
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go 2019-05-06 21:14:49.000000000 +0000
@@ -87,6 +87,7 @@
OtherFiles []string // names of non-Go files of this package
Pkg *types.Package // type information about the package
TypesInfo *types.Info // type information about the syntax trees
+ TypesSizes types.Sizes // function for computing sizes of types
// Report reports a Diagnostic, a finding about a specific location
// in the analyzed source code such as a potential mistake.
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go 2019-05-06 21:14:49.000000000 +0000
@@ -246,7 +246,7 @@
var Analyzer = &analysis.Analyzer{
Name: "printf",
- FactTypes: []reflect.Type{reflect.TypeOf(new(isWrapper))},
+ FactTypes: []analysis.Fact{new(isWrapper)},
...
}
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go 2019-05-06 21:14:49.000000000 +0000
@@ -114,7 +114,8 @@
// library we cannot assume types.SizesFor is consistent with arches.
// For now, assume 64-bit norms and print a warning.
// But this warning should really be deferred until we attempt to use
- // arch, which is very unlikely.
+ // arch, which is very unlikely. Better would be
+ // to defer size computation until we have Pass.TypesSizes.
arch.sizes = types.SizesFor("gc", "amd64")
log.Printf("unknown architecture %s", arch.name)
}
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go 2019-05-06 21:14:49.000000000 +0000
@@ -9,7 +9,6 @@
import (
"fmt"
"go/ast"
- "go/build"
"go/format"
"go/parser"
"go/token"
@@ -45,7 +44,7 @@
return nil, nil // doesn't use cgo
}
- cgofiles, info, err := typeCheckCgoSourceFiles(pass.Fset, pass.Pkg, pass.Files, pass.TypesInfo)
+ cgofiles, info, err := typeCheckCgoSourceFiles(pass.Fset, pass.Pkg, pass.Files, pass.TypesInfo, pass.TypesSizes)
if err != nil {
return nil, err
}
@@ -171,7 +170,7 @@
// limited ourselves here to preserving function bodies and initializer
// expressions since that is all that the cgocall analyzer needs.
//
-func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*ast.File, info *types.Info) ([]*ast.File, *types.Info, error) {
+func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*ast.File, info *types.Info, sizes types.Sizes) ([]*ast.File, *types.Info, error) {
const thispkg = "·this·"
// Which files are cgo files?
@@ -269,8 +268,7 @@
Importer: importerFunc(func(path string) (*types.Package, error) {
return importMap[path], nil
}),
- // TODO(adonovan): Sizes should probably be provided by analysis.Pass.
- Sizes: types.SizesFor("gc", build.Default.GOARCH),
+ Sizes: sizes,
Error: func(error) {}, // ignore errors (e.g. unused import)
}
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go 2019-05-06 21:14:49.000000000 +0000
@@ -21,7 +21,16 @@
This analyzer reports a diagnostic for composite literals of struct
types imported from another package that do not use the field-keyed
syntax. Such literals are fragile because the addition of a new field
-(even if unexported) to the struct will cause compilation to fail.`
+(even if unexported) to the struct will cause compilation to fail.
+
+As an example,
+
+ err = &net.DNSConfigError{err}
+
+should be replaced by:
+
+ err = &net.DNSConfigError{Err: err}
+`
var Analyzer = &analysis.Analyzer{
Name: "composites",
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go 2019-05-06 21:14:49.000000000 +0000
@@ -8,7 +8,11 @@
//
// Example of use in another analysis:
//
-// import "golang.org/x/tools/go/analysis/passes/inspect"
+// import (
+// "golang.org/x/tools/go/analysis"
+// "golang.org/x/tools/go/analysis/passes/inspect"
+// "golang.org/x/tools/go/ast/inspector"
+// )
//
// var Analyzer = &analysis.Analyzer{
// ...
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go 2019-05-06 21:14:49.000000000 +0000
@@ -453,15 +453,23 @@
}
// isFormatter reports whether t satisfies fmt.Formatter.
-// Unlike fmt.Stringer, it's impossible to satisfy fmt.Formatter without importing fmt.
-func isFormatter(pass *analysis.Pass, t types.Type) bool {
- for _, imp := range pass.Pkg.Imports() {
- if imp.Path() == "fmt" {
- formatter := imp.Scope().Lookup("Formatter").Type().Underlying().(*types.Interface)
- return types.Implements(t, formatter)
- }
+// The only interface method to look for is "Format(State, rune)".
+func isFormatter(typ types.Type) bool {
+ obj, _, _ := types.LookupFieldOrMethod(typ, false, nil, "Format")
+ fn, ok := obj.(*types.Func)
+ if !ok {
+ return false
}
- return false
+ sig := fn.Type().(*types.Signature)
+ return sig.Params().Len() == 2 &&
+ sig.Results().Len() == 0 &&
+ isNamed(sig.Params().At(0).Type(), "fmt", "State") &&
+ types.Identical(sig.Params().At(1).Type(), types.Typ[types.Rune])
+}
+
+func isNamed(T types.Type, pkgpath, name string) bool {
+ named, ok := T.(*types.Named)
+ return ok && named.Obj().Pkg().Path() == pkgpath && named.Obj().Name() == name
}
// formatState holds the parsed representation of a printf directive such as "%3.*[4]d".
@@ -753,7 +761,7 @@
formatter := false
if state.argNum < len(call.Args) {
if tv, ok := pass.TypesInfo.Types[call.Args[state.argNum]]; ok {
- formatter = isFormatter(pass, tv.Type)
+ formatter = isFormatter(tv.Type)
}
}
@@ -831,7 +839,7 @@
typ := pass.TypesInfo.Types[e].Type
// It's unlikely to be a recursive stringer if it has a Format method.
- if isFormatter(pass, typ) {
+ if isFormatter(typ) {
return false
}
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go 2019-05-06 21:14:49.000000000 +0000
@@ -2,7 +2,6 @@
import (
"go/ast"
- "go/build"
"go/types"
"golang.org/x/tools/go/analysis"
@@ -39,7 +38,7 @@
}
}
// If the type implements fmt.Formatter, we have nothing to check.
- if isFormatter(pass, typ) {
+ if isFormatter(typ) {
return true
}
// If we can use a string, might arg (dynamically) implement the Stringer or Error interface?
@@ -235,5 +234,3 @@
}
return true
}
-
-var archSizes = types.SizesFor("gc", build.Default.GOARCH)
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go 2019-05-06 21:14:49.000000000 +0000
@@ -12,10 +12,8 @@
import (
"go/ast"
- "go/build"
"go/constant"
"go/token"
- "go/types"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
@@ -93,36 +91,9 @@
if t == nil {
return
}
- b, ok := t.Underlying().(*types.Basic)
- if !ok {
- return
- }
- var size int64
- switch b.Kind() {
- case types.Uint8, types.Int8:
- size = 8
- case types.Uint16, types.Int16:
- size = 16
- case types.Uint32, types.Int32:
- size = 32
- case types.Uint64, types.Int64:
- size = 64
- case types.Int, types.Uint:
- size = uintBitSize
- case types.Uintptr:
- size = uintptrBitSize
- default:
- return
- }
+ size := 8 * pass.TypesSizes.Sizeof(t)
if amt >= size {
ident := analysisutil.Format(pass.Fset, x)
pass.Reportf(node.Pos(), "%s (%d bits) too small for shift of %d", ident, size, amt)
}
}
-
-var (
- uintBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uint])
- uintptrBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uintptr])
-)
-
-var archSizes = types.SizesFor("gc", build.Default.GOARCH)
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go 2019-05-06 21:14:49.000000000 +0000
@@ -96,6 +96,11 @@
}
if val == "" || val[0] == ',' {
if field.Anonymous() {
+ // Disable this check enhancement in Go 1.12.1; some
+ // false positives were spotted in the initial 1.12
+ // release. See https://golang.org/issues/30465.
+ return
+
typ, ok := field.Type().Underlying().(*types.Struct)
if !ok {
return
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go 2019-05-06 21:14:49.000000000 +0000
@@ -329,6 +329,7 @@
OtherFiles: cfg.NonGoFiles,
Pkg: pkg,
TypesInfo: info,
+ TypesSizes: tc.Sizes,
ResultOf: inputs,
Report: func(d analysis.Diagnostic) { act.diagnostics = append(act.diagnostics, d) },
ImportObjectFact: facts.ImportObjectFact,
diff -Nru golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go
--- golang-1.12-1.12.4/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go 2019-05-06 21:14:49.000000000 +0000
@@ -14,7 +14,7 @@
// Experiments suggest the inspector's traversals are about 2.5x faster
// than ast.Inspect, but it may take around 5 traversals for this
// benefit to amortize the inspector's construction cost.
-// If efficiency is the primary concern, do not use use Inspector for
+// If efficiency is the primary concern, do not use Inspector for
// one-off traversals.
package inspector
diff -Nru golang-1.12-1.12.4/src/cmd/vet/testdata/src/print2/big.go golang-1.12-1.12.5/src/cmd/vet/testdata/src/print2/big.go
--- golang-1.12-1.12.4/src/cmd/vet/testdata/src/print2/big.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vet/testdata/src/print2/big.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,17 @@
+// Copyright 2019 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 print2
+
+import ( // NOTE: Does not import "fmt"
+ "log"
+ "math/big"
+)
+
+var fmt int
+
+func f() {
+ log.Printf("%d", new(big.Int))
+ log.Printf("%d", 1.0) // ERROR "Printf format %d has arg 1.0 of wrong type float64"
+}
diff -Nru golang-1.12-1.12.4/src/cmd/vet/testdata/src/structtag/structtag.go golang-1.12-1.12.5/src/cmd/vet/testdata/src/structtag/structtag.go
--- golang-1.12-1.12.4/src/cmd/vet/testdata/src/structtag/structtag.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vet/testdata/src/structtag/structtag.go 2019-05-06 21:14:49.000000000 +0000
@@ -6,6 +6,20 @@
package structtag
+import "encoding/json"
+
type StructTagTest struct {
A int "hello" // ERROR "`hello` not compatible with reflect.StructTag.Get: bad syntax for struct tag pair"
}
+
+func Issue30465() {
+ type T1 struct {
+ X string `json:"x"`
+ }
+ type T2 struct {
+ T1
+ X string `json:"x"`
+ }
+ var t2 T2
+ json.Marshal(&t2)
+}
diff -Nru golang-1.12-1.12.4/src/cmd/vet/vet_test.go golang-1.12-1.12.5/src/cmd/vet/vet_test.go
--- golang-1.12-1.12.4/src/cmd/vet/vet_test.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/cmd/vet/vet_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -88,6 +88,7 @@
"method",
"nilfunc",
"print",
+ "print2",
"rangeloop",
"shift",
"structtag",
diff -Nru golang-1.12-1.12.4/src/os/export_unix_test.go golang-1.12-1.12.5/src/os/export_unix_test.go
--- golang-1.12-1.12.4/src/os/export_unix_test.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/src/os/export_unix_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,9 @@
+// Copyright 2019 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.
+
+// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
+
+package os
+
+var SplitPath = splitPath
diff -Nru golang-1.12-1.12.4/src/os/os_unix_test.go golang-1.12-1.12.5/src/os/os_unix_test.go
--- golang-1.12-1.12.4/src/os/os_unix_test.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/os/os_unix_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -281,3 +281,28 @@
t.Parallel()
newFileTest(t, false)
}
+
+func TestSplitPath(t *testing.T) {
+ t.Parallel()
+ for _, tt := range []struct{ path, wantDir, wantBase string }{
+ {"a", ".", "a"},
+ {"a/", ".", "a"},
+ {"a//", ".", "a"},
+ {"a/b", "a", "b"},
+ {"a/b/", "a", "b"},
+ {"a/b/c", "a/b", "c"},
+ {"/a", "/", "a"},
+ {"/a/", "/", "a"},
+ {"/a/b", "/a", "b"},
+ {"/a/b/", "/a", "b"},
+ {"/a/b/c", "/a/b", "c"},
+ {"//a", "/", "a"},
+ {"//a/", "/", "a"},
+ {"///a", "/", "a"},
+ {"///a/", "/", "a"},
+ } {
+ if dir, base := SplitPath(tt.path); dir != tt.wantDir || base != tt.wantBase {
+ t.Errorf("splitPath(%q) = %q, %q, want %q, %q", tt.path, dir, base, tt.wantDir, tt.wantBase)
+ }
+ }
+}
diff -Nru golang-1.12-1.12.4/src/os/path_unix.go golang-1.12-1.12.5/src/os/path_unix.go
--- golang-1.12-1.12.4/src/os/path_unix.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/os/path_unix.go 2019-05-06 21:14:49.000000000 +0000
@@ -38,20 +38,30 @@
func splitPath(path string) (string, string) {
// if no better parent is found, the path is relative from "here"
dirname := "."
- // if no slashes in path, base is path
- basename := path
+
+ // Remove all but one leading slash.
+ for len(path) > 1 && path[0] == '/' && path[1] == '/' {
+ path = path[1:]
+ }
i := len(path) - 1
- // Remove trailing slashes
+ // Remove trailing slashes.
for ; i > 0 && path[i] == '/'; i-- {
path = path[:i]
}
+ // if no slashes in path, base is path
+ basename := path
+
// Remove leading directory path
for i--; i >= 0; i-- {
if path[i] == '/' {
- dirname = path[:i]
+ if i == 0 {
+ dirname = path[:1]
+ } else {
+ dirname = path[:i]
+ }
basename = path[i+1:]
break
}
diff -Nru golang-1.12-1.12.4/src/runtime/export_test.go golang-1.12-1.12.5/src/runtime/export_test.go
--- golang-1.12-1.12.4/src/runtime/export_test.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/runtime/export_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -513,3 +513,116 @@
}
}
}
+
+// Span is a safe wrapper around an mspan, whose memory
+// is managed manually.
+type Span struct {
+ *mspan
+}
+
+func AllocSpan(base, npages uintptr) Span {
+ lock(&mheap_.lock)
+ s := (*mspan)(mheap_.spanalloc.alloc())
+ unlock(&mheap_.lock)
+ s.init(base, npages)
+ return Span{s}
+}
+
+func (s *Span) Free() {
+ lock(&mheap_.lock)
+ mheap_.spanalloc.free(unsafe.Pointer(s.mspan))
+ unlock(&mheap_.lock)
+ s.mspan = nil
+}
+
+func (s Span) Base() uintptr {
+ return s.mspan.base()
+}
+
+func (s Span) Pages() uintptr {
+ return s.mspan.npages
+}
+
+type TreapIter struct {
+ treapIter
+}
+
+func (t TreapIter) Span() Span {
+ return Span{t.span()}
+}
+
+func (t TreapIter) Valid() bool {
+ return t.valid()
+}
+
+func (t TreapIter) Next() TreapIter {
+ return TreapIter{t.next()}
+}
+
+func (t TreapIter) Prev() TreapIter {
+ return TreapIter{t.prev()}
+}
+
+// Treap is a safe wrapper around mTreap for testing.
+//
+// It must never be heap-allocated because mTreap is
+// notinheap.
+//
+//go:notinheap
+type Treap struct {
+ mTreap
+}
+
+func (t *Treap) Start() TreapIter {
+ return TreapIter{t.start()}
+}
+
+func (t *Treap) End() TreapIter {
+ return TreapIter{t.end()}
+}
+
+func (t *Treap) Insert(s Span) {
+ // mTreap uses a fixalloc in mheap_ for treapNode
+ // allocation which requires the mheap_ lock to manipulate.
+ // Locking here is safe because the treap itself never allocs
+ // or otherwise ends up grabbing this lock.
+ lock(&mheap_.lock)
+ t.insert(s.mspan)
+ unlock(&mheap_.lock)
+ t.CheckInvariants()
+}
+
+func (t *Treap) Find(npages uintptr) TreapIter {
+ return TreapIter{treapIter{t.find(npages)}}
+}
+
+func (t *Treap) Erase(i TreapIter) {
+ // mTreap uses a fixalloc in mheap_ for treapNode
+ // freeing which requires the mheap_ lock to manipulate.
+ // Locking here is safe because the treap itself never allocs
+ // or otherwise ends up grabbing this lock.
+ lock(&mheap_.lock)
+ t.erase(i.treapIter)
+ unlock(&mheap_.lock)
+ t.CheckInvariants()
+}
+
+func (t *Treap) RemoveSpan(s Span) {
+ // See Erase about locking.
+ lock(&mheap_.lock)
+ t.removeSpan(s.mspan)
+ unlock(&mheap_.lock)
+ t.CheckInvariants()
+}
+
+func (t *Treap) Size() int {
+ i := 0
+ t.mTreap.treap.walkTreap(func(t *treapNode) {
+ i++
+ })
+ return i
+}
+
+func (t *Treap) CheckInvariants() {
+ t.mTreap.treap.walkTreap(checkTreapNode)
+}
diff -Nru golang-1.12-1.12.4/src/runtime/mgclarge.go golang-1.12-1.12.5/src/runtime/mgclarge.go
--- golang-1.12-1.12.4/src/runtime/mgclarge.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/runtime/mgclarge.go 2019-05-06 21:14:49.000000000 +0000
@@ -134,16 +134,19 @@
return t.npagesKey < npages
}
// t.npagesKey == npages
- return uintptr(unsafe.Pointer(t.spanKey)) < uintptr(unsafe.Pointer(s))
+ return t.spanKey.base() < s.base()
}
if t == nil {
return
}
- if t.spanKey.npages != t.npagesKey || t.spanKey.next != nil {
+ if t.spanKey.next != nil || t.spanKey.prev != nil || t.spanKey.list != nil {
+ throw("span may be on an mSpanList while simultaneously in the treap")
+ }
+ if t.spanKey.npages != t.npagesKey {
println("runtime: checkTreapNode treapNode t=", t, " t.npagesKey=", t.npagesKey,
"t.spanKey.npages=", t.spanKey.npages)
- throw("why does span.npages and treap.ngagesKey do not match?")
+ throw("span.npages and treap.npagesKey do not match")
}
if t.left != nil && lessThan(t.left.npagesKey, t.left.spanKey) {
throw("t.lessThan(t.left.npagesKey, t.left.spanKey) is not false")
@@ -298,24 +301,30 @@
// find searches for, finds, and returns the treap node containing the
// smallest span that can hold npages. If no span has at least npages
// it returns nil.
-// This is slightly more complicated than a simple binary tree search
-// since if an exact match is not found the next larger node is
-// returned.
+// This is a simple binary tree search that tracks the best-fit node found
+// so far. The best-fit node is guaranteed to be on the path to a
+// (maybe non-existent) lowest-base exact match.
func (root *mTreap) find(npages uintptr) *treapNode {
+ var best *treapNode
t := root.treap
for t != nil {
if t.spanKey == nil {
throw("treap node with nil spanKey found")
}
- if t.npagesKey < npages {
- t = t.right
- } else if t.left != nil && t.left.npagesKey >= npages {
+ // If we found an exact match, try to go left anyway. There could be
+ // a span there with a lower base address.
+ //
+ // Don't bother checking nil-ness of left and right here; even if t
+ // becomes nil, we already know the other path had nothing better for
+ // us anyway.
+ if t.npagesKey >= npages {
+ best = t
t = t.left
} else {
- return t
+ t = t.right
}
}
- return nil
+ return best
}
// removeSpan searches for, finds, deletes span along with
diff -Nru golang-1.12-1.12.4/src/runtime/mheap.go golang-1.12-1.12.5/src/runtime/mheap.go
--- golang-1.12-1.12.4/src/runtime/mheap.go 2019-04-11 23:35:26.000000000 +0000
+++ golang-1.12-1.12.5/src/runtime/mheap.go 2019-05-06 21:14:49.000000000 +0000
@@ -1198,16 +1198,6 @@
// heap_released since we already did so earlier.
sysUsed(unsafe.Pointer(s.base()), s.npages<<_PageShift)
s.scavenged = false
-
- // Since we allocated out of a scavenged span, we just
- // grew the RSS. Mitigate this by scavenging enough free
- // space to make up for it.
- //
- // Also, scavengeLargest may cause coalescing, so prevent
- // coalescing with s by temporarily changing its state.
- s.state = mSpanManual
- h.scavengeLargest(s.npages * pageSize)
- s.state = mSpanFree
}
s.unusedsince = 0
diff -Nru golang-1.12-1.12.4/src/runtime/treap_test.go golang-1.12-1.12.5/src/runtime/treap_test.go
--- golang-1.12-1.12.4/src/runtime/treap_test.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/src/runtime/treap_test.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,205 @@
+// Copyright 2019 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 runtime_test
+
+import (
+ "runtime"
+ "testing"
+)
+
+var spanDesc = map[uintptr]uintptr{
+ 0xc0000000: 2,
+ 0xc0006000: 1,
+ 0xc0010000: 8,
+ 0xc0022000: 7,
+ 0xc0034000: 4,
+ 0xc0040000: 5,
+ 0xc0050000: 5,
+ 0xc0060000: 5000,
+}
+
+// Wrap the Treap one more time because go:notinheap doesn't
+// actually follow a structure across package boundaries.
+//
+//go:notinheap
+type treap struct {
+ runtime.Treap
+}
+
+// This test ensures that the treap implementation in the runtime
+// maintains all stated invariants after different sequences of
+// insert, removeSpan, find, and erase. Invariants specific to the
+// treap data structure are checked implicitly: after each mutating
+// operation, treap-related invariants are checked for the entire
+// treap.
+func TestTreap(t *testing.T) {
+ // Set up a bunch of spans allocated into mheap_.
+ spans := make([]runtime.Span, 0, len(spanDesc))
+ for base, pages := range spanDesc {
+ s := runtime.AllocSpan(base, pages)
+ defer s.Free()
+ spans = append(spans, s)
+ }
+ t.Run("Insert", func(t *testing.T) {
+ tr := treap{}
+ // Test just a very basic insert/remove for sanity.
+ tr.Insert(spans[0])
+ tr.RemoveSpan(spans[0])
+ })
+ t.Run("FindTrivial", func(t *testing.T) {
+ tr := treap{}
+ // Test just a very basic find operation for sanity.
+ tr.Insert(spans[0])
+ i := tr.Find(1)
+ if i.Span() != spans[0] {
+ t.Fatal("found unknown span in treap")
+ }
+ tr.RemoveSpan(spans[0])
+ })
+ t.Run("FindBestFit", func(t *testing.T) {
+ // Run this 10 times, recreating the treap each time.
+ // Because of the non-deterministic structure of a treap,
+ // we'll be able to test different structures this way.
+ for i := 0; i < 10; i++ {
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ i := tr.Find(5)
+ if i.Span().Pages() != 5 {
+ t.Fatalf("expected span of size 5, got span of size %d", i.Span().Pages())
+ } else if i.Span().Base() != 0xc0040000 {
+ t.Fatalf("expected span to have the lowest base address, instead got base %x", i.Span().Base())
+ }
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ }
+ })
+ t.Run("Iterate", func(t *testing.T) {
+ t.Run("StartToEnd", func(t *testing.T) {
+ // Ensure progressing an iterator actually goes over the whole treap
+ // from the start and that it iterates over the elements in order.
+ // Also ensures that Start returns a valid iterator.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ nspans := 0
+ lastSize := uintptr(0)
+ for i := tr.Start(); i.Valid(); i = i.Next() {
+ nspans++
+ if lastSize > i.Span().Pages() {
+ t.Fatalf("not iterating in correct order: encountered size %d before %d", lastSize, i.Span().Pages())
+ }
+ lastSize = i.Span().Pages()
+ }
+ if nspans != len(spans) {
+ t.Fatal("failed to iterate forwards over full treap")
+ }
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ })
+ t.Run("EndToStart", func(t *testing.T) {
+ // Ensure progressing an iterator actually goes over the whole treap
+ // from the end and that it iterates over the elements in reverse
+ // order. Also ensures that End returns a valid iterator.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ nspans := 0
+ lastSize := ^uintptr(0)
+ for i := tr.End(); i.Valid(); i = i.Prev() {
+ nspans++
+ if lastSize < i.Span().Pages() {
+ t.Fatalf("not iterating in correct order: encountered size %d before %d", lastSize, i.Span().Pages())
+ }
+ lastSize = i.Span().Pages()
+ }
+ if nspans != len(spans) {
+ t.Fatal("failed to iterate backwards over full treap")
+ }
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ })
+ t.Run("Prev", func(t *testing.T) {
+ // Test the iterator invariant that i.prev().next() == i.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ i := tr.Start().Next().Next()
+ p := i.Prev()
+ if !p.Valid() {
+ t.Fatal("i.prev() is invalid")
+ }
+ if p.Next().Span() != i.Span() {
+ t.Fatal("i.prev().next() != i")
+ }
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ })
+ t.Run("Next", func(t *testing.T) {
+ // Test the iterator invariant that i.next().prev() == i.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ i := tr.Start().Next().Next()
+ n := i.Next()
+ if !n.Valid() {
+ t.Fatal("i.next() is invalid")
+ }
+ if n.Prev().Span() != i.Span() {
+ t.Fatal("i.next().prev() != i")
+ }
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ })
+ })
+ t.Run("EraseOne", func(t *testing.T) {
+ // Test that erasing one iterator correctly retains
+ // all relationships between elements.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ i := tr.Start().Next().Next().Next()
+ s := i.Span()
+ n := i.Next()
+ p := i.Prev()
+ tr.Erase(i)
+ if n.Prev().Span() != p.Span() {
+ t.Fatal("p, n := i.Prev(), i.Next(); n.prev() != p after i was erased")
+ }
+ if p.Next().Span() != n.Span() {
+ t.Fatal("p, n := i.Prev(), i.Next(); p.next() != n after i was erased")
+ }
+ tr.Insert(s)
+ for _, s := range spans {
+ tr.RemoveSpan(s)
+ }
+ })
+ t.Run("EraseAll", func(t *testing.T) {
+ // Test that erasing iterators actually removes nodes from the treap.
+ tr := treap{}
+ for _, s := range spans {
+ tr.Insert(s)
+ }
+ for i := tr.Start(); i.Valid(); {
+ n := i.Next()
+ tr.Erase(i)
+ i = n
+ }
+ if size := tr.Size(); size != 0 {
+ t.Fatalf("should have emptied out treap, %d spans left", size)
+ }
+ })
+}
diff -Nru golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/a.go golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/a.go
--- golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/a.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/a.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,13 @@
+// Copyright 2019 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 a
+
+import "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+ fmt.Println(m)
+}
diff -Nru golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/b.go golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/b.go
--- golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/b.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/b.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,13 @@
+// Copyright 2019 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 b
+
+import "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+ fmt.Println(m)
+}
diff -Nru golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/c.go golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/c.go
--- golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/c.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/c.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,26 @@
+// Copyright 2019 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 c
+
+import (
+ "a"
+ "b"
+)
+
+type HandlerFunc func(*string)
+
+func RouterInit() {
+ //home API
+ homeIndex := &a.IndexController{}
+ GET("/home/index/index", homeIndex.Index)
+ //admin API
+ adminIndex := &b.IndexController{}
+ GET("/admin/index/index", adminIndex.Index)
+ return
+}
+
+func GET(path string, handlers ...HandlerFunc) {
+ return
+}
diff -Nru golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/main.go golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/main.go
--- golang-1.12-1.12.4/test/fixedbugs/issue31252.dir/main.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/test/fixedbugs/issue31252.dir/main.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,11 @@
+// Copyright 2019 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 main
+
+import "c"
+
+func main() {
+ c.RouterInit()
+}
diff -Nru golang-1.12-1.12.4/test/fixedbugs/issue31252.go golang-1.12-1.12.5/test/fixedbugs/issue31252.go
--- golang-1.12-1.12.4/test/fixedbugs/issue31252.go 1970-01-01 00:00:00.000000000 +0000
+++ golang-1.12-1.12.5/test/fixedbugs/issue31252.go 2019-05-06 21:14:49.000000000 +0000
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2019 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 ignored
diff -Nru golang-1.12-1.12.4/VERSION golang-1.12-1.12.5/VERSION
--- golang-1.12-1.12.4/VERSION 2019-04-11 23:35:32.000000000 +0000
+++ golang-1.12-1.12.5/VERSION 2019-05-06 21:14:56.000000000 +0000
@@ -1 +1 @@
-go1.12.4
\ No newline at end of file
+go1.12.5
\ No newline at end of file