一个快速、可移植的 Go 命令行实用程序,通过 HTTP 提供文件目录。可用于本地 Web 开发、生产静态站点服务或作为网络文件主机。默认情况下, go-live
提供其执行的目录。
基于 JavaScript 著名的live-server
实用程序。支持 Linux、Windows 和 Mac,以及 ARM。如果有兴趣提供帮助,请参阅 TODO 列表。
使用方法:在您想要服务的目录中,在终端中运行go-live
。
brew tap antsankov/go-live && brew install go-live
opt/homebrew
。 Brew 默认情况下不会执行此操作,最简单的方法是通过homebrew
github 发布页面中的 .pkg 安装 homebrew。 brew tap antsankov/go-live && arch -arm64 brew install go-live
curl -LJO https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-mac-x64.zip && unzip go-live-mac-x64.zip && mv go-live /usr/local/bin/go-live && chmod +x /usr/local/bin/go-live && go-live
curl -LJO https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-mac-arm64.zip && unzip go-live-mac-arm64.zip && mv go-live /usr/local/bin/go-live && chmod +x /usr/local/bin/go-live && go-live
snap install go-live
sudo wget https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-linux-x32 -O /usr/bin/go-live && sudo chmod +x /usr/bin/go-live
sudo wget https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-linux-x64 -O /usr/bin/go-live && sudo chmod +x /usr/bin/go-live
sudo wget https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-linux-arm32 -O /usr/bin/go-live && sudo chmod +x /usr/bin/go-live
sudo wget https://github.com/antsankov/go-live/releases/download/v1.2.1/go-live-linux-arm64 -O /usr/bin/go-live && sudo chmod +x /usr/bin/go-live
docker pull antsankov/go-live
运行(将在端口 9000 上提供当前目录):
docker run --rm -v "${PWD}":/workdir -p 9000:9000 antsankov/go-live go-live
在这里下载并执行
GO111MODULE=on go get github.com/antsankov/go-live
git clone https://github.com/antsankov/go-live.git && cd go-live
make build && ./bin/go-live
git clone https://github.com/antsankov/go-live.git && cd go-live
make cross-compile && ls release/
gon gon.json
security find-identity -p codesigning
。如果无效,请参阅https://developer.apple.com/forums/thread/86161 - 您需要检查开发者证书的信息以查看是否安装了“组织单位”证书。sudo docker build -t antsankov/go-live:v1.2.1 .
和sudo docker push antsankov/go-live:v1.2.1
-h Print help message for go-live
--help
-c Allow browser caching of pages. Can lead to stale results, off by default.
--cache
-d string
Select the directory you want to serve. Serves all subpaths that user has read permissions for. (default "./")
--dir string
(default "./")
-p string
Set port to serve on. (default "9000")
--port string
(default "9000")
-q Quiet stops go-live from opening the browser when started.
--quiet
-s Start in server mode on port 80 and in quiet.
--serve
-v Print the version of go-live.
--version
注意: index.html
会自动显示在目录的根目录下。
示例:通过端口 80 提供静态站点
sudo go-live --dir ~/example.com/ --serve