简体   繁体   English

Windows 上的“go run generate_cert.go”问题

[英]Issue with "go run generate_cert.go" on Windows

Trying to translate this Linux/Mac command to windows for go:尝试将此 Linux/Mac 命令转换为 go 的 windows:

$ go run /usr/local/go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost
2018/10/16 11:50:14 wrote cert.pem
2018/10/16 11:50:14 wrote key.pem

By running this command, the files cert.pem and key.pem should be created.通过运行此命令,应创建文件cert.pemkey.pem I tried the following but received the response "no packages loaded".我尝试了以下但收到响应“未加载任何包”。

go run 'C:/Program Files/Go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost'
go run: no packages loaded from C:/Program Files/Go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost

Same thing happens with just --host=localhost同样的事情发生在--host=localhost

A suggestion by Burak Serdar led me to try the following: Burak Serdar 的建议使我尝试以下方法:

Issue was that the arguments were inside the filepath string.问题是 arguments 在文件路径字符串中。

PS C:\Users\Bert\Documents\Coding\Goland\LetsGo\snippetbox> cd tls
PS C:\Users\Bert\Documents\Coding\Goland\LetsGo\snippetbox\tls> go run "C:/Program Files/Go/src/crypto/tls/generate_cert.go" --host=localhost
2022/02/01 08:58:35 wrote cert.pem
2022/02/01 08:58:35 wrote key.pem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM