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

"no buildable Go source files" #22

Open
jeremyschlatter opened this issue May 8, 2015 · 5 comments
Open

"no buildable Go source files" #22

jeremyschlatter opened this issue May 8, 2015 · 5 comments
Labels

Comments

@jeremyschlatter
Copy link
Contributor

Given this directory structure:

a $ tree
.
├── a.go
└── b
    ├── b.go
    └── c
        └── c.go

2 directories, 3 files
a $ cat a.go
package main

import (
    "a/b"
    "a/b/c"
)

func main() {
    b.B()
    c.C()
}
a $ cat b/b.go
package b

func B() {
    println("B")
}
 a $ cat b/c/c.go
package c

func C() {
    _ = "breakpoint"
    println("C")
}

Running godebug without -instrument gives a helpful warning:

 a $ godebug run a.go
godebug run: Ignoring breakpoint at a/b/c/c.go:4 because package "c" has not been flagged for instrumentation. See 'godebug help run'.

B
C

But the -instrument flag does not work as expected:

$ godebug run -instrument a/b/c a.go
/var/folders/4l/d1lsmz5d4972rfkg1gvv8hmc0000gn/T/godebug895759339/a.go:4:2: no buildable Go source files in /var/folders/4l/d1lsmz5d4972rfkg1gvv8hmc0000gn/T/godebug895759339/src/a/b
@jeremyschlatter
Copy link
Contributor Author

The problem happens because, in the above example, a/b/c is instrumented but a/b is not. godebug should be fixed to make this work, but in the meantime you can also instrument the parent packages as a workaround:

a $ godebug run -instrument a/b/c,a/b a.go
B
-> _ = "breakpoint"
(godebug) c
C

@FiloSottile
Copy link
Contributor

Hit the same problem when trying to build (with the new UX) package github.com/FiloSottile/BERserk/BERserker which imports github.com/FiloSottile/BERserk.

@TechnotronicOz
Copy link

I have been having this same issue. We have multiple Go apps and we have structured the mains like:

|--- ./appOne/
        |--- appOne.go
|--- ./appTwo/
        |--- appTwo.go

then the sub packages exist in:

|--- ./lib/
        |--- appOne/packageOne/
                |--- packageOne.go
        |--- appOne/packageTwo/
                |--- packageTwo.go
        |--- appTwo/packageOne/
                |--- packageOne.go

@otoolep
Copy link

otoolep commented Jul 17, 2015

Same here, really struggling when trying to instrument packages with this otherwise great tool.

@willfaught
Copy link

Have the same issue

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

5 participants