Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

godef: no declaration found when using dot import syntax #19

Open
athom opened this issue Nov 2, 2015 · 3 comments
Open

godef: no declaration found when using dot import syntax #19

athom opened this issue Nov 2, 2015 · 3 comments
Labels

Comments

@athom
Copy link

athom commented Nov 2, 2015

It works when the code looks like this.

file: main.go

package main

import (
    "fmt"
    "time"
)

func main() {
    ti := time.Now()
    fmt.Println(ti)
}
➜  godef -f=./main.go -o=68
/usr/local/Cellar/go/1.5/libexec/src/time/time.go:781:6

but it failed when the code change to this:

file: main.go

package main

import (
    "fmt"
    . "time"
)

func main() {
    ti := Now()
    fmt.Println(ti)
}
➜  godef -f=./main.go -o=65
parseLocalPackage error: no more package files found
godef: no declaration found for Now
@rogpeppe
Copy link
Owner

This is a known issue with godef. In general, dot imports are a bad idea,
but this should probably be fixed some time.

@Alexendoo
Copy link

For testing dot imports are pretty useful, for example ginkgo and goconvey use it to good effect.

It's also useful when putting tests in a separate package, e.g. package foo_test

@sdwarwick
Copy link

Any plans to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants