PuerkitoBio/goquery

package github.com/PuerkitoBio/goquery is not a main package

anujgoyal opened this issue · 1 comments

What is the proper way to install goquery?

$ go version
go version go1.18.4 darwin/arm64

$ go get github.com/PuerkitoBio/goquery
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'.

$ go install github.com/PuerkitoBio/goquery
go: 'go install' requires a version when current directory is not in a module
        Try 'go install github.com/PuerkitoBio/goquery@latest' to install the latest version

$ go install github.com/PuerkitoBio/goquery@latest
go: downloading github.com/PuerkitoBio/goquery v1.8.0
go: downloading golang.org/x/net v0.0.0-20210916014120-12bc252f5db8
go: downloading github.com/andybalholm/cascadia v1.3.1
package github.com/PuerkitoBio/goquery is not a main package
mna commented

Hello,

This is the same issue that you opened here and I sent you some information on what to do: #422. You need to initialize a Go module first, it's basically:

# in your project's directory where you want to use goquery:
$ go mod init 
$ go get github.com/PuerkitoBio/goquery

For more information, take a look at the links I put in the other issue.

Martin