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

.Creator (wrong type for New method) #11

Open
hexvalid opened this issue Apr 19, 2019 · 2 comments
Open

.Creator (wrong type for New method) #11

hexvalid opened this issue Apr 19, 2019 · 2 comments

Comments

@hexvalid
Copy link

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)

@Eun
Copy link

Eun commented May 2, 2019

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{}

@karalabe
Copy link
Member

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.

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

No branches or pull requests

3 participants