Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
492aad6d
Commit
492aad6d
authored
Apr 24, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update third_party go/build to go1.6
parent
9a83015e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
47 deletions
+120
-47
build.go
third_party/golang/go/build/build.go
+0
-0
build_test.go
third_party/golang/go/build/build_test.go
+74
-5
deps_test.go
third_party/golang/go/build/deps_test.go
+45
-42
doc.go
third_party/golang/go/build/doc.go
+1
-0
No files found.
third_party/golang/go/build/build.go
View file @
492aad6d
This diff is collapsed.
Click to expand it.
third_party/golang/go/build/build_test.go
View file @
492aad6d
...
...
@@ -5,6 +5,7 @@
package
build
import
(
"internal/testenv"
"io"
"os"
"path/filepath"
...
...
@@ -109,7 +110,6 @@ func TestMultiplePackageImport(t *testing.T) {
}
func
TestLocalDirectory
(
t
*
testing
.
T
)
{
return
// go1.3 not happy with this test.
if
runtime
.
GOOS
==
"darwin"
{
switch
runtime
.
GOARCH
{
case
"arm"
,
"arm64"
:
...
...
@@ -126,8 +126,8 @@ func TestLocalDirectory(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
p
.
ImportPath
!=
"
k8s.io/kubernetes/third_party/golang/
go/build"
{
t
.
Fatalf
(
"ImportPath=%q, want %q"
,
p
.
ImportPath
,
"
k8s.io/kubernetes/third_party/golang/
go/build"
)
if
p
.
ImportPath
!=
"go/build"
{
t
.
Fatalf
(
"ImportPath=%q, want %q"
,
p
.
ImportPath
,
"go/build"
)
}
}
...
...
@@ -231,7 +231,6 @@ func TestMatchFile(t *testing.T) {
}
func
TestImportCmd
(
t
*
testing
.
T
)
{
return
// go1.3 not happy with this test
if
runtime
.
GOOS
==
"darwin"
{
switch
runtime
.
GOARCH
{
case
"arm"
,
"arm64"
:
...
...
@@ -269,7 +268,7 @@ var expandSrcDirTests = []struct {
func
TestExpandSrcDir
(
t
*
testing
.
T
)
{
for
_
,
test
:=
range
expandSrcDirTests
{
output
:=
expandSrcDir
(
test
.
input
,
expandSrcDirPath
)
output
,
_
:=
expandSrcDir
(
test
.
input
,
expandSrcDirPath
)
if
output
!=
test
.
expected
{
t
.
Errorf
(
"%q expands to %q with SRCDIR=%q when %q is expected"
,
test
.
input
,
output
,
expandSrcDirPath
,
test
.
expected
)
}
else
{
...
...
@@ -277,3 +276,73 @@ func TestExpandSrcDir(t *testing.T) {
}
}
}
func
TestShellSafety
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
input
,
srcdir
,
expected
string
result
bool
}{
{
"-I${SRCDIR}/../include"
,
"/projects/src/issue 11868"
,
"-I/projects/src/issue 11868/../include"
,
true
},
{
"-X${SRCDIR}/1,${SRCDIR}/2"
,
"/projects/src/issue 11868"
,
"-X/projects/src/issue 11868/1,/projects/src/issue 11868/2"
,
true
},
{
"-I/tmp -I/tmp"
,
"/tmp2"
,
"-I/tmp -I/tmp"
,
false
},
{
"-I/tmp"
,
"/tmp/[0]"
,
"-I/tmp"
,
true
},
{
"-I${SRCDIR}/dir"
,
"/tmp/[0]"
,
"-I/tmp/[0]/dir"
,
false
},
}
for
_
,
test
:=
range
tests
{
output
,
ok
:=
expandSrcDir
(
test
.
input
,
test
.
srcdir
)
if
ok
!=
test
.
result
{
t
.
Errorf
(
"Expected %t while %q expands to %q with SRCDIR=%q; got %t"
,
test
.
result
,
test
.
input
,
output
,
test
.
srcdir
,
ok
)
}
if
output
!=
test
.
expected
{
t
.
Errorf
(
"Expected %q while %q expands with SRCDIR=%q; got %q"
,
test
.
expected
,
test
.
input
,
test
.
srcdir
,
output
)
}
}
}
func
TestImportVendor
(
t
*
testing
.
T
)
{
t
.
Skip
(
"skipping; hpack has moved to internal for now; golang.org/issue/14047"
)
testenv
.
MustHaveGoBuild
(
t
)
// really must just have source
ctxt
:=
Default
ctxt
.
GOPATH
=
""
p
,
err
:=
ctxt
.
Import
(
"golang.org/x/net/http2/hpack"
,
filepath
.
Join
(
ctxt
.
GOROOT
,
"src/net/http"
),
0
)
if
err
!=
nil
{
t
.
Fatalf
(
"cannot find vendored golang.org/x/net/http2/hpack from net/http directory: %v"
,
err
)
}
want
:=
"vendor/golang.org/x/net/http2/hpack"
if
p
.
ImportPath
!=
want
{
t
.
Fatalf
(
"Import succeeded but found %q, want %q"
,
p
.
ImportPath
,
want
)
}
}
func
TestImportVendorFailure
(
t
*
testing
.
T
)
{
testenv
.
MustHaveGoBuild
(
t
)
// really must just have source
ctxt
:=
Default
ctxt
.
GOPATH
=
""
p
,
err
:=
ctxt
.
Import
(
"x.com/y/z"
,
filepath
.
Join
(
ctxt
.
GOROOT
,
"src/net/http"
),
0
)
if
err
==
nil
{
t
.
Fatalf
(
"found made-up package x.com/y/z in %s"
,
p
.
Dir
)
}
e
:=
err
.
Error
()
if
!
strings
.
Contains
(
e
,
" (vendor tree)"
)
{
t
.
Fatalf
(
"error on failed import does not mention GOROOT/src/vendor directory:
\n
%s"
,
e
)
}
}
func
TestImportVendorParentFailure
(
t
*
testing
.
T
)
{
testenv
.
MustHaveGoBuild
(
t
)
// really must just have source
ctxt
:=
Default
ctxt
.
GOPATH
=
""
// This import should fail because the vendor/golang.org/x/net/http2 directory has no source code.
p
,
err
:=
ctxt
.
Import
(
"golang.org/x/net/http2"
,
filepath
.
Join
(
ctxt
.
GOROOT
,
"src/net/http"
),
0
)
if
err
==
nil
{
t
.
Fatalf
(
"found empty parent in %s"
,
p
.
Dir
)
}
if
p
!=
nil
&&
p
.
Dir
!=
""
{
t
.
Fatalf
(
"decided to use %s"
,
p
.
Dir
)
}
e
:=
err
.
Error
()
if
!
strings
.
Contains
(
e
,
" (vendor tree)"
)
{
t
.
Fatalf
(
"error on failed import does not mention GOROOT/src/vendor directory:
\n
%s"
,
e
)
}
}
third_party/golang/go/build/deps_test.go
View file @
492aad6d
...
...
@@ -34,17 +34,21 @@ import (
//
var
pkgDeps
=
map
[
string
][]
string
{
// L0 is the lowest level, core, nearly unavoidable packages.
"errors"
:
{},
"io"
:
{
"errors"
,
"sync"
},
"runtime"
:
{
"unsafe"
},
"sync"
:
{
"runtime"
,
"sync/atomic"
,
"unsafe"
},
"sync/atomic"
:
{
"unsafe"
},
"unsafe"
:
{},
"errors"
:
{},
"io"
:
{
"errors"
,
"sync"
},
"runtime"
:
{
"unsafe"
,
"runtime/internal/atomic"
,
"runtime/internal/sys"
},
"runtime/internal/sys"
:
{},
"runtime/internal/atomic"
:
{
"unsafe"
,
"runtime/internal/sys"
},
"internal/race"
:
{
"runtime"
,
"unsafe"
},
"sync"
:
{
"internal/race"
,
"runtime"
,
"sync/atomic"
,
"unsafe"
},
"sync/atomic"
:
{
"unsafe"
},
"unsafe"
:
{},
"L0"
:
{
"errors"
,
"io"
,
"runtime"
,
"runtime/internal/atomic"
,
"sync"
,
"sync/atomic"
,
"unsafe"
,
...
...
@@ -128,17 +132,16 @@ var pkgDeps = map[string][]string{
// End of linear dependency definitions.
// Operating system access.
"syscall"
:
{
"L0"
,
"unicode/utf16"
},
"syscall"
:
{
"L0"
,
"
internal/race"
,
"internal/syscall/windows/sysdll"
,
"
unicode/utf16"
},
"internal/syscall/unix"
:
{
"L0"
,
"syscall"
},
"internal/syscall/windows"
:
{
"L0"
,
"syscall"
},
"internal/syscall/windows/registry"
:
{
"L0"
,
"syscall"
,
"unicode/utf16"
},
"time"
:
{
"L0"
,
"syscall"
,
"internal/syscall/windows/registry"
},
"os"
:
{
"L1"
,
"os"
,
"syscall"
,
"time"
,
"internal/syscall/windows"
},
"path/filepath"
:
{
"L2"
,
"os"
,
"syscall"
},
"io/ioutil"
:
{
"L2"
,
"os"
,
"path/filepath"
,
"time"
},
"os/exec"
:
{
"L2"
,
"os"
,
"path/filepath"
,
"syscall"
},
"os/signal"
:
{
"L2"
,
"os"
,
"syscall"
},
"internal/syscall"
:
{
"L2"
,
"runtime"
,
"syscall"
,
"sync/atomic"
,
"unsafe"
},
"internal/syscall/windows"
:
{
"L0"
,
"syscall"
,
"internal/syscall/windows/sysdll"
},
"internal/syscall/windows/registry"
:
{
"L0"
,
"syscall"
,
"internal/syscall/windows/sysdll"
,
"unicode/utf16"
},
"time"
:
{
"L0"
,
"syscall"
,
"internal/syscall/windows/registry"
},
"os"
:
{
"L1"
,
"os"
,
"syscall"
,
"time"
,
"internal/syscall/windows"
},
"path/filepath"
:
{
"L2"
,
"os"
,
"syscall"
},
"io/ioutil"
:
{
"L2"
,
"os"
,
"path/filepath"
,
"time"
},
"os/exec"
:
{
"L2"
,
"os"
,
"path/filepath"
,
"syscall"
},
"os/signal"
:
{
"L2"
,
"os"
,
"syscall"
},
// OS enables basic operating system functionality,
// but not direct use of package syscall, nor os/signal.
...
...
@@ -162,7 +165,7 @@ var pkgDeps = map[string][]string{
"runtime/trace"
:
{
"L0"
},
"text/tabwriter"
:
{
"L2"
},
"testing"
:
{
"L2"
,
"flag"
,
"fmt"
,
"os"
,
"runtime/pprof"
,
"runtime/trace"
,
"time"
},
"testing"
:
{
"L2"
,
"flag"
,
"fmt"
,
"os"
,
"runtime/
debug"
,
"runtime/
pprof"
,
"runtime/trace"
,
"time"
},
"testing/iotest"
:
{
"L2"
,
"log"
},
"testing/quick"
:
{
"L2"
,
"flag"
,
"fmt"
,
"reflect"
},
"internal/testenv"
:
{
"L2"
,
"os"
,
"testing"
},
...
...
@@ -215,7 +218,7 @@ var pkgDeps = map[string][]string{
"database/sql"
:
{
"L4"
,
"container/list"
,
"database/sql/driver"
},
"database/sql/driver"
:
{
"L4"
,
"time"
},
"debug/dwarf"
:
{
"L4"
},
"debug/elf"
:
{
"L4"
,
"OS"
,
"debug/dwarf"
},
"debug/elf"
:
{
"L4"
,
"OS"
,
"debug/dwarf"
,
"compress/zlib"
},
"debug/gosym"
:
{
"L4"
},
"debug/macho"
:
{
"L4"
,
"OS"
,
"debug/dwarf"
},
"debug/pe"
:
{
"L4"
,
"OS"
,
"debug/dwarf"
},
...
...
@@ -257,6 +260,8 @@ var pkgDeps = map[string][]string{
},
// Cgo.
// If you add a dependency on CGO, you must add the package to
// cgoPackages in cmd/dist/test.go.
"runtime/cgo"
:
{
"L0"
,
"C"
},
"CGO"
:
{
"C"
,
"runtime/cgo"
},
...
...
@@ -264,16 +269,17 @@ var pkgDeps = map[string][]string{
// that shows up in programs that use cgo.
"C"
:
{},
// Race detector uses cgo.
// Race detector
/MSan
uses cgo.
"runtime/race"
:
{
"C"
},
"runtime/msan"
:
{
"C"
},
// Plan 9 alone needs io/ioutil and os.
"os/user"
:
{
"L4"
,
"CGO"
,
"io/ioutil"
,
"os"
,
"syscall"
},
// Basic networking.
// Because net must be used by any package that wants to
// do networking portably, it must have a small dependency set: just L
1
+basic os.
"net"
:
{
"L
1"
,
"CGO"
,
"os"
,
"syscall"
,
"time"
,
"internal/syscall/windows"
,
"internal/singleflight
"
},
// do networking portably, it must have a small dependency set: just L
0
+basic os.
"net"
:
{
"L
0"
,
"CGO"
,
"math/rand"
,
"os"
,
"sort"
,
"syscall"
,
"time"
,
"internal/syscall/windows"
,
"internal/singleflight"
,
"internal/race
"
},
// NET enables use of basic network-related packages.
"NET"
:
{
...
...
@@ -312,7 +318,7 @@ var pkgDeps = map[string][]string{
// Random byte, number generation.
// This would be part of core crypto except that it imports
// math/big, which imports fmt.
"crypto/rand"
:
{
"L4"
,
"CRYPTO"
,
"OS"
,
"math/big"
,
"syscall"
,
"internal/syscall/unix"
,
"internal/syscall"
},
"crypto/rand"
:
{
"L4"
,
"CRYPTO"
,
"OS"
,
"math/big"
,
"syscall"
,
"internal/syscall/unix"
},
// Mathematical crypto: dependencies on fmt (L4) and math/big.
// We could avoid some of the fmt, but math/big imports fmt anyway.
...
...
@@ -334,7 +340,7 @@ var pkgDeps = map[string][]string{
// SSL/TLS.
"crypto/tls"
:
{
"L4"
,
"CRYPTO-MATH"
,
"
CGO"
,
"
OS"
,
"L4"
,
"CRYPTO-MATH"
,
"OS"
,
"container/list"
,
"crypto/x509"
,
"encoding/pem"
,
"net"
,
"syscall"
,
},
"crypto/x509"
:
{
...
...
@@ -352,6 +358,7 @@ var pkgDeps = map[string][]string{
"L4"
,
"NET"
,
"OS"
,
"compress/gzip"
,
"crypto/tls"
,
"mime/multipart"
,
"runtime/debug"
,
"net/http/internal"
,
"internal/golang.org/x/net/http2/hpack"
,
},
"net/http/internal"
:
{
"L4"
},
...
...
@@ -360,7 +367,7 @@ var pkgDeps = map[string][]string{
"net/http/cgi"
:
{
"L4"
,
"NET"
,
"OS"
,
"crypto/tls"
,
"net/http"
,
"regexp"
},
"net/http/cookiejar"
:
{
"L4"
,
"NET"
,
"net/http"
},
"net/http/fcgi"
:
{
"L4"
,
"NET"
,
"OS"
,
"net/http"
,
"net/http/cgi"
},
"net/http/httptest"
:
{
"L4"
,
"NET"
,
"OS"
,
"crypto/tls"
,
"flag"
,
"net/http"
},
"net/http/httptest"
:
{
"L4"
,
"NET"
,
"OS"
,
"crypto/tls"
,
"flag"
,
"net/http"
,
"net/http/internal"
},
"net/http/httputil"
:
{
"L4"
,
"NET"
,
"OS"
,
"net/http"
,
"net/http/internal"
},
"net/http/pprof"
:
{
"L4"
,
"OS"
,
"html/template"
,
"net/http"
,
"runtime/pprof"
,
"runtime/trace"
},
"net/rpc"
:
{
"L4"
,
"NET"
,
"encoding/gob"
,
"html/template"
,
"net/http"
},
...
...
@@ -441,7 +448,6 @@ func listStdPkgs(goroot string) ([]string, error) {
}
func
TestDependencies
(
t
*
testing
.
T
)
{
return
// go1.3 is really not happy with this test
iOS
:=
runtime
.
GOOS
==
"darwin"
&&
(
runtime
.
GOARCH
==
"arm"
||
runtime
.
GOARCH
==
"arm64"
)
if
runtime
.
GOOS
==
"nacl"
||
iOS
{
// Tests run in a limited file system and we do not
...
...
@@ -456,26 +462,23 @@ func TestDependencies(t *testing.T) {
}
sort
.
Strings
(
all
)
test
:=
func
(
mustImport
bool
)
{
for
_
,
pkg
:=
range
all
{
imports
,
err
:=
findImports
(
pkg
)
if
err
!=
nil
{
t
.
Error
(
err
)
continue
}
ok
:=
allowed
(
pkg
)
var
bad
[]
string
for
_
,
imp
:=
range
imports
{
if
!
ok
[
imp
]
{
bad
=
append
(
bad
,
imp
)
}
}
if
bad
!=
nil
{
t
.
Errorf
(
"unexpected dependency: %s imports %v"
,
pkg
,
bad
)
for
_
,
pkg
:=
range
all
{
imports
,
err
:=
findImports
(
pkg
)
if
err
!=
nil
{
t
.
Error
(
err
)
continue
}
ok
:=
allowed
(
pkg
)
var
bad
[]
string
for
_
,
imp
:=
range
imports
{
if
!
ok
[
imp
]
{
bad
=
append
(
bad
,
imp
)
}
}
if
bad
!=
nil
{
t
.
Errorf
(
"unexpected dependency: %s imports %v"
,
pkg
,
bad
)
}
}
test
(
true
)
}
var
buildIgnore
=
[]
byte
(
"
\n
// +build ignore"
)
...
...
third_party/golang/go/build/doc.go
View file @
492aad6d
...
...
@@ -102,6 +102,7 @@
// - "go1.3", from Go version 1.3 onward
// - "go1.4", from Go version 1.4 onward
// - "go1.5", from Go version 1.5 onward
// - "go1.6", from Go version 1.6 onward
// - any additional words listed in ctxt.BuildTags
//
// If a file's name, after stripping the extension and a possible _test suffix,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment