bitrise-steplib / steps-go-list

MIT License
0 stars 1 forks source link

Failed to list packages: go "list" "./..." failed: go: cannot find main module #9

Closed daniellevass closed 3 years ago

daniellevass commented 3 years ago

Troubleshooting

Issue description

Hi,

Running this step locally on my MacBook causes the following error:

INFO[19:51:37] Step uses latest version -- Updating StepLib ... 
+------------------------------------------------------------------------------+
| (0) go-list                                                                  |
+------------------------------------------------------------------------------+
| id: go-list                                                                  |
| version: 1.0.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2021-04-19T19:51:39+01:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
Configs:
- exclude: */vendor/*
Failed to list packages: go "list" "./..." failed: go: cannot find main module, but found .git/config in /Users/daniellevass/go/src/github.com/s/bitrise-step-test
    to create a module there, run:
    go mod init
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | go-list (exit code: 1)                                        | 3.57 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-steplib/steps-go-list/issues       |
| Source: https://github.com/bitrise-steplib/steps-go-list                     |
+---+---------------------------------------------------------------+----------+
Screenshot 2021-04-19 at 19 56 45

I get this problem if I try to build the add trace sdk android project - but i also get the same problem if i create a fresh project with this step. I'm new to go so I'm not sure if I'm missing something but I followed this guide to create my step

Bitrise info

go version : go1.16.3 darwin/amd64

My project is located in : /Users/daniellevass/go/src/github.com/bitrise-steplib/bitrise-add-trace-sdk-android which is where the new step tool put it by default.

OSX version: 10.15.6

Steps to reproduce

Simplest:

  1. Follow https://devcenter.bitrise.io/contributors/create-your-own-step/ to create a new step
  2. Update bitrise.yml test workflow to add this step:
    
    workflows:
    test:
    steps:
    - go-list:

..... etc...


3. Run `bitrise run test`
4. experience issue.

More complex:
1. Check out https://github.com/bitrise-steplib/bitrise-add-trace-sdk-android
2. Run `bitrise run test`
3. experience issue.
lpusok commented 3 years ago

I see https://github.com/bitrise-steplib/bitrise-add-trace-sdk-android does not use go modules yet. Try running go env -w GO111MODULE=auto or updating to Go modules. In go 1.16 GOPATH mode is disabled by default and this Step does not migrate to go modules automatically (But Steps not yet using Go modules are migrated at runtime by Bitrise CLI)

daniellevass commented 3 years ago

That seems to work - thank you so kindly for explaining!