【问题标题】:Go import error: invalid version unknow revisionGo import error: invalid version unknow revision
【发布时间】:2020-04-29 07:20:36
【问题描述】:

Code, file structure on left and error

package main

import (
    "fmt"

    "github.com/cilium/cilium/api/v1/models"
    "github.com/cilium/cilium/pkg/client"
    log "github.com/sirupsen/logrus"
)

func main() {
    fmt.Println("Starting Application...")

    fmt.Println("Terminating Application...")
}

这是我运行时遇到的错误:go run main.go

github.com/cilium/cilium@1.7.2 requires github.com/optiopay/kafka@v0.0.0-2080809090225-01ce283b732b: ivalid version: unknown revision 01ce283b732b

我正在为我的依赖项使用 go mod 文件,我的 go 版本是最新的 1.14

我还检查了我的文件结构,我已经在 pkg/mod/github.com/cilium 下有 cilium@v1.7.2

我尝试在我的代码中的导入语句下添加github.com/optiopay/kafka,但我仍然得到同样的错误。

我不知道如何解决这个问题,我在谷歌上搜索,但我找不到任何有效的明确或明确的答案。任何帮助都表示赞赏。

【问题讨论】:

    标签: go cilium


    【解决方案1】:

    您看到此错误是因为 go.mod 中的 replace 指令被 go mod/go get 忽略,并且 Cilium v​​1.7.2 的 go.mod 文件包含许多替换指令。 要解决此问题,请将您尝试导入的 Cilium 版本的替换指令复制到您自己的 go.mod 文件中。 Cilium v​​1.7 的示例可以在this repository 中找到。

    【讨论】:

      【解决方案2】:

      似乎 optiopay/kafka 是您的私人仓库。您可以使用 git 配置 ssh。并在 git config 中设置你的 url 以使用 ssh 而不是 https。

      步骤:

      1. 配置 ssh(如果尚未完成)
      2. 更新 git 配置 -> git config --system url."git@github.com:".insteadOf "https://github.com/"

      【讨论】:

      猜你喜欢
      • 2020-01-21
      • 1970-01-01
      • 2022-12-28
      • 1970-01-01
      • 2017-06-28
      • 2022-08-10
      • 2022-12-28
      • 1970-01-01
      • 2018-05-27
      相关资源
      最近更新 更多