登录
首页 >  Golang >  Go问答

使用 github 导入 Go 包

来源:stackoverflow

时间:2024-03-26 19:12:32 249浏览 收藏

作为一名 Go 新手,在从 GitHub 存储库中导入和使用模块时遇到困难。具体来说,无法导入此存储库中的模块:https://github.com/darkbladecr/ccxt/tree/go/go。虽然使用了 Go 模块来管理依赖项,但导入仍在失败。

问题内容

我是 golang 新手,正在尝试从此 github 存储库导入和使用模块。 https://github.com/darkbladecr/ccxt/tree/go/go

我正在使用 go 模块来管理依赖项,但导入失败。

package main

import (
    "fmt"
    "github.com/darkbladecr/ccxt/go/pkg/ccxt/models"
)

但是我收到了这个错误。

go: finding github.com/Darkbladecr/ccxt latest
build command-line-arguments: cannot load github.com/Darkbladecr/ccxt/go/pkg/ccxt/models: cannot find module providing package github.com/Darkbladecr/ccxt/go/pkg/ccxt/models

是否可以像此存储库一样为 go 导入特定目录?


解决方案


您可以通过 go get 显式包含该包的分支,或者以 go 工具识别的格式在该分支上添加显式版本标记(标记上带有前导 v 前缀,例如 v1.18.445v0.1)。 1.0-go)。

终于介绍完啦!小伙伴们,这篇关于《使用 github 导入 Go 包》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布Golang相关知识,快来关注吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>