bitrise-steplib / steps-virtual-device-testing-for-android

MIT License
22 stars 23 forks source link

Local test dies #3

Closed kikuchy closed 6 years ago

kikuchy commented 6 years ago

I want to merge this commit https://github.com/kikuchy/steps-virtual-device-testing-for-android/commit/7f59843aeb7e5e2cae471fddfa1942f523e79f4a . I'm making the pull request to merge above.

Then tied bitrise run test to follow How to use this Step. But Err check step failed.

+------------------------------------------------------------------------------+
| (1) Err check                                                                |
+------------------------------------------------------------------------------+
| id: script                                                                   |
| version: 1.1.4                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2017-10-10T16:22:50+09:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
+ errcheck -asserts=true -blank=true _/Users/kikuchy/tmp/steps-virtual-device-testing-for-android
cannot find package "_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android" in any of:
        /usr/local/Cellar/go/1.9/libexec/src/_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android (from $GOROOT)
        /Users/kikuchy/gopath/src/_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android (from $GOPATH)
error: failed to check packages: could not type check: no initial packages were loaded
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | Err check (exit code: 2)                                      | 0.71 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-script/issues             |
| Source: https://github.com/bitrise-io/steps-script                           |
+---+---------------------------------------------------------------+----------+

go list ./... command shows repository's path with _prefix. I'm not good at golang, but I think it's wrong path.

$ go list ./...
_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android

Why unnecessary _ prefix shown? How can I solve it?

Environment:

erosdome commented 6 years ago

Hi. It might be related to GOPATH not being set: https://stackoverflow.com/questions/31664129/executing-go-tests-underscore-in-place-of-correct-path

erosdome commented 6 years ago

Hi, did the provided information help with the issue?

kikuchy commented 6 years ago

Thank you for information!

But GOPATH is set.

$ echo $GOPATH
/Users/kikuchy/gopath

I tried to change GOPATH for working directory as a trial. But same error rises.

$ GOPATH=`pwd` bitrise run test

+------------------------------------------------------------------------------+
| (1) Err check                                                                |
+------------------------------------------------------------------------------+
| id: script                                                                   |
| version: 1.1.4                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2017-10-11T19:35:02+09:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
+ errcheck -asserts=true -blank=true _/Users/kikuchy/tmp/steps-virtual-device-testing-for-android github.com/golang/lint github.com/golang/lint/golint github.com/kisielk/errcheck github.com/kisielk/errcheck/internal/errcheck github.com/kisielk/gotool github.com/kisielk/gotool/internal/load golang.org/x/tools/benchmark/parse golang.org/x/tools/blog golang.org/x/tools/blog/atom golang.org/x/tools/cmd/benchcmp golang.org/x/tools/cmd/bundle golang.org/x/tools/cmd/callgraph golang.org/x/tools/cmd/compilebench golang.org/x/tools/cmd/cover golang.org/x/tools/cmd/digraph golang.org/x/tools/cmd/eg golang.org/x/tools/cmd/fiximports golang.org/x/tools/cmd/getgo golang.org/x/tools/cmd/getgo/server golang.org/x/tools/cmd/go-contrib-init golang.org/x/tools/cmd/godex golang.org/x/tools/cmd/godoc golang.org/x/tools/cmd/goimports golang.org/x/tools/cmd/gomvpkg golang.org/x/tools/cmd/gorename golang.org/x/tools/cmd/gotype golang.org/x/tools/cmd/goyacc golang.org/x/tools/cmd/guru golang.org/x/tools/cmd/guru/serial golang.org/x/tools/cmd/heapview golang.org/x/tools/cmd/heapview/internal/core golang.org/x/tools/cmd/html2article golang.org/x/tools/cmd/present golang.org/x/tools/cmd/ssadump golang.org/x/tools/cmd/stress golang.org/x/tools/cmd/stringer golang.org/x/tools/cmd/tip golang.org/x/tools/cmd/toolstash golang.org/x/tools/container/intsets golang.org/x/tools/cover golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/buildutil golang.org/x/tools/go/callgraph golang.org/x/tools/go/callgraph/cha golang.org/x/tools/go/callgraph/rta golang.org/x/tools/go/callgraph/static golang.org/x/tools/go/gccgoexportdata golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/gcimporter15 golang.org/x/tools/go/internal/gccgoimporter golang.org/x/tools/go/loader golang.org/x/tools/go/pointer golang.org/x/tools/go/ssa golang.org/x/tools/go/ssa/interp golang.org/x/tools/go/ssa/ssautil golang.org/x/tools/go/types/typeutil golang.org/x/tools/go/vcs golang.org/x/tools/godoc golang.org/x/tools/godoc/analysis golang.org/x/tools/godoc/redirect golang.org/x/tools/godoc/static golang.org/x/tools/godoc/util golang.org/x/tools/godoc/vfs golang.org/x/tools/godoc/vfs/gatefs golang.org/x/tools/godoc/vfs/httpfs golang.org/x/tools/godoc/vfs/mapfs golang.org/x/tools/godoc/vfs/zipfs golang.org/x/tools/imports golang.org/x/tools/playground golang.org/x/tools/playground/socket golang.org/x/tools/present golang.org/x/tools/refactor/eg golang.org/x/tools/refactor/importgraph golang.org/x/tools/refactor/rename golang.org/x/tools/refactor/satisfy
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:21:2: could not import golang.org/x/net/html (cannot find package "golang.org/x/net/html" in any of:
        /usr/local/Cellar/go/1.9/libexec/src/golang.org/x/net/html (from $GOROOT)
        /Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/net/html (from $GOPATH))
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:22:2: could not import golang.org/x/net/html/atom (cannot find package "golang.org/x/net/html/atom" in any of:
        /usr/local/Cellar/go/1.9/libexec/src/golang.org/x/net/html/atom (from $GOROOT)
        /Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/net/html/atom (from $GOPATH))
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:65:21: invalid operation: style (variable of type *invalid type) has no field or method FirstChild
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:69:12: invalid operation: style (variable of type *invalid type) has no field or method FirstChild
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:166:10: invalid operation: n (variable of type *invalid type) has no field or method Type
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:168:20: invalid operation: n (variable of type *invalid type) has no field or method Data
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:175:8: invalid operation: n (variable of type *invalid type) has no field or method DataAtom
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:250:11: invalid operation: node (variable of type *invalid type) has no field or method FirstChild
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:265:10: invalid operation: n (variable of type *invalid type) has no field or method DataAtom
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:271:21: invalid operation: n (variable of type *invalid type) has no field or method Attr
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:271:21: cannot range over n.Attr (invalid operand)
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:293:7: invalid operation: n (variable of type *invalid type) has no field or method DataAtom
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:302:23: invalid operation: node (variable of type *invalid type) has no field or method Attr
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:302:23: cannot range over node.Attr(invalid operand)
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/html2article/conv.go:327:12: invalid operation: n (variable of type *invalid type) has no field or method FirstChild
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:37:2: could not import golang.org/x/net/websocket (cannot find package "golang.org/x/net/websocket" in any of:
        /usr/local/Cellar/go/1.9/libexec/src/golang.org/x/net/websocket (from $GOROOT)
        /Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/net/websocket (from $GOPATH))
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:87:36: invalid operation: c (variable of type *invalid type) has no field or method Origin
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:92:8: invalid operation: c (variable of type *invalid type) has no field or method Origin
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:92:40: invalid operation: c (variable of type *invalid type) has no field or method Origin
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:92:67: invalid operation: c (variable of type *invalid type) has no field or method Origin
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:110:26: cannot use c (variable of type *invalid type) as io.Reader value in argument to json.NewDecoder: missing method Read
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:123:26: cannot use c (variable of type *invalid type) as io.Writer value in argument to json.NewEncoder: missing method Write
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/playground/socket/socket.go:140:42: invalid operation: c (variable of type *invalid type) has no field or method Request
/Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/golang.org/x/tools/cmd/present/play_socket.go:30:26: cannot use socket.NewHandler(origin) (value with invalid type) as net/http.Handler value in argument to http.Handle: missing method ServeHTTP
cannot find package "_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android" in any of:
        /usr/local/Cellar/go/1.9/libexec/src/_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android (from $GOROOT)
        /Users/kikuchy/tmp/steps-virtual-device-testing-for-android/src/_/Users/kikuchy/tmp/steps-virtual-device-testing-for-android (from $GOPATH)
error: failed to check packages: could not type check: couldn't load packages due to errors: _/Users/kikuchy/tmp/steps-virtual-device-testing-for-android, golang.org/x/tools/cmd/present, golang.org/x/tools/playground/socket and 1 more
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | Err check (exit code: 2)                                      | 3.45 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-script/issues             |
| Source: https://github.com/bitrise-io/steps-script                           |
+---+---------------------------------------------------------------+----------+

What is the cause of it...?

viktorbenei commented 6 years ago

Hi @kikuchy

Please do the following to be able to run all the go tools for this step:

  1. Open your Terminal/Command Line
  2. run: echo "$GOPATH" to check whether GOPATH is set. If it is then 👍 , if it would not then please set it
  3. now run: git clone https://github.com/bitrise-steplib/steps-virtual-device-testing-for-android.git $GOPATH/src/github.com/bitrise-steplib/steps-virtual-device-testing-for-android
  4. the git clone should succeed, and now you should be able to: cd "$GOPATH/src/github.com/bitrise-steplib/steps-virtual-device-testing-for-android"

That's all, at that place all the go tools should work for the project (most of the Go tools expect you to run the go tool/command inside GOPATH, a "properly" configured Go workspace where the code lives in the src dir and includes the git "path" (github.com/bitrise-steplib/steps-virtual-device-testing-for-android in this case)).

Please let us know if that wouldn't work (with attached logs)! :)

viktorbenei commented 6 years ago

I'll close this ticket for now, but just let us know if you'd have any questions @kikuchy and we'll reopen it! :)