Skip to content

Commit b4ebda8

Browse files
committed
fix: 修复GoReleaser构建问题
- 修改.goreleaser.yml确保在项目根目录执行go mod tidy - 将data目录下的Go源码文件重命名为.go.txt避免被解析为源码 - 添加.gitattributes配置将data目录标记为文档 - 更新GitHub Actions工作流添加数据文件预处理步骤
1 parent 12c74b5 commit b4ebda8

21 files changed

+13
-2
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 将data目录标记为文档/数据文件,而非源代码
2+
data/**/*.go.txt linguist-documentation=true
3+
data/**/*.go.txt linguist-vendored=true
4+
data/**/* linguist-detectable=false

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ jobs:
3030
with:
3131
go-version: '1.18'
3232

33+
- name: 预处理数据文件
34+
run: |
35+
# 确保任何.go文件都重命名为.go.txt
36+
find data -name "*.go" -type f -exec sh -c 'mv "$1" "${1%.go}.go.txt"' _ {} \; || true
37+
# 创建空的go.mod在数据目录中避免递归查找模块
38+
touch data/go.mod
39+
3340
- name: 运行测试
3441
run: go test -v ./pkg/cracker/...
3542

.goreleaser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project_name: jg-cursor-cracker
33

44
before:
55
hooks:
6-
# 清理构建目录
7-
- go mod tidy
6+
# 确保在项目根目录执行go mod tidy,忽略data目录中的go文件
7+
- cd $(pwd) && go mod tidy
88

99
builds:
1010
- id: jg-cursor-cracker
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)