How to install the go package: gencodec?

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

How to install the go package: gencodec?

问题

基本上,问题的标题是关于我使用Go编程语言进行开发的。当我尝试安装特定的包(gencodec)时,我遇到了以下错误:

go install gencodec@latest: malformed module path "gencodec": missing dot in first path element

这是我能找到的唯一文档,但它并没有提供有关如何安装它的教程。

通过go安装包是否类似于使用npm?我来自JavaScript背景,所以我不确定我是否做得正确。

谢谢!

英文:

Basically, the title of the question. I am new to developing with the Go programming language, and I am getting this error when trying to install this specific package: gencodec

go install gencodec@latest: malformed module path "gencodec": missing dot in first path element

This is pretty much the only documentation I could find on it, and it doesn't provide a tutorial on how to install it.

Click here for the docs

Is installing packages via go similar to using npm? I come from a javascript background so I am not entirely sure if I am even doing it correctly.

Thanks!

答案1

得分: 1

我理解你想创建一个类型结构。

根据你提供的文档,你需要构建 gencode 二进制文件。你可以下载 gencode 仓库的内容,将其放入 go build 文件夹中,然后你将得到一个名为 gencode 的二进制文件。之后,运行 gencodec -type MyType -formats json, yaml, toml -out mytype_json.go

英文:

I understand you want to create a type structure.
I read in the documentation you provided, you will need to build the gencode binary. gencode repository

Try downloading the gencode repository content, into the execute go build folder, then you will have a binary gencode ... after that run gencodec -type MyType -formats json, yaml, toml -out mytype_json.go

huangapple
  • 本文由 发表于 2021年6月17日 09:16:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/68011711.html
匿名

发表评论

匿名网友

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

确定