Comments (7)
github.com\rogpeppe\godef\go\parser\parser.go
// p.error(path.Pos(), fmt.Sprintf("cannot find identifier for package %q: %v", litToString(path), err))
fixed this
from godef.
#44 fixed this issue for me.
from godef.
godef -debug -f /usr/local/Cellar/go/1.6.2/libexec/src/log/syslog/syslog.go -o 3403
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.SelectorExpr net.Dial [
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.Ident net [
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.ImportSpec "net" [
2016/07/05 13:57:07 ] -> 0x0, Type{package "" *ast.ImportSpec "net"}
2016/07/05 13:57:07 ] -> 0xc8201de690, Type{package "" *ast.ImportSpec "net"}
2016/07/05 13:57:07 member Type{package "" *ast.ImportSpec "net"} 'Dial' {
2016/07/05 13:57:07 /usr/local/Cellar/go/1.6.2/libexec/src/net/cgo_android.go:10:8: cannot find identifier for package "C": cannot find package "C" in any of:
/usr/local/Cellar/go/1.6.2/libexec/src/vendor/C (vendor tree)
/usr/local/Cellar/go/1.6.2/libexec/src/C (from $GOROOT)
/Users/Zhiheng/Workspace/go/src/C (from $GOPATH)
2016/07/05 13:57:07 } -> <nil>
2016/07/05 13:57:07 ] -> 0x0, Type{bad "" <nil> }
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.SelectorExpr net.Dial [
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.Ident net [
2016/07/05 13:57:07 exprType tuple:false pkg: *ast.ImportSpec "net" [
2016/07/05 13:57:07 ] -> 0x0, Type{package "" *ast.ImportSpec "net"}
2016/07/05 13:57:07 ] -> 0xc8201de690, Type{package "" *ast.ImportSpec "net"}
2016/07/05 13:57:07 member Type{package "" *ast.ImportSpec "net"} 'Dial' {
2016/07/05 13:57:07 /usr/local/Cellar/go/1.6.2/libexec/src/net/cgo_android.go:10:8: cannot find identifier for package "C": cannot find package "C" in any of:
/usr/local/Cellar/go/1.6.2/libexec/src/vendor/C (vendor tree)
/usr/local/Cellar/go/1.6.2/libexec/src/C (from $GOROOT)
/Users/Zhiheng/Workspace/go/src/C (from $GOPATH)
2016/07/05 13:57:07 } -> <nil>
2016/07/05 13:57:07 ] -> 0x0, Type{bad "" <nil> }
godef: no declaration found for net.Dial
Is this one related here?
from godef.
I'm having a related issue on Arch Linux with go1.6.3 linux/amd64
When I try godef --debug -f abc.go net.DialTimeout
, it returns
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.SelectorExpr net.DialTimeout [
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.Ident net [
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.ImportSpec "net" [
2016/07/27 20:45:52 ] -> 0x0, Type{package "" *ast.ImportSpec "net"}
2016/07/27 20:45:52 ] -> 0xc820143a40, Type{package "" *ast.ImportSpec "net"}
2016/07/27 20:45:52 member Type{package "" *ast.ImportSpec "net"} 'DialTimeout' {
2016/07/27 20:45:52 /usr/lib/go/src/net/conf_netcgo.go:14:8: cannot find identifier for package "C": cannot find package "C" in any of:
/usr/lib/go/src/vendor/C (vendor tree)
/usr/lib/go/src/C (from $GOROOT)
/home/hotpxl/go/src/C (from $GOPATH)
2016/07/27 20:45:52 } -> <nil>
2016/07/27 20:45:52 ] -> 0x0, Type{bad "" <nil> }
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.SelectorExpr net.DialTimeout [
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.Ident net [
2016/07/27 20:45:52 exprType tuple:false pkg: *ast.ImportSpec "net" [
2016/07/27 20:45:52 ] -> 0x0, Type{package "" *ast.ImportSpec "net"}
2016/07/27 20:45:52 ] -> 0xc820143a40, Type{package "" *ast.ImportSpec "net"}
2016/07/27 20:45:52 member Type{package "" *ast.ImportSpec "net"} 'DialTimeout' {
2016/07/27 20:45:52 /usr/lib/go/src/net/conf_netcgo.go:14:8: cannot find identifier for package "C": cannot find package "C" in any of:
/usr/lib/go/src/vendor/C (vendor tree)
/usr/lib/go/src/C (from $GOROOT)
/home/hotpxl/go/src/C (from $GOPATH)
2016/07/27 20:45:52 } -> <nil>
2016/07/27 20:45:52 ] -> 0x0, Type{bad "" <nil> }
godef: no declaration found for net.DialTimeout
Looks like it's having problems importing cgo
from godef.
master branch still has this problem?
from godef.
It seems to me that there is a mismatch between two implementations of "exclude files that are not for the current architecture".
One is in godef/go/types/goodarch.go:goodOSArch()
, which decides purely on the file name.
The other is in go/build/build.go:shouldBuild()
via Context.match()
which looks at // +build
lines.
So for the example at the top the former decides /home/rog/go/src/net/interface_bsdvar.go
is ok, and the latter decides there are no files to parse in /home/rog/go/src/vendor/golang.org/x/net/route
, because they are all excluded by +build
directives.
Given that build.Default.Import()
returns a set of Go files and ignored Go files, could we not use them instead of the isGoFile
logic?
from godef.
Fixed by #62
from godef.
Related Issues (20)
- Cannot find modules in $GOPATH/pkg/mod/cache/download
- godef might be extremly slow in Go packages using cgo when using go/packages
- godef by expression not working with go/packages HOT 3
- Allow a way to print the version of the godef tool
- Struct tips not pretty with go modules HOT 7
- go get github.com/rogpeppe/godef not working
- godef can't work for go while using import . ""
- godef takes ~2 seconds when used with go modules HOT 8
- godef can't work HOT 1
- When export GO111MODULE=on, the godef can not work. HOT 2
- internal error: nil Pkg importing "errors" from "mypkg" HOT 3
- godef: could not parse GOARCH and Go compiler HOT 2
- "no declaration found" when a package uses a binary literal
- include methods in members list HOT 1
- Godef fails in dependency module directories where no go.mod is present HOT 1
- Does godef support build tags?
- godef not work in go mod HOT 4
- Printing the receiver for methods when printing types
- go mod project search github.com/coreos/etcd very slow and fail HOT 1
- Support showing variable initialization values when printing types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godef.