trezor / trezord-go

:smiling_imp: Trezor Communication Daemon (written in Go)
GNU Lesser General Public License v3.0
244 stars 146 forks source link

Is the readme install instruction still correct? #227

Closed DWShuo closed 3 years ago

DWShuo commented 3 years ago

just running go get github.com/trezor/trezord-go gives you the trezord-go executable under $GOPATH/bin

when i run go build github.com/trezor/trezord-go i get the following error:

no required module provides package github.com/trezor/trezord-go: go.mod file not found in current directory or any parent directory; see 'go help modules'

tsusanka commented 3 years ago

What happens if you run go mod download and try build then?

DWShuo commented 3 years ago

What happens if you run go mod download and try build then?

where do i run this command?

tsusanka commented 3 years ago

Now that I think of it I think it should not be needed. @DWShuo what Go version do you have? Are you on current master?

DWShuo commented 3 years ago

@tsusanka yes currently on master, with go version go1.16.2 linux/amd64

ETNyx commented 3 years ago

Hello, I have got exact same error,... I'm using Archlinux

% pacman -Q go
go 2:1.16.3-1

% go get github.com/trezor/trezord-go
go: downloading github.com/trezor/trezord-go v2.0.29+incompatible
go: downloading github.com/gorilla/csrf v1.7.0
go: downloading github.com/gorilla/handlers v1.5.1
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/felixge/httpsnoop v1.0.1
go: downloading github.com/gorilla/securecookie v1.1.1
go: downloading github.com/pkg/errors v0.9.1

% go build github.com/trezor/trezord-go
no required module provides package github.com/trezor/trezord-go: go.mod file not found in current directory or any parent directory; see 'go help modules'

not sure what's wrong?

ETNyx commented 3 years ago

Well looks like this may help,... , force env GO111MODULE to auto

% GO111MODULE=auto go get github.com/trezor/trezord-go
# github.com/trezor/trezord-go/usb/lowlevel/libusb
cgo-gcc-prolog: In function ‘_cgo_0328dca10925_Cfunc_libusb_set_debug’:
cgo-gcc-prolog:1186:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
In file included from go/src/github.com/trezor/trezord-go/usb/lowlevel/libusb/libusb.go:70:
go/src/github.com/trezor/trezord-go/usb/lowlevel/libusb/c/core.c:2107:19: note: declared here
 2107 | void API_EXPORTED libusb_set_debug(libusb_context *ctx, int level)
      |                   ^~~~~~~~~~~~~~~~
GO111MODULE=auto go get github.com/trezor/trezord-go  3.92s user 1.41s system 44% cpu 11.841 total

% GO111MODULE=auto go build github.com/trezor/trezord-go
# github.com/trezor/trezord-go/usb/lowlevel/libusb
cgo-gcc-prolog: In function ‘_cgo_0328dca10925_Cfunc_libusb_set_debug’:
cgo-gcc-prolog:1186:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
In file included from go/src/github.com/trezor/trezord-go/usb/lowlevel/libusb/libusb.go:70:
go/src/github.com/trezor/trezord-go/usb/lowlevel/libusb/c/core.c:2107:19: note: declared here
 2107 | void API_EXPORTED libusb_set_debug(libusb_context *ctx, int level)
      |                   ^~~~~~~~~~~~~~~~

% ./trezord-go -v
2021/04/22 21:59:38 trezord v2.0.31 (rev unknown) is starting
[0.000096 : 21:59:38] [trezord.go 77 main.initUsb] Initing libusb
[0.000123 : 21:59:38] [usb/libusb.go 63 usb.InitLibUSB] init
[0.000575 : 21:59:38] [usb/libusb.go 74 usb.InitLibUSB] init done
[0.000592 : 21:59:38] [trezord.go 179 main.main] UDP port count - 0
[0.000605 : 21:59:38] [trezord.go 201 main.main] Creating core
[0.000665 : 21:59:38] [trezord.go 203 main.main] Creating HTTP server
[0.000700 : 21:59:38] [server/http.go 35 server.New] starting
[0.001314 : 21:59:38] [server/http.go 68 server.New] server created
[0.001347 : 21:59:38] [trezord.go 210 main.main] Running HTTP server
prusnak commented 3 years ago

Thanks.

Indeed GO111MODULE needs to be set to auto for new versions of go.

Fixed in dc487a0c5350f1f06d612450db5fcbd9bba65136