golang程序编译时提示“package runtime: unrecognized import path "runtime" (import path does not begin with hostname)”

在编译golang的工程时提示错误的, 提示的错误信息如下:

package bytes: unrecognized import path "bytes" (import path does not begin with hostname)
package encoding/json: unrecognized import path "encoding/json" (import path does not begin with hostname)
package encoding/xml: unrecognized import path "encoding/xml" (import path does not begin with hostname)
package fmt: unrecognized import path "fmt" (import path does not begin with hostname)
package bufio: unrecognized import path "bufio" (import path does not begin with hostname)
package io: unrecognized import path "io" (import path does not begin with hostname)
package strings: unrecognized import path "strings" (import path does not begin with hostname)
package go/ast: unrecognized import path "go/ast" (import path does not begin with hostname)
package go/parser: unrecognized import path "go/parser" (import path does not begin with hostname)
package go/token: unrecognized import path "go/token" (import path does not begin with hostname)
package compress/gzip: unrecognized import path "compress/gzip" (import path does not begin with hostname)
package encoding/hex: unrecognized import path "encoding/hex" (import path does not begin with hostname)
package errors: unrecognized import path "errors" (import path does not begin with hostname)
package strconv: unrecognized import path "strconv" (import path does not begin with hostname)
package encoding: unrecognized import path "encoding" (import path does not begin with hostname)
package text/template: unrecognized import path "text/template" (import path does not begin with hostname)
package encoding/base64: unrecognized import path "encoding/base64" (import path does not begin with hostname)
package math: unrecognized import path "math" (import path does not begin with hostname)
package os: unrecognized import path "os" (import path does not begin with hostname)
package reflect: unrecognized import path "reflect" (import path does not begin with hostname)
package regexp: unrecognized import path "regexp" (import path does not begin with hostname)
package sort: unrecognized import path "sort" (import path does not begin with hostname)
package sync: unrecognized import path "sync" (import path does not begin with hostname)
package time: unrecognized import path "time" (import path does not begin with hostname)
package unicode: unrecognized import path "unicode" (import path does not begin with hostname)
package unicode/utf8: unrecognized import path "unicode/utf8" (import path does not begin with hostname)
package io/ioutil: unrecognized import path "io/ioutil" (import path does not begin with hostname)
package path/filepath: unrecognized import path "path/filepath" (import path does not begin with hostname)
package go/doc: unrecognized import path "go/doc" (import path does not begin with hostname)
package net/url: unrecognized import path "net/url" (import path does not begin with hostname)
package syscall: unrecognized import path "syscall" (import path does not begin with hostname)
package unsafe: unrecognized import path "unsafe" (import path does not begin with hostname)
package os/exec: unrecognized import path "os/exec" (import path does not begin with hostname)
package os/user: unrecognized import path "os/user" (import path does not begin with hostname)
package runtime: unrecognized import path "runtime" (import path does not begin with hostname)
make: *** [Makefile:58:setup] 错误 1

经过最终搜索在github上找到了相对的解决方法:

最终通过执行:unset GOROOT  解决问题;

https://github.com/Rivalo/discord-cli/issues/33

 

posted @ 2019-08-18 10:28  HelloSUN  阅读(7588)  评论(1编辑  收藏  举报