@@ -28,9 +28,13 @@ var skips = []string{
28
28
// git ls-remote https://github.com/gioui/gio refs/heads/main
29
29
// 但是要传递本地的仓库目录,太麻烦了
30
30
func GetLastCommitHash (repositoryName string ) string {
31
+ //理论上获取到hash再使用模块代理,这样才刷新的快?
32
+ //或者使用action得到hash先?
33
+
31
34
mylog .Check (os .Setenv ("GOPROXY" , "direct" )) // 如果模块代理导致获取到的不是最新的提交哈希那么需要禁用模块代理,最可靠的方式是 GetLastCommitHashLocal
32
- //defer mylog.Check(os.Setenv("GOPROXY", "https://goproxy.cn,direct"))
33
- defer RunCommand ("go env -w GOPROXY=https://goproxy.cn,direct" )
35
+ defer mylog .Check (os .Setenv ("GOPROXY" , "https://goproxy.cn,direct" ))
36
+
37
+ //defer RunCommand("go env -w GOPROXY=https://goproxy.cn,direct")
34
38
s := RunCommand ("git ls-remote " + repositoryName + " refs/heads/master" ).Output .String ()
35
39
for hash := range strings .FieldsSeq (s ) {
36
40
return hash
@@ -52,16 +56,107 @@ func GetLastCommitHash(repositoryName string) string {
52
56
*/
53
57
}
54
58
55
- type Mod struct {
56
- modName string //gioui.org
57
- repositoryName string //https://github.com/gioui/gio
58
- repositoryDir string //GetLastCommitHashLocal
59
- hash string //GetLastCommitHash or GetLastCommitHashLocal
60
- updateCommand string //go get -x gioui.org@hash
59
+ type ModInfo struct {
60
+ ModName string //gioui.org
61
+ RepositoryUrl string //https://github.com/gioui/gio
62
+ repositoryDir string //GetLastCommitHashLocal
63
+ Hash string //GetLastCommitHash or GetLastCommitHashLocal
64
+ UpdateCommand string //go get -x gioui.org@hash
61
65
}
62
66
63
- var m = safemap.NewOrdered [string , string ](func (yield func (string , string ) bool ) {
64
- yield ("https://github.com/gioui/gio" , "" )
67
+ var m = safemap.NewOrdered [string , ModInfo ](func (yield func (string , ModInfo ) bool ) {
68
+ yield ("https://github.com/gioui/gio" , ModInfo {
69
+ ModName : "gioui.org" ,
70
+ RepositoryUrl : "https://github.com/gioui/gio" ,
71
+ repositoryDir : "" ,
72
+ Hash : "" ,
73
+ UpdateCommand : "" ,
74
+ })
75
+ yield ("https://github.com/gioui/gio/cmd" , ModInfo {
76
+ ModName : "gioui.org/cmd" ,
77
+ RepositoryUrl : "https://github.com/gioui/gio/cmd" ,
78
+ repositoryDir : "" ,
79
+ Hash : "" ,
80
+ UpdateCommand : "" ,
81
+ })
82
+ yield ("https://github.com/gioui/gio/example" , ModInfo {
83
+ ModName : "gioui.org/example" ,
84
+ RepositoryUrl : "https://github.com/gioui/gio/example" ,
85
+ repositoryDir : "" ,
86
+ Hash : "" ,
87
+ UpdateCommand : "" ,
88
+ })
89
+ yield ("https://github.com/gioui/gio/x" , ModInfo {
90
+ ModName : "gioui.org/x" ,
91
+ RepositoryUrl : "https://github.com/gioui/gio/x" ,
92
+ repositoryDir : "" ,
93
+ Hash : "" ,
94
+ UpdateCommand : "" ,
95
+ })
96
+ yield ("https://github.com/oligo/gvcode" , ModInfo {
97
+ ModName : "github.com/oligo/gvcode" ,
98
+ RepositoryUrl : "https://github.com/oligo/gvcode" ,
99
+ repositoryDir : "" ,
100
+ Hash : "" ,
101
+ UpdateCommand : "" ,
102
+ })
103
+ yield ("https://github.com/ddkwork/golibrary" , ModInfo {
104
+ ModName : "github.com/ddkwork/golibrary" ,
105
+ RepositoryUrl : "https://github.com/ddkwork/golibrary" ,
106
+ repositoryDir : "" ,
107
+ Hash : "" ,
108
+ UpdateCommand : "" ,
109
+ })
110
+ yield ("https://github.com/ddkwork/ux" , ModInfo {
111
+ ModName : "github.com/ddkwork/ux" ,
112
+ RepositoryUrl : "https://github.com/ddkwork/ux" ,
113
+ repositoryDir : "" ,
114
+ Hash : "" ,
115
+ UpdateCommand : "" ,
116
+ })
117
+ yield ("https://github.com/google/go-cmp" , ModInfo {
118
+ ModName : "github.com/google/go-cmp" ,
119
+ RepositoryUrl : "https://github.com/google/go-cmp" ,
120
+ repositoryDir : "" ,
121
+ Hash : "" ,
122
+ UpdateCommand : "" ,
123
+ })
124
+ yield ("https://github.com/ddkwork/app" , ModInfo {
125
+ ModName : "github.com/ddkwork/app" ,
126
+ RepositoryUrl : "https://github.com/ddkwork/app" ,
127
+ repositoryDir : "" ,
128
+ Hash : "" ,
129
+ UpdateCommand : "" ,
130
+ })
131
+ yield ("https://github.com/ddkwork/toolbox" , ModInfo {
132
+ ModName : "github.com/ddkwork/toolbox" ,
133
+ RepositoryUrl : "https://github.com/ddkwork/toolbox" ,
134
+ repositoryDir : "" ,
135
+ Hash : "" ,
136
+ UpdateCommand : "" ,
137
+ })
138
+ yield ("https://github.com/ddkwork/unison" , ModInfo {
139
+ ModName : "github.com/ddkwork/unison" ,
140
+ RepositoryUrl : "https://github.com/ddkwork/unison" ,
141
+ repositoryDir : "" ,
142
+ Hash : "" ,
143
+ UpdateCommand : "" ,
144
+ })
145
+ yield ("https://github.com/ebitengine/purego" , ModInfo {
146
+ ModName : "github.com/ebitengine/purego" ,
147
+ RepositoryUrl : "https://github.com/ebitengine/purego" ,
148
+ repositoryDir : "" ,
149
+ Hash : "" ,
150
+ UpdateCommand : "" ,
151
+ })
152
+ yield ("https://github.com/saferwall/pe" , ModInfo {
153
+ ModName : "github.com/saferwall/pe" ,
154
+ RepositoryUrl : "https://github.com/saferwall/pe" ,
155
+ repositoryDir : "" ,
156
+ Hash : "" ,
157
+ UpdateCommand : "" ,
158
+ })
159
+
65
160
})
66
161
67
162
func GetLastCommitHashLocal (repositoryName , repositoryDir string ) string {
@@ -137,7 +232,7 @@ func updateModsByWorkSpace(isUpdateAll bool) {
137
232
mylog .Check (os .Chdir (mod ))
138
233
UpdateDependencies ()
139
234
if isUpdateAll {
140
- RunCommand ("go get -v -u all" )
235
+ RunCommand ("go get -u -x all" )
141
236
}
142
237
modChan <- mod
143
238
return nil
0 commit comments