gocv icon indicating copy to clipboard operation
gocv copied to clipboard

installing with "go get" gives "go.mod file not found in current directory or any parent directory."

Open kramer65 opened this issue 1 year ago • 1 comments

Description

Coming from Python, I'm just starting out with go, so please forgive me my ignorance. I'm trying to install gocv using the instructions here: https://gocv.io/getting-started/linux/ . Unfortunately I'm getting errors saying that go get is no longer supported outside a module.

Steps to Reproduce

  1. Tried to install it using the go get command:
kramer65@laptop:~$ go get -u -d gocv.io/x/gocv
go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
  1. I then tried installing using go install:
kramer65@laptop:~$ go install gocv.io/x/gocv@latest
package gocv.io/x/gocv is not a main package
  1. And from here I'm kinda lost. Any tips are welcome.

Your Environment

  • Operating System and version: Ubuntu 20.04
  • OpenCV version used: None yet. Wanted to install it using the makefile
  • How did you install OpenCV? Not yet
  • GoCV version used: latest
  • Go version: go1.18.5 linux/amd64
  • Did you run the env.sh or env.cmd script before trying to go run or go build? No. I didn't reach that point yet.

kramer65 avatar Aug 23 '22 12:08 kramer65

You have to use go mod init YOUR_MODULE_NAME to initialize first.

SleepyPrince avatar Sep 01 '22 07:09 SleepyPrince