Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
09f6a491
Commit
09f6a491
authored
Feb 10, 2012
by
James Whitehead
Committed by
Robert Griesemer
Feb 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp/types: Use build.FindTree in GcImporter
Fixes #2932 R=gri CC=golang-dev
https://golang.org/cl/5654046
parent
a0acdd21
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
src/pkg/exp/types/gcimporter.go
src/pkg/exp/types/gcimporter.go
+7
-4
src/pkg/exp/types/gcimporter_test.go
src/pkg/exp/types/gcimporter_test.go
+1
-1
No files found.
src/pkg/exp/types/gcimporter.go
View file @
09f6a491
...
@@ -11,12 +11,12 @@ import (
...
@@ -11,12 +11,12 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"go/ast"
"go/ast"
"go/build"
"go/token"
"go/token"
"io"
"io"
"math/big"
"math/big"
"os"
"os"
"path/filepath"
"path/filepath"
"runtime"
"strconv"
"strconv"
"text/scanner"
"text/scanner"
)
)
...
@@ -24,7 +24,6 @@ import (
...
@@ -24,7 +24,6 @@ import (
const
trace
=
false
// set to true for debugging
const
trace
=
false
// set to true for debugging
var
(
var
(
pkgRoot
=
filepath
.
Join
(
runtime
.
GOROOT
(),
"pkg"
,
runtime
.
GOOS
+
"_"
+
runtime
.
GOARCH
)
pkgExts
=
[
...
]
string
{
".a"
,
".5"
,
".6"
,
".8"
}
pkgExts
=
[
...
]
string
{
".a"
,
".5"
,
".6"
,
".8"
}
)
)
...
@@ -39,8 +38,12 @@ func findPkg(path string) (filename, id string) {
...
@@ -39,8 +38,12 @@ func findPkg(path string) (filename, id string) {
var
noext
string
var
noext
string
switch
path
[
0
]
{
switch
path
[
0
]
{
default
:
default
:
// "x" -> "$GOROOT/pkg/$GOOS_$GOARCH/x.ext", "x"
// "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x"
noext
=
filepath
.
Join
(
pkgRoot
,
path
)
tree
,
pkg
,
err
:=
build
.
FindTree
(
path
)
if
err
!=
nil
{
return
}
noext
=
filepath
.
Join
(
tree
.
PkgDir
(),
pkg
)
case
'.'
:
case
'.'
:
// "./x" -> "/this/directory/x.ext", "/this/directory/x"
// "./x" -> "/this/directory/x.ext", "/this/directory/x"
...
...
src/pkg/exp/types/gcimporter_test.go
View file @
09f6a491
...
@@ -61,7 +61,7 @@ func testPath(t *testing.T, path string) bool {
...
@@ -61,7 +61,7 @@ func testPath(t *testing.T, path string) bool {
const
maxTime
=
3
*
time
.
Second
const
maxTime
=
3
*
time
.
Second
func
testDir
(
t
*
testing
.
T
,
dir
string
,
endTime
time
.
Time
)
(
nimports
int
)
{
func
testDir
(
t
*
testing
.
T
,
dir
string
,
endTime
time
.
Time
)
(
nimports
int
)
{
dirname
:=
filepath
.
Join
(
pkgRoot
,
dir
)
dirname
:=
filepath
.
Join
(
runtime
.
GOROOT
(),
"pkg"
,
runtime
.
GOOS
+
"_"
+
runtime
.
GOARCH
,
dir
)
list
,
err
:=
ioutil
.
ReadDir
(
dirname
)
list
,
err
:=
ioutil
.
ReadDir
(
dirname
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"testDir(%s): %s"
,
dirname
,
err
)
t
.
Errorf
(
"testDir(%s): %s"
,
dirname
,
err
)
...
...
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