Ask questions about golang environment variables and importing custom .go files

Hello, everyone. I just started playing go today. My deployment is as follows:
export GOROOT=$HOME/source/go
export GOBIN=$GOROOT/bin
export GOARCH=amd64
export GOOS=linux
export GOPATH=$HOME/dewei/go
export PATH=.:$PATH:$GOBIN

then my work address is dewei/work_go, create main.go, create urls/url.go in directory, import prompt failed in main.go, under the reminder of a friend, I changed my work path to dewei/go/src, created a main.go, and created urls/url.go under src and still reported an error. The error cannot be found as follows:

main.go:7:2: cannot find package "linju/urls/url" in any of:

    /home/tusimple/source/go/src/linju/urls/url (from $GOROOT)
    /home/tusimple/dewei/go/src/linju/urls/url (from $GOPATH)
   
The

main.go import method is as follows:
import "linju/urls/url" this linju is under / home/tusimple/dewei/go/src/.

Nov.10,2021

import "urls"

this should be the import. Url is the file name of go.
GOPATH is set correctly and does not need to be changed.
and your linju doesn't know what it is.
I suggest you take a look at the basics of go, step by step, and don't be too impatient.


change to import "linju/urls
and then use urls.FuncName
because there is no import file in go, only the import package, and the package is a folder

.
Menu