nknorg/tuna

Compilation fails

zero24x opened this issue · 8 comments

hello,

great work but currently compilation fails, maybe an sdk issue?
"glide install" works but the go build fails:

user@server:~/tuna/exit$ go build exit.go
../../go/src/github.com/nknorg/nkn-sdk-go/wallet.go:9:2: cannot find package "github.com/nknorg/nkn/core/contract" in any of:
/usr/local/go/src/github.com/nknorg/nkn/core/contract (from $GOROOT)
/home/mn1/go/src/github.com/nknorg/nkn/core/contract (from $GOPATH)
../../go/src/github.com/nknorg/nkn-sdk-go/client.go:12:2: cannot find package "github.com/nknorg/nkn/core/ledger" in any of:
/usr/local/go/src/github.com/nknorg/nkn/core/ledger (from $GOROOT)
/home/mn1/go/src/github.com/nknorg/nkn/core/ledger (from $GOPATH)
../../go/src/github.com/nknorg/nkn-sdk-go/wallet.go:10:2: cannot find package "github.com/nknorg/nkn/core/signature" in any of:
/usr/local/go/src/github.com/nknorg/nkn/core/signature (from $GOROOT)
/home/mn1/go/src/github.com/nknorg/nkn/core/signature (from $GOPATH)
../../go/src/github.com/nknorg/nkn-sdk-go/wallet.go:11:2: cannot find package "github.com/nknorg/nkn/core/transaction" in any of:
/usr/local/go/src/github.com/nknorg/nkn/core/transaction (from $GOROOT)
/home/mn1/go/src/github.com/nknorg/nkn/core/transaction (from $GOPATH)
exit.go:13:2: cannot find package "github.com/nknorg/tuna" in any of:
/usr/local/go/src/github.com/nknorg/tuna (from $GOROOT)
/home/mn1/go/src/github.com/nknorg/tuna (from $GOPATH)
exit.go:17:2: cannot find package "github.com/trueinsider/smux" in any of:
/usr/local/go/src/github.com/trueinsider/smux (from $GOROOT)
/home/mn1/go/src/github.com/trueinsider/smux (from $GOPATH)

Yes, the sdk has not been updated (and migrate to go modules) yet, so currently if you want to build it, you would need some manual work like install those dependencies manually... But it's recommended to use it after sdk is updated

ok thanks for the reply, so we will wait for an update

@zero24x sdk was updated, but I didn't check yet if tuna itself will compile
feel free to check though

hello great, thanks for your reply @trueinsider i will try to rebuild now

I heard from @zhtangsh that there is some problem (e.g. should migrate from glide to go modules)

update, sorry compile still does not work. i think tuna is part of the heart of nkn so would be nice if it works !

zz@y:~/go/src/github.com/nknorg/tuna/entry$ go build entry.go

command-line-arguments

./entry.go:49:4: cannot use wallet (type *"github.com/nknorg/tuna/entry/vendor/github.com/nknorg/nkn-sdk-go".WalletSDK) as type *"github.com/nknorg/nkn-sdk-go".WalletSDK in field value
./entry.go:373:10: cannot use wallet (type *"github.com/nknorg/tuna/entry/vendor/github.com/nknorg/nkn-sdk-go".WalletSDK) as type *"github.com/nknorg/nkn-sdk-go".WalletSDK in argument to tuna.UpdateMetadata
zz@y:~/go/src/github.com/nknorg/tuna/entry$

after some research i was able to compile with this changes ( am new to google go so maybe it is wrong) and just the command "make build" in the end:

deleted: entry/glide.lock
deleted: entry/glide.yaml

new file go.mod:

go 1.12

require (
github.com/nknorg/nkn-sdk-go v0.0.0-20190710235647-86437d8d12e5
github.com/trueinsider/smux v1.0.9-0.20190305073332-424be8395d81
)

new file Makefile

GOFMT=go fmt
Minversion:=$(shell date)
IDENTIFIER=$(GOOS)-$(GOARCH)

.PHONY: build
build:
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GC) -o entry/entry entry/entry.go
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GC) -o exit/exit exit/exit.go

This should have been fixed as we have moved to go modules quite a long time ago