如何进行分支(fork)?错误:找到了,但不包含包。

huangapple go评论82阅读模式
英文:

How to fork? Error: found, but does not contain package

问题

运行:

go install github.com/google/gnostic@v0.6.8
go install github.com/googleapis/gnostic-grpc@v0.1.1

并且工具可以正常工作:

gnostic --grpc-out=./target ./source.yaml

我已经fork了库https://github.com/google/gnostic-grpc,并对其进行了修改,以便不进行任何蛇形命名转换,并且我已经将包和所有对github.com/thlib/gnostic-grpc的引用重命名,以便希望可以安装。

然后我尝试使用以下命令进行安装:

go install github.com/thlib/gnostic-grpc@04d3e8500daa070fbe8c6118fe3b62e42d4a9b1f

还有:

go install github.com/google/gnostic@v0.6.8
go install github.com/thlib/gnostic-grpc@v0.1.3

但是它报错了:

go: downloading github.com/thlib/gnostic-grpc v0.1.3
go: github.com/thlib/gnostic-grpc@v0.1.3: module github.com/thlib/gnostic-grpc@v0.1.3 found, but does not contain package github.com/thlib/gnostic-grpc

我不明白我做错了什么。

  1. 包已重命名
  2. 运行了 go mod init github.com/thlib/gnostic-grpc && go mod tidy

然后git clone了原始库,现在我更加困惑了,这到底是如何工作的?

go install github.com/google/gnostic@v0.6.8
go install github.com/googleapis/gnostic-grpc@v0.1.1

似乎在根级别没有main.go包,go install如何知道要安装什么?

此外,如果包中包含未声明的类型的使用,例如/incompatibility中有ApiSetIncompatibility,它在任何地方都没有声明,那不应该报错吗?

这在官方说明中,并且报错了,似乎他们在某个地方犯了一个错误:

go install github.com/google/gnostic@v0.6.8
go install github.com/google/gnostic-grpc@v0.1.1

我已经查看了这些问题(以及其他问题和Reddit帖子等),它们似乎是不同的:

英文:

Run:

go install github.com/google/gnostic@v0.6.8
go install github.com/googleapis/gnostic-grpc@v0.1.1

and the tool works:

gnostic --grpc-out=./target ./source.yaml

I've forked the library https://github.com/google/gnostic-grpc and modified it to not do any snake case conversion, and I've renamed the package and all the references to github.com/thlib/gnostic-grpc so that it hopefully becomes installable.

Then I tried to install it with:

go install github.com/thlib/gnostic-grpc@04d3e8500daa070fbe8c6118fe3b62e42d4a9b1f

and also:

go install github.com/google/gnostic@v0.6.8
go install github.com/thlib/gnostic-grpc@v0.1.3

But it throws the error:

go: downloading github.com/thlib/gnostic-grpc v0.1.3
go: github.com/thlib/gnostic-grpc@v0.1.3: module github.com/thlib/gnostic-grpc@v0.1.3 found, but does not contain package github.com/thlib/gnostic-grpc

I don't understand what I'm doing wrong.

  1. package was renamed
  2. ran go mod init github.com/thlib/gnostic-grpc && go mod tidy

Then git cloned the original and now I'm even more confused, how does this work at all?

go install github.com/google/gnostic@v0.6.8
go install github.com/googleapis/gnostic-grpc@v0.1.1

There doesn't seem to be a main.go package at the root level, how does go install know what to install?

Furthermore how does it install it at all if the package contains usage of undeclared types, e.g. /incompatibility has ApiSetIncompatibility which isn't declared anywhere, shouldn't that error?

This is in the official instructions and it errors, seems they made a mistake at some point as well:

go install github.com/google/gnostic@v0.6.8
go install github.com/google/gnostic-grpc@v0.1.1

I've already looked at these issues (among others and reddit posts, etc), which seem to be different:

答案1

得分: 1

克隆的代码与发布的代码不同,v0.1.1版本的发布代码还包含从protobuf文件生成的代码。

由于编译失败,它没有包含包(Go错误应该得到改进)。

解决方案是下载google/gnostic-grpcv0.1.1发布代码,替换需要替换的内容,将包重命名为新的存储库(并更新所有引用),然后发布一个新版本。

英文:

The cloned code is not the same code as the released one, the released code for v0.1.1 also contains code that was generated from protobuf files.

It did not contain the package because the compilation was failing (The go error should definitely be improved).

The solution was to download the v0.1.1 release code for google/gnostic-grpc, replace what needs replacing, rename the package to the new repo (and update all of the references) and publish a new version.

答案2

得分: 0

此外,如果包含未声明类型的使用,例如/incompatibility中的ApiSetIncompatibility,它是如何安装的?它不应该报错吗?

ApiSetIncompatibility将在.proto编译后的生成文件中声明。您可以在incompatibility/incompatibility-report.proto文件的第88行找到它。因此,要解决此问题,您需要首先使用protoc生成.pb文件。

英文:

> Furthermore how does it install it at all if the package contains usage of undeclared types, e.g. /incompatibility has ApiSetIncompatibility which isn't declared anywhere, shouldn't that error?

ApiSetIncompatibility will be declared in .pb generated file after proto compile. You can find it in incompatibility/incompatibility-report.proto file on 88 line. So to resolve it you need to generate .pb files with protoc first.

huangapple
  • 本文由 发表于 2023年3月23日 17:01:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75820968.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定