Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
783b3c2e
提交
783b3c2e
authored
10月 16, 2025
作者:
mooncake
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fmt
上级
7975d392
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
192 行增加
和
1 行删除
+192
-1
Makefile
Makefile
+191
-0
svc.go
rpc/svc.go
+1
-1
没有找到文件。
Makefile
0 → 100644
浏览文件 @
783b3c2e
SHELL
:=
/bin/bash
PROJECT_NAME
:=
"xpkg"
PKG
:=
"
$(PROJECT_NAME)
"
PKG_LIST
:=
$(
shell
go list
${
PKG
}
/... |
grep
-v
/vendor/ |
grep
-v
/api/ |
grep
-v
/cmd/
)
.PHONY
:
fmt
fmt
:
go mod tidy
gofmt
-s
-w
.
.PHONY
:
ci-lint
# Check the code specification against the rules in the .golangci.yml file
ci-lint
:
@
gofmt
-s
-w
.
golangci-lint run ./...
.PHONY
:
cover
# Generate test coverage
cover
:
go
test
-short
-coverprofile
=
cover.out
-covermode
=
atomic
${
PKG_LIST
}
go tool cover
-html
=
cover.out
.PHONY
:
graph
# Generate interactive visual function dependency graphs
graph
:
@
echo
"generating graph ......"
@
cp
-f
cmd/operator/main.go .
go-callvis
-skipbrowser
-format
=
svg
-nostd
-file
=
operator operator
@
rm
-f
main.go operator.gv
.PHONY
:
docs
# Generate swagger docs, only for ⓵ Web services created based on sql
docs
:
@
bash scripts/swag-docs.sh
$(HOST)
.PHONY
:
build
# Build operator for linux amd64 binary
build
:
docs
@
echo
"building 'operator', linux binary file will be put into binary/ "
@
#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags="-m -l" -tags=jsoniter -o binary/operator main.go
@
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-gcflags
=
"-m -l"
-tags
=
jsoniter
-o
binary/operator main.go
@
du
-sh
binary/
*
@
md5 binary/operator
.PHONY
:
build-docker
build-docker
:
docs
@
echo
"building 'operator', linux binary file will be put into binary/ "
@
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-gcflags
=
"-m -l"
-o
binary/operator main.go
@
du
-sh
binary/
*
@
md5 binary/operator
@
cp
binary/operator app/operator/operator
@
cp
-rf
assets app/operator/assets
@
cp
-rf
configs/operator.yml app/operator/conf/operator.yml
@
cd
app/operator
&&
docker build
-t
tush/operator:latest .
.PHONY
:
build-mac
# Build operator for linux amd64 binary
build-mac
:
@
echo
"building 'operator', mac binary file will be put into binary/ "
@
CGO_ENABLED
=
0 go build
-tags
=
jsoniter
-ldflags
=
"-s -w"
-o
binary/operator-mac main.go
@
md5 binary/operator-mac
.PHONY
:
run
run
:
docs build-mac
@
cp
binary/operator-mac app/operator/operator
@
bash scripts/run.sh
.PHONY
:
test
test
:
# @go test -v internal/modules/operator/controller/app_module_test.go | tee tmp/unitTest/operator.test.log
# @go test -v internal/modules/operator/controller/agent_test.go | tee tmp/unitTest/operator.test.log
# @go test -v internal/modules/operator/controller/user_test.go | tee tmp/unitTest/operator.test.log
# @go test -v internal/modules/operator/controller/site_test.go | tee tmp/unitTest/operator.test.log
# @go test -v internal/modules/operator/controller/intake_test.go | tee tmp/unitTest/operator.test.log
@go
test
-v
internal/modules/operator/controller/income_test.go
|
tee
tmp/unitTest/operator.test.log
.PHONY
:
dk
dk
:
@
echo
"building '
$(PROJECT_NAME)
', linux binary file will be put into binary/ "
@
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-gcflags
=
"-m -l"
-o
binary/
$(PROJECT_NAME)
main.go
@
du
-sh
binary/
*
@
md5 binary/
*
@
cp
binary/
$(PROJECT_NAME)
app/
$(PROJECT_NAME)
@
cd
app/
$(PROJECT_NAME)
&&
docker build
-t
tush/
$(PROJECT_NAME)
:latest .
@
cd
app/k8s
&&
kubectl delete
-f
$(PROJECT_NAME)
.yaml
&&
kubectl apply
-f
$(PROJECT_NAME)
.yaml
@
cd
app/k8s
&&
kubectl delete
-f
$(PROJECT_NAME)
.svc.yaml
&&
kubectl apply
-f
$(PROJECT_NAME)
.svc.yaml
@
docker image prune
-f
.PHONY
:
stop
stop
:
@
bash scripts/stop.sh
.PHONY
:
run-nohup
# Run service with nohup in local, if you want to stop the server, pass the parameter stop, e.g. make run-nohup CMD=stop
run-nohup
:
@
bash scripts/run-nohup.sh
$(CMD)
.PHONY
:
run-docker
# Deploy service in local docker, if you want to update the service, run the make run-docker command again
run-docker
:
image-build-local
@
bash scripts/deploy-docker.sh
.PHONY
:
binary-package
# Packaged binary files
binary-package
:
build
@
bash scripts/binary-package.sh
.PHONY
:
deploy-binary
# Deploy binary to remote linux server, e.g. make deploy-binary USER=root PWD=123456 IP=192.168.1.10
deploy-binary
:
binary-package
@
expect scripts/deploy-binary.sh
$(USER)
$(PWD)
$(IP)
.PHONY
:
image-build-local
# Build image for local docker, tag=latest, use binary files to build
image-build-local
:
build
@
bash scripts/image-build-local.sh
.PHONY
:
image-build
# Build image for remote repositories, use binary files to build, e.g. make image-build REPO_HOST=addr TAG=latest
image-build
:
@
bash scripts/image-build.sh
$(REPO_HOST)
$(TAG)
.PHONY
:
image-build2
# Build image for remote repositories, phase II build, e.g. make image-build2 REPO_HOST=addr TAG=latest
image-build2
:
@
bash scripts/image-build2.sh
$(REPO_HOST)
$(TAG)
.PHONY
:
image-push
# Push docker image to remote repositories, e.g. make image-push REPO_HOST=addr TAG=latest
image-push
:
@
bash scripts/image-push.sh
$(REPO_HOST)
$(TAG)
.PHONY
:
deploy-k8s
# Deploy service to k8s
deploy-k8s
:
@
bash scripts/deploy-k8s.sh
.PHONY
:
update-config
# Update internal/config code base on yaml file
update-config
:
@
operator config
--server-dir
=
.
.PHONY
:
clean
# Clean binary file, cover.out, template file
clean
:
@
rm
-vrf
cmd/operator/operator
*
@
rm
-vrf
cover.out
@
rm
-vrf
main.go operator.gv
@
rm
-vrf
internal/ecode/
*
.go.gen
*
@
rm
-vrf
internal/routers/
*
.go.gen
*
@
rm
-vrf
internal/handler/
*
.go.gen
*
@
rm
-vrf
internal/service/
*
.go.gen
*
@
rm
-rf
operator-binary.tar.gz
@
echo
"clean finished"
# Show help
help
:
@
echo
''
@
echo
'Usage:'
@
echo
' make <target>'
@
echo
''
@
echo
'Targets:'
@
awk
'/^[a-zA-Z\-_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
printf "\033[1;36m %-22s\033[0m %s\n", helpCommand,helpMessage; \
} \
} \
{ lastLine = $$0 }'
$(MAKEFILE_LIST)
.DEFAULT_GOAL
:=
all
rpc/svc.go
浏览文件 @
783b3c2e
...
@@ -38,7 +38,7 @@ type Rpc []Svc
...
@@ -38,7 +38,7 @@ type Rpc []Svc
type
Svc
struct
{
type
Svc
struct
{
Name
string
`yaml:"name" json:"name" mapstructure:"name"`
Name
string
`yaml:"name" json:"name" mapstructure:"name"`
SrvAddr
string
`yaml:"srvAddr" json:"srvAddr" mapstructure:"srvA
ddr"`
Addr
string
`yaml:"addr" json:"addr" mapstructure:"a
ddr"`
Groups
[]
*
Group
`yaml:"groups" json:"groups" mapstructure:"groups"`
Groups
[]
*
Group
`yaml:"groups" json:"groups" mapstructure:"groups"`
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论