同步操作将从 江二十三/baligo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
When developing a project based on Golang, although go build
can be used to easily complete the build, I still encountered some troubles during packaging and other operations. Therefore, I implemented a cross-platform tool based on PowerShell Core bali, to simplify this process, as early as 2017, bali was born, and now has reached 2020, I also have a new understanding of project construction and packaging , So in order to improve bali written based on PowerShell, bali was rewritten using Golang in this project.
baligo usage:
Bali - Minimalist build and packaging tool
usage: bali <option> args ...
-h|--help Show usage text and quit
-v|--version Show version number and quit
-V|--verbose Make the operation more talkative
-F|--force Turn on force mode. eg: Overwrite configuration file
-c|--cwd Build dir. (Position 0, default cwd)
-a|--arch Build arch: amd64 386 arm arm64
-t|--target Build target: windows linux darwin ...
-o|--out Build output dir. default '$CWD/build'
-z|--zip Create archive file after successful build
-m|--mkstgz After successful build, create STGZ installation package
-d|--dist STGZ/TarGz package distribution directory
Build:
bali /path/to/project
Create Tar.gz
:
bali /path/to/project -z
Create STGZ
installation package, mainly used on Linux/macOS platform:
bali /path/to/project -m
There are two types of Bali project files, including bali.json
in the root directory of the project and balisrc.json
file in the specific program of the project. Examples are as follows:
bali.json
:
{
// Package name
"name": "baligo",
// Package version
"version": "1.0.0",
// Project profiles
"files": [
{
"path": "config/bali.json",
"destination": "config"
}
],
// Sources dir
"dirs": [
"cmd/bali"
]
}
balisrc.json
:
{
// Binary name
"name": "bali",
// destination
"destination": "bin",
// binary version
"version": "1.0.0",
// Goflags, each one will be expanded using environment variables, BUILD_VERSION corresponds to version, BUILD_TIME is the RFC3339 format of local time
// BUILD_GOVERSION is go version to remove the prefix
// git commit information of BUILD_COMMIT project, use None instead for non-go repository.
"goflags": [
"-ldflags",
"-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.GOVERSION=$BUILD_GOVERSION'"
]
}
You can download the pre-built binary directly after the project's Release is decompressed and install it, or you can compile the bootstrap by running the bootstrap file. With Golang configured on Linux / macOS, run:
./script/bootstrap.sh
Run under Windows:
pwsh ./script/bootstrap.ps1
Or it can be run in CMD:
script / bootstrap.bat
Anyway, it's relatively simple.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。