EngoEngine/engo

cannot find module providing package: working directory is not part of a module

Opened this issue · 4 comments

I'm trying to execute the Tutorial 1 code but I run into this error:

$ go run traffic.go
traffic.go:4:2: cannot find module providing package github.com/EngoEngine/ecs: working directory is not part of a module
traffic.go:5:2: cannot find module providing package github.com/EngoEngine/engo: working directory is not part of a module
traffic.go:6:2: cannot find module providing package github.com/EngoEngine/engo/common: working directory is not part of a module

I had to activate modules in order to solve this other error: #724

I added the proper go.mod file in this commit to the TrafficManager repository. Make sure you pull the latest changes and it should work for you. Let me know how it goes.

We’ll actually have to add that to all the branches as well. I can get around to it this evening when I’m home if it’s still needed ^_^

ETA I’ll also add a bit about go mod in the tutorial, since that’s basically required now :P

Great, thank you :). One thing though: in the Foreword, you recommend setting GOPATH and running go get -u github.com/EngoEngine/engo inside GOPATH. This should be fine because, even though modules are on by default, the GOPATH/src is excluded from module behavior.

However, due to issue #724, one must force module behavior by setting the environment variable GO111MODULE=on. This variable makes any folder inside GOPATH be module-aware.

Thus, once GO111MODULE is set, you can no longer use go get inside GOPATH (if you do, the packages are just cached), and the only way to download a package would be to use git clone.

So perhaps it would be better to indicate git clone from the beginning of the tutorial, instead of go get? I'm quite new to this, but at least that's how I understood it.

All branches now have go modules, but I haven't gotten to updating the tutorial yet so I'll leave this open