英文:
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.
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论