英文:
How to run this Go application locally?
问题
我想要能够在我的机器上从存储库https://github.com/jbowens/codenames中运行应用程序。这可能吗?
我尝试过的步骤:
- 安装了Go,并添加了PATH变量。
- 将存储库克隆到了正确的Go路径位置。
- 打开命令提示符,并从"cmd"文件夹中运行了命令"go run main.go"。
我对Go一无所知,也许我只需要运行另一个命令或安装依赖项之类的。如果有人能够弄清楚这个问题,我会非常高兴!这是一个很棒的游戏,我想在我的机器上玩。
英文:
I want to be able to run the application from the repository https://github.com/jbowens/codenames locally on my machine. Is it possible?
Steps I've tried:
- Installed Go. Added PATH variable.
- Cloned the repository to my machine in the right go path location.
- Opened command prompt and ran the command "go run main.go" from the "cmd" folder
I really don't know anything about Go so maybe I just have to run another command or install dependencies or whatever. If someone could figure this out I would be super happy! This is an awesome game I would like to play from my machine.
答案1
得分: 1
我猜你只是在cmd/codenames
目录下输入go build
,在该目录下创建一个名为'codenames'的二进制文件,并从那里运行。
不幸的是,该应用程序是硬编码的,它会在与二进制文件相对的./assets/
目录中查找其资源。
所以你希望将二进制文件放在应用程序的根目录中:
即
- 从
cmd/codenames
目录执行go build -o ../../run-me-from-here
- 然后从应用程序的根目录执行
./run-me-from-here
。
。
英文:
I'm guessing you are just typing go build
from the cmd/codenames
directory, creating a binary called 'codenames' in that directory and running from there.
Unfortunately the app is hard-coded to look for its assets in a ./assets/ directory relative to the binary.
So you want your binary in the root of the app:
i.e
- from the
cmd/codenames
directorygo build -o ../../run-me-from-here
- then from the root of the app
./run-me-from-here
.
答案2
得分: 0
在Go语言中,本地运行它们非常简单。
我通常在我的本地Go目录中运行go get命令。
运行以下命令获取https://github.com/jbowens/codenames:
go get https://github.com/jbowens/codenames
英文:
Running them locally is very easy in go
I usually run go get while in my local go directory.
答案3
得分: -4
设置gopath和goroot,然后安装依赖项。
英文:
Set gopath and goroot then install dependencies.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论