mirror of
https://github.com/golang/go.git
synced 2025-11-01 17:20:56 +00:00
vendor/golang_org/x: move to internal/x
Packages in vendor/ directories have a "vendor/" path prefix in GOPATH mode, but intentionally do not in module mode. Since the import path is embedded in the compiled output, changing that path invalidates cache entries and causes cmd/go to try to rebuild (and reinstall) the vendored libraries, which will fail if the directory containing those libraries is read-only. If I understood correctly, this is the approach Russ suggested as an alternative to https://golang.org/cl/136138. Fixes #27285 Fixes #26988 Change-Id: I8a2507fa892b84cde0a803aaa79e460723da572b Reviewed-on: https://go-review.googlesource.com/c/147443 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
70a684cf44
commit
2012227b01
196 changed files with 148 additions and 152 deletions
|
|
@ -442,13 +442,8 @@ func (w *Walker) Import(name string) (*types.Package, error) {
|
||||||
}
|
}
|
||||||
w.imported[name] = &importing
|
w.imported[name] = &importing
|
||||||
|
|
||||||
root := w.root
|
|
||||||
if strings.HasPrefix(name, "golang_org/x/") {
|
|
||||||
root = filepath.Join(root, "vendor")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine package files.
|
// Determine package files.
|
||||||
dir := filepath.Join(root, filepath.FromSlash(name))
|
dir := filepath.Join(w.root, filepath.FromSlash(name))
|
||||||
if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
|
if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
|
||||||
log.Fatalf("no source in tree for import %q: %v", name, err)
|
log.Fatalf("no source in tree for import %q: %v", name, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1207,22 +1207,6 @@ func TestImportCycle(t *testing.T) {
|
||||||
tg.run("list", "-e", "-json", "selfimport")
|
tg.run("list", "-e", "-json", "selfimport")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestListImportMap(t *testing.T) {
|
|
||||||
skipIfGccgo(t, "gccgo does not have standard packages")
|
|
||||||
tg := testgo(t)
|
|
||||||
defer tg.cleanup()
|
|
||||||
tg.parallel()
|
|
||||||
tg.run("list", "-f", "{{.ImportPath}}: {{.ImportMap}}", "net", "fmt")
|
|
||||||
tg.grepStdout(`^net: map\[(.* )?golang_org/x/net/dns/dnsmessage:vendor/golang_org/x/net/dns/dnsmessage.*\]`, "net/http should have rewritten dnsmessage import")
|
|
||||||
tg.grepStdout(`^fmt: map\[\]`, "fmt should have no rewritten imports")
|
|
||||||
tg.run("list", "-deps", "-test", "-f", "{{.ImportPath}} MAP: {{.ImportMap}}\n{{.ImportPath}} IMPORT: {{.Imports}}", "fmt")
|
|
||||||
tg.grepStdout(`^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]`, "flag [fmt.test] should import fmt [fmt.test] as fmt")
|
|
||||||
tg.grepStdout(`^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]`, "fmt.test should import testing [fmt.test] as testing")
|
|
||||||
tg.grepStdout(`^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]`, "fmt.test should import testing [fmt.test] as testing")
|
|
||||||
tg.grepStdoutNot(`^fmt\.test MAP: map\[(.* )?os:`, "fmt.test should not import a modified os")
|
|
||||||
tg.grepStdout(`^fmt\.test IMPORT: \[fmt \[fmt\.test\] fmt_test \[fmt\.test\] os testing \[fmt\.test\] testing/internal/testdeps \[fmt\.test\]\]`, "wrong imports for fmt.test")
|
|
||||||
}
|
|
||||||
|
|
||||||
// cmd/go: custom import path checking should not apply to Go packages without import comment.
|
// cmd/go: custom import path checking should not apply to Go packages without import comment.
|
||||||
func TestIssue10952(t *testing.T) {
|
func TestIssue10952(t *testing.T) {
|
||||||
testenv.MustHaveExternalNetwork(t)
|
testenv.MustHaveExternalNetwork(t)
|
||||||
|
|
|
||||||
|
|
@ -1051,20 +1051,6 @@ func disallowVendor(srcDir string, importer *Package, importerPath, path string,
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modules must not import vendor packages in the standard library,
|
|
||||||
// but the usual vendor visibility check will not catch them
|
|
||||||
// because the module loader presents them with an ImportPath starting
|
|
||||||
// with "golang_org/" instead of "vendor/".
|
|
||||||
if p.Standard && !importer.Standard && strings.HasPrefix(p.ImportPath, "golang_org") {
|
|
||||||
perr := *p
|
|
||||||
perr.Error = &PackageError{
|
|
||||||
ImportStack: stk.Copy(),
|
|
||||||
Err: "use of vendored package " + path + " not allowed",
|
|
||||||
}
|
|
||||||
perr.Incomplete = true
|
|
||||||
return &perr
|
|
||||||
}
|
|
||||||
|
|
||||||
if perr := disallowVendorVisibility(srcDir, p, stk); perr != p {
|
if perr := disallowVendorVisibility(srcDir, p, stk); perr != p {
|
||||||
return perr
|
return perr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,6 @@ func Import(path string) (m module.Version, dir string, err error) {
|
||||||
|
|
||||||
// Is the package in the standard library?
|
// Is the package in the standard library?
|
||||||
if search.IsStandardImportPath(path) {
|
if search.IsStandardImportPath(path) {
|
||||||
if strings.HasPrefix(path, "golang_org/") {
|
|
||||||
return module.Version{}, filepath.Join(cfg.GOROOT, "src/vendor", path), nil
|
|
||||||
}
|
|
||||||
if goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, path) {
|
if goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, path) {
|
||||||
dir := filepath.Join(cfg.GOROOT, "src", path)
|
dir := filepath.Join(cfg.GOROOT, "src", path)
|
||||||
return module.Version{}, dir, nil
|
return module.Version{}, dir, nil
|
||||||
|
|
|
||||||
25
src/cmd/go/testdata/script/list_importmap.txt
vendored
Normal file
25
src/cmd/go/testdata/script/list_importmap.txt
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# gccgo does not have standard packages.
|
||||||
|
[gccgo] skip
|
||||||
|
|
||||||
|
# fmt should have no rewritten imports.
|
||||||
|
# The import from a/b should map c/d to a's vendor directory.
|
||||||
|
go list -f '{{.ImportPath}}: {{.ImportMap}}' fmt a/b
|
||||||
|
stdout 'fmt: map\[\]'
|
||||||
|
stdout 'a/b: map\[c/d:a/vendor/c/d\]'
|
||||||
|
|
||||||
|
# flag [fmt.test] should import fmt [fmt.test] as fmt
|
||||||
|
# fmt.test should import testing [fmt.test] as testing
|
||||||
|
# fmt.test should not import a modified os
|
||||||
|
go list -deps -test -f '{{.ImportPath}} MAP: {{.ImportMap}}{{"\n"}}{{.ImportPath}} IMPORT: {{.Imports}}' fmt
|
||||||
|
stdout '^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]'
|
||||||
|
stdout '^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]'
|
||||||
|
! stdout '^fmt\.test MAP: map\[(.* )?os:'
|
||||||
|
stdout '^fmt\.test IMPORT: \[fmt \[fmt\.test\] fmt_test \[fmt\.test\] os testing \[fmt\.test\] testing/internal/testdeps \[fmt\.test\]\]'
|
||||||
|
|
||||||
|
|
||||||
|
-- a/b/b.go --
|
||||||
|
package b
|
||||||
|
|
||||||
|
import _ "c/d"
|
||||||
|
-- a/vendor/c/d/d.go --
|
||||||
|
package d
|
||||||
2
src/cmd/go/testdata/script/list_std.txt
vendored
2
src/cmd/go/testdata/script/list_std.txt
vendored
|
|
@ -8,5 +8,5 @@ go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./...
|
||||||
|
|
||||||
# our vendored packages should be reported as standard
|
# our vendored packages should be reported as standard
|
||||||
go list std cmd
|
go list std cmd
|
||||||
stdout golang_org/x/net/http2/hpack
|
stdout internal/x/net/http2/hpack
|
||||||
stdout cmd/vendor/golang\.org/x/arch/x86/x86asm
|
stdout cmd/vendor/golang\.org/x/arch/x86/x86asm
|
||||||
|
|
|
||||||
13
src/cmd/go/testdata/script/mod_internal.txt
vendored
13
src/cmd/go/testdata/script/mod_internal.txt
vendored
|
|
@ -18,15 +18,6 @@ stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
! go build ./fromstd
|
! go build ./fromstd
|
||||||
stderr 'use of internal package internal/testenv not allowed'
|
stderr 'use of internal package internal/testenv not allowed'
|
||||||
|
|
||||||
# Packages found via standard-library vendoring should not leak.
|
|
||||||
! go build ./fromstdvendor
|
|
||||||
stderr 'use of vendored package golang_org/x/net/http/httpguts not allowed'
|
|
||||||
|
|
||||||
env GO111MODULE=off
|
|
||||||
! go build ./fromstdvendor
|
|
||||||
stderr 'cannot find package "golang_org/x/net/http/httpguts" in any of:'
|
|
||||||
env GO111MODULE=on
|
|
||||||
|
|
||||||
# Dependencies should be able to use their own internal modules...
|
# Dependencies should be able to use their own internal modules...
|
||||||
rm go.mod
|
rm go.mod
|
||||||
go mod init golang.org/notx
|
go mod init golang.org/notx
|
||||||
|
|
@ -83,10 +74,6 @@ import _ "golang.org/notx/useinternal"
|
||||||
package fromstd
|
package fromstd
|
||||||
import _ "internal/testenv"
|
import _ "internal/testenv"
|
||||||
|
|
||||||
-- fromstdvendor/useinternal.go --
|
|
||||||
package fromstdvendor
|
|
||||||
import _ "golang_org/x/net/http/httpguts"
|
|
||||||
|
|
||||||
-- replace/golang.org/notx/internal/go.mod --
|
-- replace/golang.org/notx/internal/go.mod --
|
||||||
module golang.org/x/internal
|
module golang.org/x/internal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ go list -f '{{.TestImports}}'
|
||||||
stdout net/http # from .TestImports
|
stdout net/http # from .TestImports
|
||||||
|
|
||||||
go list -test -f '{{.Deps}}'
|
go list -test -f '{{.Deps}}'
|
||||||
stdout golang_org/x/crypto # dep of .TestImports
|
stdout internal/x/crypto # dep of .TestImports
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module m
|
module m
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"golang_org/x/crypto/chacha20poly1305"
|
|
||||||
"hash"
|
"hash"
|
||||||
|
"internal/x/crypto/chacha20poly1305"
|
||||||
)
|
)
|
||||||
|
|
||||||
// a keyAgreement implements the client and server side of a TLS key agreement
|
// a keyAgreement implements the client and server side of a TLS key agreement
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ package tls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang_org/x/crypto/cryptobyte"
|
"internal/x/crypto/cryptobyte"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"errors"
|
"errors"
|
||||||
"golang_org/x/crypto/cryptobyte"
|
|
||||||
"golang_org/x/crypto/curve25519"
|
|
||||||
"golang_org/x/crypto/hkdf"
|
|
||||||
"hash"
|
"hash"
|
||||||
|
"internal/x/crypto/cryptobyte"
|
||||||
|
"internal/x/crypto/curve25519"
|
||||||
|
"internal/x/crypto/hkdf"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
"errors"
|
"errors"
|
||||||
"golang_org/x/crypto/cryptobyte"
|
"internal/x/crypto/cryptobyte"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang_org/x/crypto/cryptobyte"
|
"internal/x/crypto/cryptobyte"
|
||||||
cryptobyte_asn1 "golang_org/x/crypto/cryptobyte/asn1"
|
cryptobyte_asn1 "internal/x/crypto/cryptobyte/asn1"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
|
|
|
||||||
|
|
@ -351,12 +351,16 @@ func TestImportDirNotExist(t *testing.T) {
|
||||||
func TestImportVendor(t *testing.T) {
|
func TestImportVendor(t *testing.T) {
|
||||||
testenv.MustHaveGoBuild(t) // really must just have source
|
testenv.MustHaveGoBuild(t) // really must just have source
|
||||||
ctxt := Default
|
ctxt := Default
|
||||||
ctxt.GOPATH = ""
|
wd, err := os.Getwd()
|
||||||
p, err := ctxt.Import("golang_org/x/net/http2/hpack", filepath.Join(ctxt.GOROOT, "src/net/http"), 0)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("cannot find vendored golang_org/x/net/http2/hpack from net/http directory: %v", err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
want := "vendor/golang_org/x/net/http2/hpack"
|
ctxt.GOPATH = filepath.Join(wd, "testdata/withvendor")
|
||||||
|
p, err := ctxt.Import("c/d", filepath.Join(ctxt.GOPATH, "src/a/b"), 0)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("cannot find vendored c/d from testdata src/a/b directory: %v", err)
|
||||||
|
}
|
||||||
|
want := "a/vendor/c/d"
|
||||||
if p.ImportPath != want {
|
if p.ImportPath != want {
|
||||||
t.Fatalf("Import succeeded but found %q, want %q", p.ImportPath, want)
|
t.Fatalf("Import succeeded but found %q, want %q", p.ImportPath, want)
|
||||||
}
|
}
|
||||||
|
|
@ -365,8 +369,12 @@ func TestImportVendor(t *testing.T) {
|
||||||
func TestImportVendorFailure(t *testing.T) {
|
func TestImportVendorFailure(t *testing.T) {
|
||||||
testenv.MustHaveGoBuild(t) // really must just have source
|
testenv.MustHaveGoBuild(t) // really must just have source
|
||||||
ctxt := Default
|
ctxt := Default
|
||||||
ctxt.GOPATH = ""
|
wd, err := os.Getwd()
|
||||||
p, err := ctxt.Import("x.com/y/z", filepath.Join(ctxt.GOROOT, "src/net/http"), 0)
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
ctxt.GOPATH = filepath.Join(wd, "testdata/withvendor")
|
||||||
|
p, err := ctxt.Import("x.com/y/z", filepath.Join(ctxt.GOPATH, "src/a/b"), 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("found made-up package x.com/y/z in %s", p.Dir)
|
t.Fatalf("found made-up package x.com/y/z in %s", p.Dir)
|
||||||
}
|
}
|
||||||
|
|
@ -380,9 +388,13 @@ func TestImportVendorFailure(t *testing.T) {
|
||||||
func TestImportVendorParentFailure(t *testing.T) {
|
func TestImportVendorParentFailure(t *testing.T) {
|
||||||
testenv.MustHaveGoBuild(t) // really must just have source
|
testenv.MustHaveGoBuild(t) // really must just have source
|
||||||
ctxt := Default
|
ctxt := Default
|
||||||
ctxt.GOPATH = ""
|
wd, err := os.Getwd()
|
||||||
// This import should fail because the vendor/golang.org/x/net/http2 directory has no source code.
|
if err != nil {
|
||||||
p, err := ctxt.Import("golang_org/x/net/http2", filepath.Join(ctxt.GOROOT, "src/net/http"), 0)
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
ctxt.GOPATH = filepath.Join(wd, "testdata/withvendor")
|
||||||
|
// This import should fail because the vendor/c directory has no source code.
|
||||||
|
p, err := ctxt.Import("c", filepath.Join(ctxt.GOPATH, "src/a/b"), 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("found empty parent in %s", p.Dir)
|
t.Fatalf("found empty parent in %s", p.Dir)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ var pkgDeps = map[string][]string{
|
||||||
"context", "math/rand", "os", "reflect", "sort", "syscall", "time",
|
"context", "math/rand", "os", "reflect", "sort", "syscall", "time",
|
||||||
"internal/nettrace", "internal/poll", "internal/syscall/unix",
|
"internal/nettrace", "internal/poll", "internal/syscall/unix",
|
||||||
"internal/syscall/windows", "internal/singleflight", "internal/race",
|
"internal/syscall/windows", "internal/singleflight", "internal/race",
|
||||||
"golang_org/x/net/dns/dnsmessage", "golang_org/x/net/lif", "golang_org/x/net/route",
|
"internal/x/net/dns/dnsmessage", "internal/x/net/lif", "internal/x/net/route",
|
||||||
},
|
},
|
||||||
|
|
||||||
// NET enables use of basic network-related packages.
|
// NET enables use of basic network-related packages.
|
||||||
|
|
@ -357,9 +357,9 @@ var pkgDeps = map[string][]string{
|
||||||
"crypto/sha1",
|
"crypto/sha1",
|
||||||
"crypto/sha256",
|
"crypto/sha256",
|
||||||
"crypto/sha512",
|
"crypto/sha512",
|
||||||
"golang_org/x/crypto/chacha20poly1305",
|
"internal/x/crypto/chacha20poly1305",
|
||||||
"golang_org/x/crypto/curve25519",
|
"internal/x/crypto/curve25519",
|
||||||
"golang_org/x/crypto/poly1305",
|
"internal/x/crypto/poly1305",
|
||||||
},
|
},
|
||||||
|
|
||||||
// Random byte, number generation.
|
// Random byte, number generation.
|
||||||
|
|
@ -387,13 +387,13 @@ var pkgDeps = map[string][]string{
|
||||||
|
|
||||||
// SSL/TLS.
|
// SSL/TLS.
|
||||||
"crypto/tls": {
|
"crypto/tls": {
|
||||||
"L4", "CRYPTO-MATH", "OS", "golang_org/x/crypto/cryptobyte", "golang_org/x/crypto/hkdf",
|
"L4", "CRYPTO-MATH", "OS", "internal/x/crypto/cryptobyte", "internal/x/crypto/hkdf",
|
||||||
"container/list", "crypto/x509", "encoding/pem", "net", "syscall",
|
"container/list", "crypto/x509", "encoding/pem", "net", "syscall",
|
||||||
},
|
},
|
||||||
"crypto/x509": {
|
"crypto/x509": {
|
||||||
"L4", "CRYPTO-MATH", "OS", "CGO",
|
"L4", "CRYPTO-MATH", "OS", "CGO",
|
||||||
"crypto/x509/pkix", "encoding/pem", "encoding/hex", "net", "os/user", "syscall", "net/url",
|
"crypto/x509/pkix", "encoding/pem", "encoding/hex", "net", "os/user", "syscall", "net/url",
|
||||||
"golang_org/x/crypto/cryptobyte", "golang_org/x/crypto/cryptobyte/asn1",
|
"internal/x/crypto/cryptobyte", "internal/x/crypto/cryptobyte/asn1",
|
||||||
},
|
},
|
||||||
"crypto/x509/pkix": {"L4", "CRYPTO-MATH", "encoding/hex"},
|
"crypto/x509/pkix": {"L4", "CRYPTO-MATH", "encoding/hex"},
|
||||||
|
|
||||||
|
|
@ -409,12 +409,12 @@ var pkgDeps = map[string][]string{
|
||||||
"context",
|
"context",
|
||||||
"crypto/rand",
|
"crypto/rand",
|
||||||
"crypto/tls",
|
"crypto/tls",
|
||||||
"golang_org/x/net/http/httpguts",
|
"internal/x/net/http/httpguts",
|
||||||
"golang_org/x/net/http/httpproxy",
|
"internal/x/net/http/httpproxy",
|
||||||
"golang_org/x/net/http2/hpack",
|
"internal/x/net/http2/hpack",
|
||||||
"golang_org/x/net/idna",
|
"internal/x/net/idna",
|
||||||
"golang_org/x/text/unicode/norm",
|
"internal/x/text/unicode/norm",
|
||||||
"golang_org/x/text/width",
|
"internal/x/text/width",
|
||||||
"internal/nettrace",
|
"internal/nettrace",
|
||||||
"mime/multipart",
|
"mime/multipart",
|
||||||
"net/http/httptrace",
|
"net/http/httptrace",
|
||||||
|
|
@ -432,9 +432,9 @@ var pkgDeps = map[string][]string{
|
||||||
"net/http/fcgi": {"L4", "NET", "OS", "context", "net/http", "net/http/cgi"},
|
"net/http/fcgi": {"L4", "NET", "OS", "context", "net/http", "net/http/cgi"},
|
||||||
"net/http/httptest": {
|
"net/http/httptest": {
|
||||||
"L4", "NET", "OS", "crypto/tls", "flag", "net/http", "net/http/internal", "crypto/x509",
|
"L4", "NET", "OS", "crypto/tls", "flag", "net/http", "net/http/internal", "crypto/x509",
|
||||||
"golang_org/x/net/http/httpguts",
|
"internal/x/net/http/httpguts",
|
||||||
},
|
},
|
||||||
"net/http/httputil": {"L4", "NET", "OS", "context", "net/http", "net/http/internal", "golang_org/x/net/http/httpguts"},
|
"net/http/httputil": {"L4", "NET", "OS", "context", "net/http", "net/http/internal", "internal/x/net/http/httpguts"},
|
||||||
"net/http/pprof": {"L4", "OS", "html/template", "net/http", "runtime/pprof", "runtime/trace"},
|
"net/http/pprof": {"L4", "OS", "html/template", "net/http", "runtime/pprof", "runtime/trace"},
|
||||||
"net/rpc": {"L4", "NET", "encoding/gob", "html/template", "net/http"},
|
"net/rpc": {"L4", "NET", "encoding/gob", "html/template", "net/http"},
|
||||||
"net/rpc/jsonrpc": {"L4", "NET", "encoding/json", "net/rpc"},
|
"net/rpc/jsonrpc": {"L4", "NET", "encoding/json", "net/rpc"},
|
||||||
|
|
@ -485,7 +485,7 @@ func listStdPkgs(goroot string) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
name := filepath.ToSlash(path[len(src):])
|
name := filepath.ToSlash(path[len(src):])
|
||||||
if name == "builtin" || name == "cmd" || strings.Contains(name, "golang_org") {
|
if name == "builtin" || name == "cmd" || strings.Contains(name, "internal/x/") {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
3
src/go/build/testdata/withvendor/src/a/b/b.go
vendored
Normal file
3
src/go/build/testdata/withvendor/src/a/b/b.go
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
package b
|
||||||
|
|
||||||
|
import _ "c/d"
|
||||||
1
src/go/build/testdata/withvendor/src/a/vendor/c/d/d.go
vendored
Normal file
1
src/go/build/testdata/withvendor/src/a/vendor/c/d/d.go
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
package d
|
||||||
|
|
@ -99,7 +99,7 @@ var importedObjectTests = []struct {
|
||||||
{"math.Pi", "const Pi untyped float"},
|
{"math.Pi", "const Pi untyped float"},
|
||||||
{"math.Sin", "func Sin(x float64) float64"},
|
{"math.Sin", "func Sin(x float64) float64"},
|
||||||
{"math/big.Int", "type Int struct{neg bool; abs nat}"},
|
{"math/big.Int", "type Int struct{neg bool; abs nat}"},
|
||||||
{"golang_org/x/text/unicode/norm.MaxSegmentSize", "const MaxSegmentSize untyped int"},
|
{"internal/x/text/unicode/norm.MaxSegmentSize", "const MaxSegmentSize untyped int"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImportedTypes(t *testing.T) {
|
func TestImportedTypes(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD as specified in RFC 7539.
|
// Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD as specified in RFC 7539.
|
||||||
package chacha20poly1305 // import "golang.org/x/crypto/chacha20poly1305"
|
package chacha20poly1305
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
|
|
@ -7,8 +7,8 @@ package chacha20poly1305
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"golang_org/x/crypto/internal/chacha20"
|
"internal/x/crypto/internal/chacha20"
|
||||||
"golang_org/x/crypto/poly1305"
|
"internal/x/crypto/poly1305"
|
||||||
)
|
)
|
||||||
|
|
||||||
func roundTo16(n int) int {
|
func roundTo16(n int) int {
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang_org/x/crypto/cryptobyte/asn1"
|
"internal/x/crypto/cryptobyte/asn1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This file contains ASN.1-related methods for String and Builder.
|
// This file contains ASN.1-related methods for String and Builder.
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package asn1 contains supporting types for parsing and building ASN.1
|
// Package asn1 contains supporting types for parsing and building ASN.1
|
||||||
// messages with the cryptobyte package.
|
// messages with the cryptobyte package.
|
||||||
package asn1 // import "golang.org/x/crypto/cryptobyte/asn1"
|
package asn1
|
||||||
|
|
||||||
// Tag represents an ASN.1 identifier octet, consisting of a tag number
|
// Tag represents an ASN.1 identifier octet, consisting of a tag number
|
||||||
// (indicating a type) and class (such as context-specific or constructed).
|
// (indicating a type) and class (such as context-specific or constructed).
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang_org/x/crypto/cryptobyte/asn1"
|
"internal/x/crypto/cryptobyte/asn1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type readASN1Test struct {
|
type readASN1Test struct {
|
||||||
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"golang_org/x/crypto/cryptobyte"
|
"internal/x/crypto/cryptobyte"
|
||||||
"golang_org/x/crypto/cryptobyte/asn1"
|
"internal/x/crypto/cryptobyte/asn1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleString_lengthPrefixed() {
|
func ExampleString_lengthPrefixed() {
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
//
|
//
|
||||||
// See the documentation and examples for the Builder and String types to get
|
// See the documentation and examples for the Builder and String types to get
|
||||||
// started.
|
// started.
|
||||||
package cryptobyte // import "golang.org/x/crypto/cryptobyte"
|
package cryptobyte
|
||||||
|
|
||||||
// String represents a string of bytes. It provides methods for parsing
|
// String represents a string of bytes. It provides methods for parsing
|
||||||
// fixed-length and length-prefixed values from it.
|
// fixed-length and length-prefixed values from it.
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package curve25519 provides an implementation of scalar multiplication on
|
// Package curve25519 provides an implementation of scalar multiplication on
|
||||||
// the elliptic curve known as curve25519. See https://cr.yp.to/ecdh.html
|
// the elliptic curve known as curve25519. See https://cr.yp.to/ecdh.html
|
||||||
package curve25519 // import "golang.org/x/crypto/curve25519"
|
package curve25519
|
||||||
|
|
||||||
// basePoint is the x coordinate of the generator of the curve.
|
// basePoint is the x coordinate of the generator of the curve.
|
||||||
var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"golang_org/x/crypto/hkdf"
|
"internal/x/crypto/hkdf"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Usage example that expands one master secret into three other
|
// Usage example that expands one master secret into three other
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
// HKDF is a cryptographic key derivation function (KDF) with the goal of
|
// HKDF is a cryptographic key derivation function (KDF) with the goal of
|
||||||
// expanding limited input keying material into one or more cryptographically
|
// expanding limited input keying material into one or more cryptographically
|
||||||
// strong secret keys.
|
// strong secret keys.
|
||||||
package hkdf // import "golang.org/x/crypto/hkdf"
|
package hkdf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
|
|
@ -17,7 +17,7 @@ used with a fixed key in order to generate one-time keys from an nonce.
|
||||||
However, in this package AES isn't used and the one-time key is specified
|
However, in this package AES isn't used and the one-time key is specified
|
||||||
directly.
|
directly.
|
||||||
*/
|
*/
|
||||||
package poly1305 // import "golang.org/x/crypto/poly1305"
|
package poly1305
|
||||||
|
|
||||||
import "crypto/subtle"
|
import "crypto/subtle"
|
||||||
|
|
||||||
6
src/internal/x/fiximports.bash
Executable file
6
src/internal/x/fiximports.bash
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# To fix import paths when importing new snapshots from the golang.org/x
|
||||||
|
# repositories, run this script in the current directory.
|
||||||
|
|
||||||
|
sed -i 's,"golang\.org/x,"internal/x,g' $(grep -lr 'golang.org')
|
||||||
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang_org/x/net/dns/dnsmessage"
|
"internal/x/net/dns/dnsmessage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mustNewName(name string) dnsmessage.Name {
|
func mustNewName(name string) dnsmessage.Name {
|
||||||
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"golang_org/x/net/idna"
|
"internal/x/net/idna"
|
||||||
)
|
)
|
||||||
|
|
||||||
var isTokenTable = [127]bool{
|
var isTokenTable = [127]bool{
|
||||||
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"golang_org/x/net/idna"
|
"internal/x/net/idna"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config holds configuration for HTTP proxy settings. See
|
// Config holds configuration for HTTP proxy settings. See
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"golang_org/x/net/http/httpproxy"
|
"internal/x/net/http/httpproxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// setHelper calls t.Helper() for Go 1.9+ (see go19_test.go) and does nothing otherwise.
|
// setHelper calls t.Helper() for Go 1.9+ (see go19_test.go) and does nothing otherwise.
|
||||||
|
|
@ -13,16 +13,16 @@
|
||||||
// UTS #46 is defined in http://www.unicode.org/reports/tr46.
|
// UTS #46 is defined in http://www.unicode.org/reports/tr46.
|
||||||
// See http://unicode.org/cldr/utility/idna.jsp for a visualization of the
|
// See http://unicode.org/cldr/utility/idna.jsp for a visualization of the
|
||||||
// differences between these two standards.
|
// differences between these two standards.
|
||||||
package idna // import "golang_org/x/text/internal/export/idna"
|
package idna
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"golang_org/x/text/secure/bidirule"
|
"internal/x/text/secure/bidirule"
|
||||||
"golang_org/x/text/unicode/bidi"
|
"internal/x/text/unicode/bidi"
|
||||||
"golang_org/x/text/unicode/norm"
|
"internal/x/text/unicode/norm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTE: Unlike common practice in Go APIs, the functions will return a
|
// NOTE: Unlike common practice in Go APIs, the functions will return a
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
// Code generated by running "go generate" in golang_org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in internal/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
// Code generated by running "go generate" in golang_org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in internal/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package nettest provides utilities for network testing.
|
// Package nettest provides utilities for network testing.
|
||||||
package nettest // import "golang.org/x/net/internal/nettest"
|
package nettest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue