1. Make sure the path is set correctly </h2 b> There is a problem with the directory structure of the
project. Suggested structure:
project:
- bin (可不需要)
- src
- sub-project-1
- module1
- module2
- vendor
- sub-project-2
- pkg (可不需要)
and appends the project directory to the environment variable GOPATH. Only one path
is saved in GOPATH
##设置环境变量
vim /etc/profile
##编辑器中首行填写如下内容,GOPATH和GOROOT根据读者自己情况修改
export GOPATH=/root/go
export GOROOT=/usr/lib/golang
export PATH=$GOPATH/bin:$PATH
##wq保存退出文件,并执行
source /etc/profile
2. Check to see if there are duplicate folders </h2 b>
in the centos directory, or GOROOT directory, it was found that SRC/had the same directory file as the project in GOPATH, after deleting it and recompiling the project in GOPATH, the problem was solved. Where XXX stands for compilation engineering project.
rm -rf /usr/lib/golang/src/XXX
Read More:
- Go: How to Fix plug-in installation failure in vscode of windows system
- express nodejs Failed to lookup view error in views directory (How to Fix)
- Go get github.com/kotakanbe/go -Problems encountered in CVE dictionary Download
- Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory (How to Fix)
- How to Fix Module build failed: Error: ENOENT: no such file or directory, scandir xxxxxx\node_…
- standard_init_linux.go:178: exec user process caused “no such file or directory”
- Android layout: layer layout
- How to Fix ”is not in the sudoers file“ in Linux
- How to Fix Error in module RSQL of the database interface
- R language – path setting and working directory modification
- WordPress: How to Remove the directory name in the link
- How to Fix Error in python3 | PIP install Dlib
- How to Fix errors in Chinese input of latex
- The registered version of ArcEngine can edit the data in SDE (How to Fix 0x80040356 Error)
- [development experience] solution to unexpected syntax error: unexpected identifier in JSON parsing
- VScode: How to Fix “Comments are not permitted in JSON” issue
- How to Fix The error may exist in com/kuang/dao/UserMapper.xml
- How to Fix error reported by rqt_plot tool in ROS
- How to Fix ubuntu phpmyadmin error: “Connection for controluser as defined in your configuration failed”
- How to Fix error: ‘for’ loop initial declarations are only allowed in C99 mode