gpt4 book ai didi

go - 直接从域导入包(例如 goji)

转载 作者:IT王子 更新时间:2023-10-29 01:26:54 26 4
gpt4 key购买 nike

我在从 goji 导入包时注意到 - 它直接托管在他们的域之外,例如:

package web

import (
"goji.io"
)

func Start() {
mux := goji.NewMux()
}

go 如何请求包以及如何以这种方式托管包?我找不到任何文档,所以我认为这可能是一个巧妙的技巧。

最佳答案

它记录在 go 命令中,在 Remote Import Paths 下.

If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a tag in the document's HTML .

The meta tag has the form:

<meta name="go-import" content="import-prefix vcs repo-root"> 

The import-prefix is the import path corresponding to the repository root. It must be a prefix or an exact match of the package being fetched with "go get". If it's not an exact match, another http request is made at the prefix to verify the tags match.

关于go - 直接从域导入包(例如 goji),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37172147/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com