sourcegraph / appdash

Application tracing system for Go, based on Google's Dapper.
https://sourcegraph.com
Other
1.72k stars 137 forks source link

Go 1.5 issues with package internal #77

Closed aybabtme closed 9 years ago

aybabtme commented 9 years ago

In Go 1.5, the internal/ package rule is enforced. When trying to build appdash, the build errors with a message:

package sourcegraph.com/sourcegraph/appdash/cmd/appdash
    imports github.com/cznic/mathutil
    imports github.com/elazarl/go-bindata-assetfs
    imports github.com/gogo/protobuf/io
    imports github.com/gogo/protobuf/proto
    imports github.com/gorilla/context
    imports github.com/gorilla/mux
    imports github.com/jessevdk/go-flags
    imports sourcegraph.com/sourcegraph/appdash
    imports sourcegraph.com/sourcegraph/appdash/internal/wire
    imports sourcegraph.com/sourcegraph/appdash/internal/wire
    imports sourcegraph.com/sourcegraph/appdash/internal/wire: use of internal package not allowed

I think this means you'd have to move the cmd/appdash somewhere to be a root of internal. Perhaps the easiest thing is to move ./internal to ./cmd/appdash/internal although it's not very elegant.

slimsag commented 9 years ago

If indeed true, this is a bit strange.

The only package that imports sourcegraph.com/sourcegraph/appdash/internal/wire is sourcegraph.com/sourcegraph/appdash in collector_test.go collector.go and span.go. appdash/cmd/appdash does not directly import the appdash/internal package.

The "internal" packages design doc says that:

$GOPATH/src/mypkg/internal/foo can be imported only by code in $GOPATH/src/mypkg.

So I would assume that this would work just fine? :/

I'll install Go 1.5 and see if I can reproduce this over the next few days. Sorry for the trouble it's causing you!

dmitshur commented 9 years ago

This might be related to https://github.com/golang/go/issues/11307.

slimsag commented 9 years ago

@shurcooL Nice find! Thanks for linking to that :+1:

aybabtme commented 9 years ago

that explains that! thanks @shurcooL

slimsag commented 9 years ago

This was fixed, so closing.

andreimatei commented 8 years ago

I'm still getting this error with Go 1.7. Haven't tried with other versions. Do you suppose I'm doing something wrong?

[andrei:~] ± go get github.com/sourcegraph/appdash
package github.com/sourcegraph/appdash
        imports sourcegraph.com/sourcegraph/appdash/internal/wire: use of internal package not allowed
[andrei:~] ± go build
package github.com/sourcegraph/appdash
        imports sourcegraph.com/sourcegraph/appdash/internal/wire: use of internal package not allowed
andreimatei commented 8 years ago

Oops false alarm, I wasn't using your canonical import path, with is sourcegraph.com, not github.com. Sorry about that.