goland中導(dǎo)包報紅和go mod問題
goland導(dǎo)包報紅
1. 原理
import的包有兩類:
(1)在go.mod中有地址的,這種需要拉到gopath/pkg下
(2)沒在go.mod的,這種在項目里,import的路徑需要從path路徑(即:/go/src/,gopath為go尋找的根路徑)為根路徑可以找到的:import github.com/CardInfoLink/quickpay/internal/ins,對應(yīng)項目所在路徑:/go/src/github.com/CardInfoLink/quickpay
2. 以前的筆記


要打開項目的直接目錄:trunk
若打開上級的話則報紅
可能有關(guān)這些配置文件的原因
go mod
go mod tidy
goland 還是報紅的話 goland Preference->Go->Go Modules(vgo) -> Enable Go Modules(vgo)intergration
jrw@wangfy:~/code/community/article$ go mod
Go mod provides access to operations on modules.
Note that support for modules is built into all the go commands,
not just 'go mod'. For example, day-to-day adding, removing, upgrading,
and downgrading of dependencies should be done using 'go get'.
See 'go help modules' for an overview of module functionality.
Usage:
go mod <command> [arguments]
The commands are:
download download modules to local cache
edit edit go.mod from tools or scripts
graph print module requirement graph
init initialize new module in current directory
tidy add missing and remove unused modules
vendor make vendored copy of dependencies
verify verify dependencies have expected content
why explain why packages or modules are needed
Use "go help mod <command>" for more information about a command.GO111MODULE=on
export GOPROXY=https://goproxy.io
sudo chmod -R 777 /工作目錄 (-R:是指幾連醫(yī)用到目錄里所有子目錄和文件;777:是指所有用戶都擁有的最高權(quán)限)
go mod tidy
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Go語言從單體服務(wù)到微服務(wù)設(shè)計方案詳解
這篇文章主要為大家介紹了Go語言從單體服務(wù)到微服務(wù)設(shè)計方案詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03
gorm+gin實現(xiàn)restful分頁接口的實踐
本文主要介紹了gorm+gin實現(xiàn)restful分頁接口的實踐,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-12-12
golang?gin框架實現(xiàn)大文件的流式上傳功能
這篇文章主要介紹了golang?gin框架中實現(xiàn)大文件的流式上傳,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-07-07
Golang的select多路復(fù)用及channel使用操作
這篇文章主要介紹了Golang的select多路復(fù)用及channel使用操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-12-12

