Golang出现的奇怪的问题

  • Post author:
  • Post category:golang


编译时

C:\Go\pkg\tool\windows_amd64\link.exe: cannot open file C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: open C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: The system cannot find the file specified.

huanggang@DESKTOP-C1VUL6T MINGW64 /c/Program Files/StudyGo/src/mypublicchain/day02_03_Persistence (master)
$ go build main.go
# command-line-arguments
C:\Go\pkg\tool\windows_amd64\link.exe: cannot open file C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: open C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: The system cannot find the file specified.

使用 go build -i -v 进行检查 发现是路径出现错误

huanggang@DESKTOP-C1VUL6T MINGW64 /c/Program Files/StudyGo/src/mypublicchain/day02_03_Persistence (master)
$ go build -i -v
main.go:4:2: local import "./BLC" in non-local package

原先的路径

import (

	"fmt"
	"./BLC"
)

修改后的路径

import (

	"fmt"
	"mypublicchain/day02_03_Persistence/BLC"
)



版权声明:本文为weixin_40098405原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。