Jostimian
Jostimian

Reputation: 119

Go does not recognize installed library using go get

So I am working with JSON in golang and I want to use this package in GitHub https://github.com/icza/dyno so i use the go get github.com/icza/dyno command to get the package. but when i run my code this error show

d:\Repos\GoProjects\src\github.com\Timothy Ganoza\sbx\main.go:8:2: cannot find package "github.com/icza/dyno" in any of:
    C:\Program Files\Go\src\github.com\icza\dyno (from $GOROOT)
    d:\Repos\GoProjects\go\src\github.com\icza\dyno (from $GOPATH)
exit status 1
Process exiting with code: 1

Upvotes: 0

Views: 1147

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273416

I recommend going through the following path, using official documentation pages:

  1. Read about properly installing Go for your platform
  2. Read the getting started tutorial which also tells you how to install 3rd-party packages and use them in your code.

It should take you no more than 20 minutes to go through these steps, and it's almost certain that you'll be able to accomplish your goal by the end of the process. As a bonus, keep going through the Getting Started guide beyond the first page to learn how to create your own Go modules, use them from other modules, write tests, build your code into a binary, and more.

This is IMHO the minimal background required to even try writing Go programs; without going through these steps, you will lack crucial fundamental understanding and it will be hard to even understand SO answers.


If problems still persist, feel free to update the question but provide more details: how are your go env vars set up (output of go env), are you using modules (you should!), how does your module directory look, etc.

Upvotes: 4

Related Questions