go-libtor
go-libtor copied to clipboard
.Creator (wrong type for New method)
trafficstars
Title says 'all. I cant build on go version go1.12.4 linux/amd64
[hexvalid@EXCALIBUR testo]$ go build -v -x
WORK=/tmp/go-build977634229
testo
mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg << 'EOF' # internal
# import config
packagefile context=/usr/lib/go/pkg/linux_amd64/context.a
packagefile fmt=/usr/lib/go/pkg/linux_amd64/fmt.a
packagefile github.com/cretz/bine/tor=/home/hexvalid/go/pkg/linux_amd64/github.com/cretz/bine/tor.a
packagefile github.com/ipsn/go-libtor=/home/hexvalid/go/pkg/linux_amd64/github.com/ipsn/go-libtor.a
packagefile log=/usr/lib/go/pkg/linux_amd64/log.a
packagefile net/http=/usr/lib/go/pkg/linux_amd64/net/http.a
packagefile os=/usr/lib/go/pkg/linux_amd64/os.a
packagefile time=/usr/lib/go/pkg/linux_amd64/time.a
packagefile runtime=/usr/lib/go/pkg/linux_amd64/runtime.a
EOF
cd /home/hexvalid/go/src/testo
/usr/lib/go/pkg/tool/linux_amd64/compile -o $WORK/b001/_pkg_.a -trimpath $WORK/b001 -p main -complete -buildid YfwSb0txKWHTdOElGWGw/YfwSb0txKWHTdOElGWGw -goversion go1.12.4 -D "" -importcfg $WORK/b001/importcfg -pack -c=4 ./main.go
# testo
./main.go:18:42: cannot use "github.com/ipsn/go-libtor".Creator (type "github.com/ipsn/go-libtor/vendor/github.com/cretz/bine/process".Creator) as type "github.com/cretz/bine/process".Creator in field value:
"github.com/ipsn/go-libtor/vendor/github.com/cretz/bine/process".Creator does not implement "github.com/cretz/bine/process".Creator (wrong type for New method)
have New(context.Context, ...string) ("github.com/ipsn/go-libtor/vendor/github.com/cretz/bine/process".Process, error)
want New(context.Context, ...string) ("github.com/cretz/bine/process".Process, error)
Had the same problem, ended up using a wrapper:
package internal
import (
"context"
"github.com/cretz/bine/process"
libtor "github.com/ipsn/go-libtor"
)
var creator = libtor.Creator
type LibTorWrapper struct{}
func (LibTorWrapper) New(ctx context.Context, args ...string) (process.Process, error) {
return creator.New(ctx, args...)
}
// ...
ProcessCreator: internal.LibTorWrapper{}
Ah, this seems to originate from the vendor folder. If you're project is using go modules, it should be already fine. Otherwise I guess the workaround above is needed.