-
Notifications
You must be signed in to change notification settings - Fork 147
gb not building one of my project's main packages #632
Comments
Is the source online somewhere I can look at ? |
Can you please post the complete |
And confirm your gb revision. Thanks. |
Sorry, the source isn't online. ~/hats> env DEBUG=. gb build all gb commit: f25e86b |
As far as gb is concerned, there is nothing to do. What happens if you On Sat, Jul 2, 2016 at 1:34 PM, Patrick Crosby notifications@github.com
|
I edited $PROJECT/src/srv/sapid/sapid.go and now it is (attempting) to build it again. But there was never anything in Thanks for prompt response...I'll keep going, but I was in a weird state... |
Are you sure $PROJECT/src/srv/sapid/sapid.go is On Sat, Jul 2, 2016 at 1:41 PM, Patrick Crosby notifications@github.com
|
Yes. It's been a ~/hats> head src/srv/sapid/sapid.go import ( |
So, to be clear, gb is not building this particular package main? Do you have any symlinks in your $PROJECT? |
Yes, it isn't building it. No symlinks. I've been copying code from existing repo to this project to try out ~/hats> env DEBUG=. gb build all ~/hats> ls bin ~/hats> env DEBUG=. gb build all |
What i think has happened is sapid used to have more files, but they were deleted or removed, so from the POV of gb, the compiled .a file is still newer than the source files that are in that directory, so it doesn't think there is anything to do. If you touch a file in sapid/*.go that might fix it. |
There are only two files in sapid/: sapid.go and sapid_test.go. touch didn't do anything. |
Can you please run this command at $PROJECT
And paste the result. |
No output... ~/hats> ls -l src/srv/sapid |
Can you share those files with me ? |
I wish I could, but those two happen to be pretty private. They've been building fine on all versions of go since pre 1.0... Anything else I could try? |
What happens if you replace the contents of sapid.go with package main
func main() {
println("hello world')
} Does that change the output from |
yes:
|
So there is something about |
~/hats/src/srv/sapid> head -40 sapid.go // sapid is the web service handling all incoming api calls.
package main
import (
"crypto/md5"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net"
"net/http"
_ "net/http/pprof"
"net/rpc"
"os"
"strconv"
"strings"
"sync"
"time"
"sh/cache/bstash"
"sh/constants"
"sh/crypto/keys"
"sh/environment"
"sh/glob"
"sh/glog"
"sh/net/eroute"
"sh/net/qob"
"sh/net/router"
"sh/time/timeutil"
"sh/tools/ln"
"sh/xrpc/xbuckd"
"sh/xrpc/xbufcached"
"sh/xrpc/xhgram"
"sh/xrpc/xsapid"
)
const (
port = "9999"
) |
That looks pretty reasonable. I thought there was a huge comment block or something that would throw the importer off. Can you check that there are no byte order marks at the front of the file. |
All those |
Can you please run this in the root of your project.
It will show with packages have files which are being ignored. |
No byte order marks. sh/cache/bstash [] |
Yet, srv/sapid is missing completely. What happens if you run
|
Just to check, you haven't accidentally created a |
Nope. |
No output to gb list -f '{{ .ImportPath }} {{ .IgnoredGoFiles }}' srv/sapid |
What if you copy the files to a different directory? |
I tried that before posting the original issue. But just tried again. I put them in src/what/sapid.go, src/what/sapid_test.go. No change. The |
I swear there's nothing unusual in these files...I can't think of why they would be different than anything else. |
There is something about sapid,go that cannot be parsed. Can I ask you to try to reduce the file to the point where gb will try to compile it (it's ok if it fails) -- or -- if you can reduce it to the point where it is not longer confidential. |
Commenting out the import ( ... ) block makes it compile. Trying to narrow it down further. |
ok, for some reason it is the last one, "sh/xrpc/xbufcached". With it commented out, gb tries to compile. With it there, it doesn't. The package exists in the project. |
Ok, so one package imports "sh/tools" and there were no .go files in there. But there was "sh/tools/ln/ln.go". That's my best guess right now... |
Awesome, that gives me something to go on, I'll try to produce a repo now. |
Hmm, so if something imports "sh/tools", but there are no go files in |
The thing was that gb wasn't even trying to compile and showing the error.
|
@patrickxb I'm trying to create a test for this problem. I need your help to locate the file in that imports a package that doesn't exist yet doesn't use it. It's likely that that package is using the side effect |
I made a small gb project that reproduces the issue, I believe. Doing |
And the
Hope that helps... |
Thank you very much for producing this repo. This is exactly what I need to On Wed, 6 Jul 2016, 15:14 Patrick Crosby notifications@github.com wrote:
|
Well, the good news is I broke this after 0.4.2, so a workaround is to build from that tag. The bad news is I broke this and didn't have a test, but now I do, so it should be fixed in 0.4.3. |
Cool, glad it helped! Really enjoying my experiment with |
Just wanted to drop in and say that I'm having a similar issue. gb just doesn't like a package I have, and it just stops building any file that imports it. It's a private file so not sure if I can easily break it out so it can be reproduced. Any idea when this issue might be resolved? Btw, @patrickxb, big fan on stathat. 👍 |
Arghhh. Turns out I'm not that special. I had changed a package's path and the import block of file with the issue hadn't been updated. I fixed the path and things seem to work again. Though what's weird is that this error wasn't printed when building. Either way, thanks for all your work on this, @davecheney. |
I'm pretty sure this is fixed now that 0.4.3 is out. Please reopen if this is not the case. |
I'm using:
And I still see this issue. If any import path in a main package points to a directory with no |
I'm trying out gb by copying one service out of a large repo and putting it into a
gb
project. I've been working on getting all of its dependencies in place, but now, inexplicably,gb
stopped trying to build the service. It does continue to build the dependencies, and if I create ahello
app it builds that.Directory layout:
project/src/srv/sapid/sapid.go, sapid_test.go (the service I'm trying to build,
package main
)project/src/sh/...(all packages needed by sapid.go)
project/src/std/... (some more packages need by sapid.go)
project/vendor/src/... (all vendored packages needed by sapid.go)
gb list
shows everything undersh
but notsrv/sapid
. If I add ahello
directory toproject/src/srv/
and place a main package with fmt.Println("hello"), the next invoccation ofgb list
will showsrv/sapid or
gb build all` will build hello.env DEBUG=. gb build all
shows srv/sapid inargs
.Any idea what is going on?
project/src/srv/sapid/sapid.go, sapid_test.go
were the first files I put in a gb project, andgb
was definitely attempting to build them. There are no build tags or anything that would cause it not to be built.Thanks!
The text was updated successfully, but these errors were encountered: