summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/tools/go/types/typeutil/example_test.go
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-01-18 16:45:30 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2019-01-24 02:11:08 +0100
commitce354a6afbf1813c9a5565a00f6937c1b6fd1e42 (patch)
tree5f8fef7e2879a8aec6e8c22302c4fce5e46e7083 /vendor/golang.org/x/tools/go/types/typeutil/example_test.go
parent56dd0f4dfdc33594502ec02421425c3432570be3 (diff)
[pkg] remove vendoring of golang/x/*
I think there's no need of vendoring this. The debian package builds fine without them - at least with the text-dev package in testing.
Diffstat (limited to 'vendor/golang.org/x/tools/go/types/typeutil/example_test.go')
-rw-r--r--vendor/golang.org/x/tools/go/types/typeutil/example_test.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/vendor/golang.org/x/tools/go/types/typeutil/example_test.go b/vendor/golang.org/x/tools/go/types/typeutil/example_test.go
deleted file mode 100644
index 86c4d44..0000000
--- a/vendor/golang.org/x/tools/go/types/typeutil/example_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 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 typeutil_test
-
-import (
- "fmt"
- "go/ast"
- "go/parser"
- "go/token"
- "go/types"
- "sort"
-
- "golang.org/x/tools/go/types/typeutil"
-)
-
-func ExampleMap() {
- const source = `package P
-
-var X []string
-var Y []string
-
-const p, q = 1.0, 2.0
-
-func f(offset int32) (value byte, ok bool)
-func g(rune) (uint8, bool)
-`
-
- // Parse and type-check the package.
- fset := token.NewFileSet()
- f, err := parser.ParseFile(fset, "P.go", source, 0)
- if err != nil {
- panic(err)
- }
- pkg, err := new(types.Config).Check("P", fset, []*ast.File{f}, nil)
- if err != nil {
- panic(err)
- }
-
- scope := pkg.Scope()
-
- // Group names of package-level objects by their type.
- var namesByType typeutil.Map // value is []string
- for _, name := range scope.Names() {
- T := scope.Lookup(name).Type()
-
- names, _ := namesByType.At(T).([]string)
- names = append(names, name)
- namesByType.Set(T, names)
- }
-
- // Format, sort, and print the map entries.
- var lines []string
- namesByType.Iterate(func(T types.Type, names interface{}) {
- lines = append(lines, fmt.Sprintf("%s %s", names, T))
- })
- sort.Strings(lines)
- for _, line := range lines {
- fmt.Println(line)
- }
-
- // Output:
- // [X Y] []string
- // [f g] func(offset int32) (value byte, ok bool)
- // [p q] untyped float
-}