I can't use packages

I’m having problems to use packages. I a following literally the steps I find online, but I have an error message.

I have this package in GOPATH:

package greet

var morning = "Good morning"
var Morning = "hey" + morning

I want to import it in my code:

package main

import ("fmt"

func main(){

When I run entry.go, I receive this message: entry.go:4:3: package greet is not in GOROOT (/usr/local/go/src/greet)

Does anybody how to fix it?

Thank you.

Modern go does not rely on GOPATH anymore.

Please use proper modules with an appropriate module path.

1 Like