执行代码构建错误,标准软件包中非标准导入“ fmt”,不允许导入周期

I've been working in go for a little while and this weekend I wanted to try to deploy some server code. When I run go build on some very simple code to test if Go is working I get this error:

can't load package: ($HOME)/go/src/goTest/main.go:4:2: non-standard 
import "fmt" in standard package "goTest"
import cycle not allowed
package goTest
        imports fmt
        imports errors
        imports runtime
        imports runtime/internal/atomic
        imports unsafe
        imports runtime

In my ~/.bashrc I'm running this to set environment variables.

export GOPATH=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

My go workspace is in $HOME/go and my go install is at the default /usr/local/go. Any help is appreciated

main.go

package main

import (
    "fmt"
)

func main() {
    fmt.Println("test")
}

Edit: go version is go1.6 linux/amd64

Set $GOPATH, $GOROOT, and $GOBIN correctly. In this case, they should be as follows.

export GOPATH="$HOME/go"
export GOROOT="/usr/local/go"

Also, locate the source code correctly. Maybe it should be under $GOPATH/src/github.com/<your id>/<repository name>/

(If you use newer version of Go (>=1.8), you don't have to set $GOPATH and others. Details here.)

I haven't seen this, but try fixing your paths:

1) export GOPATH=$HOME/go.

2) export GOROOT=/usr/local/go.

3) mkdir -p $GOPATH/src/github.com/nubrozaref/goTest

4) mv $GOPATH/src/goTest/ $GOPATH/src/github.com/nubrozaref/goTest

5) if you want: ln -s $GOPATH/src/github.com/nubrozaref/goTest ~/goTest