Your first program - cannot find package

I’m really struggling to understand the import paths etc.

cannot find package "" in any of:

cheers tc

The package “” has to exist in the GOPATH, in your case “/root/go”, or in your GitHub profile, installing:

go get is just a directory on my computer, not linked to github.

go get

# cd .; git clone /root/go/src/
Cloning into '/root/go/src/'...
fatal: could not read Username for '': terminal prompts disabled
package exit status 128
mkdir -p $( echo $GOPATH)/src/
vim $( echo $GOPATH)/src/

Put in your main.go

package main

import (

func main() {

Install again

go install

And execute

1 Like

Cheers, I am not very good with vim so used nano. If I created a main.go then I have to point $GOPATH to it?

No, if you created main.go inside the “”, only execute:

go install

Remember that “” should be within “$GOPATH/src/”


I think I’m getting the hang of it now. Thanks for your help :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.