Skip to content

Commit 8825514

Browse files
committed
fix: make lint&ci happy
1 parent d2e6c97 commit 8825514

File tree

9 files changed

+54
-9
lines changed

9 files changed

+54
-9
lines changed

.github/workflows/nightly.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
GOARCH: ${{ matrix.goarch }}
4646
IS_PR: ${{ !!github.head_ref }}
4747
run: |
48-
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
4948
go generate ./...
5049
if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi
5150
if $IS_PR ; then echo $PR_PROMPT; fi

.github/workflows/pull.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
- name: Tidy Modules
3737
run: |
3838
go mod tidy
39-
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
4039
go generate ./...
4140
4241
- name: golangci-lint

.github/workflows/push.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
- name: Tidy Modules
1717
run: |
1818
go mod tidy
19-
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
2019
go generate ./...
2120
2221
- name: Run Lint

.goreleaser.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ env:
44
before:
55
hooks:
66
- go mod tidy
7-
- if [ ! -f custom/register.go ]; then touch custom/register.go; fi
87
- go generate ./...
98
- go install github.com/tc-hib/go-winres@latest
109
- go-winres make

abineundo/ref/main.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"io"
6+
"os"
7+
"path"
8+
)
9+
10+
func main() {
11+
root := flag.String("r", "", "project root dir")
12+
flag.Parse()
13+
14+
fi, err := os.Open(path.Join(*root, "main.go"))
15+
if err != nil {
16+
panic(err)
17+
}
18+
fo, err := os.Create(path.Join(*root, "abineundo/ref/main/main.go"))
19+
if err != nil {
20+
panic(err)
21+
}
22+
_, err = io.Copy(fo, fi)
23+
if err != nil {
24+
panic(err)
25+
}
26+
fi.Close()
27+
fo.Close()
28+
29+
regf := path.Join(*root, "custom/register.go")
30+
if _, err := os.Stat(regf); err != nil {
31+
if os.IsNotExist(err) {
32+
return
33+
}
34+
panic(err)
35+
}
36+
37+
fi, err = os.Open(regf)
38+
if err != nil {
39+
panic(err)
40+
}
41+
fo, err = os.Create(path.Join(*root, "abineundo/ref/custom/register.go"))
42+
if err != nil {
43+
panic(err)
44+
}
45+
_, err = io.Copy(fo, fi)
46+
if err != nil {
47+
panic(err)
48+
}
49+
fi.Close()
50+
fo.Close()
51+
}

custom/doc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
// Package custom 注册用户自定义插件于此
22
package custom
3-
4-
//go:generate cp register.go ../abineundo/ref/custom

kanban/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
1111
)
1212

13-
//go:generate go run github.com/FloatTech/ZeroBot-Plugin/kanban/gen
13+
//go:generate env GOOS= GOARCH= go run github.com/FloatTech/ZeroBot-Plugin/kanban/gen
1414

1515
func init() {
1616
PrintBanner()

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Package main ZeroBot-Plugin main file
22
package main
33

4-
//go:generate cp main.go abineundo/ref/main
4+
//go:generate env GOOS= GOARCH= go run github.com/FloatTech/ZeroBot-Plugin/abineundo/ref -r .
55

66
import (
77
"encoding/json"

winres/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Package winres 生成windows资源
22
package winres
33

4-
//go:generate go run github.com/FloatTech/ZeroBot-Plugin/winres/gen
4+
//go:generate env GOOS= GOARCH= go run github.com/FloatTech/ZeroBot-Plugin/winres/gen

0 commit comments

Comments
 (0)