Skip to content

Commit 1e42163

Browse files
authored
Merge pull request #135 from xushiwei/q
rename GopXXX => XGoXXX
2 parents bdd5270 + 7db943e commit 1e42163

File tree

8 files changed

+370
-370
lines changed

8 files changed

+370
-370
lines changed

gsh/classfile.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
const (
29-
GopPackage = true
29+
XGoPackage = true
3030
)
3131

3232
// App is project class of this classfile.
@@ -50,8 +50,8 @@ func (p *App) initApp() {
5050
p.ferr = os.Stderr
5151
}
5252

53-
// Gop_Env retrieves the value of the environment variable named by the key.
54-
func (p *App) Gop_Env(key string) string {
53+
// XGo_Env retrieves the value of the environment variable named by the key.
54+
func (p *App) XGo_Env(key string) string {
5555
return Sys.Getenv(key)
5656
}
5757

@@ -65,8 +65,8 @@ func (p *App) execWith(env []string, name string, args ...string) error {
6565
return p.err
6666
}
6767

68-
// Gop_Exec executes a shell command.
69-
func (p *App) Gop_Exec(name string, args ...string) error {
68+
// XGo_Exec executes a shell command.
69+
func (p *App) XGo_Exec(name string, args ...string) error {
7070
return p.execWith(nil, name, args...)
7171
}
7272

@@ -164,8 +164,8 @@ func (p *App) Output() string {
164164
return p.cout
165165
}
166166

167-
// Gopt_App_Main is main entry of this classfile.
168-
func Gopt_App_Main(a interface{ initApp() }) {
167+
// XGot_App_Main is main entry of this classfile.
168+
func XGot_App_Main(a interface{ initApp() }) {
169169
a.initApp()
170170
a.(interface{ MainEntry() }).MainEntry()
171171
}

gsh/gsh_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func capout(app *App, doSth func()) (ret string, err error) {
6666

6767
func lasterr(app *App, err error) {
6868
mockRunErr = err
69-
app.Gop_Exec("ls")
69+
app.XGo_Exec("ls")
7070
mockRunErr = nil
7171
}
7272

@@ -81,14 +81,14 @@ type myApp struct {
8181

8282
func (p *myApp) MainEntry() {
8383
t := p.t
84-
err := p.Gop_Exec("ls", "-l")
84+
err := p.XGo_Exec("ls", "-l")
8585
check(t, err)
8686
err = p.Exec__2("ls", "-l")
8787
check(t, err)
8888
}
8989

9090
func TestMainEntry(t *testing.T) {
91-
Gopt_App_Main(&myApp{t: t})
91+
XGot_App_Main(&myApp{t: t})
9292
}
9393

9494
func TestOS(t *testing.T) {
@@ -111,8 +111,8 @@ func TestEnv(t *testing.T) {
111111
func TestExecWithEnv(t *testing.T) {
112112
var app App
113113
app.initApp()
114-
if v := app.Gop_Env("BAR"); v != "bar" {
115-
t.Fatal("app.Gop_Env:", v)
114+
if v := app.XGo_Env("BAR"); v != "bar" {
115+
t.Fatal("app.XGo_Env:", v)
116116
}
117117
capout(&app, func() {
118118
err := app.Exec__0(M{"FOO": "123"}, "./app", "$FOO")

osx/osx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type LineReader struct {
9696
r io.Reader
9797
}
9898

99-
func (p LineReader) Gop_Enum() LineIter {
99+
func (p LineReader) XGo_Enum() LineIter {
100100
return EnumLines(p.r)
101101
}
102102

@@ -112,7 +112,7 @@ type BLineReader struct {
112112
r io.Reader
113113
}
114114

115-
func (p BLineReader) Gop_Enum() BLineIter {
115+
func (p BLineReader) XGo_Enum() BLineIter {
116116
return EnumBLines(p.r)
117117
}
118118

test/match.go

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
const (
28-
GopPackage = true
28+
XGoPackage = true
2929
)
3030

3131
type basetype interface {
@@ -117,27 +117,27 @@ func nameCtx(name []string) string {
117117
}
118118

119119
const (
120-
Gopo_Gopt_Case_Match = "Gopt_Case_MatchTBase,Gopt_Case_MatchMap,Gopt_Case_MatchSlice,Gopt_Case_MatchBaseSlice,Gopt_Case_MatchSet,Gopt_Case_MatchAnySet,Gopt_Case_MatchAny"
120+
XGoo_XGot_Case_Match = "XGot_Case_MatchTBase,XGot_Case_MatchMap,XGot_Case_MatchSlice,XGot_Case_MatchBaseSlice,XGot_Case_MatchSet,XGot_Case_MatchAnySet,XGot_Case_MatchAny"
121121
)
122122

123-
func Gopt_Case_MatchTBase[T basetype](t CaseT, expected, got T, name ...string) {
123+
func XGot_Case_MatchTBase[T basetype](t CaseT, expected, got T, name ...string) {
124124
if expected != got {
125125
t.Helper()
126126
t.Fatalf("unmatched value%s - expected: %v, got: %v\n", nameCtx(name), expected, got)
127127
}
128128
}
129129

130-
func Gopt_Case_MatchMap(t CaseT, expected, got map[string]any, name ...string) {
130+
func XGot_Case_MatchMap(t CaseT, expected, got map[string]any, name ...string) {
131131
t.Helper()
132132
idx := len(name)
133133
name = append(name, "")
134134
for key, ev := range expected {
135135
name[idx] = key
136-
Gopt_Case_MatchAny(t, ev, got[key], name...)
136+
XGot_Case_MatchAny(t, ev, got[key], name...)
137137
}
138138
}
139139

140-
func Gopt_Case_MatchSlice[T any](t CaseT, expected []T, got []any, name ...string) {
140+
func XGot_Case_MatchSlice[T any](t CaseT, expected []T, got []any, name ...string) {
141141
t.Helper()
142142
if len(expected) != len(got) {
143143
t.Fatalf("unmatched slice%s length - expected: %d, got: %d\n", nameCtx(name), len(expected), len(got))
@@ -148,11 +148,11 @@ func Gopt_Case_MatchSlice[T any](t CaseT, expected []T, got []any, name ...strin
148148
}
149149
for i, ev := range expected {
150150
name[idx] = "[" + strconv.Itoa(i) + "]"
151-
Gopt_Case_MatchAny(t, ev, got[i], name...)
151+
XGot_Case_MatchAny(t, ev, got[i], name...)
152152
}
153153
}
154154

155-
func Gopt_Case_MatchBaseSlice[T baseelem](t CaseT, expected, got []T, name ...string) {
155+
func XGot_Case_MatchBaseSlice[T baseelem](t CaseT, expected, got []T, name ...string) {
156156
t.Helper()
157157
if len(expected) != len(got) {
158158
t.Fatalf("unmatched slice%s length - expected: %d, got: %d\n", nameCtx(name), len(expected), len(got))
@@ -163,11 +163,11 @@ func Gopt_Case_MatchBaseSlice[T baseelem](t CaseT, expected, got []T, name ...st
163163
}
164164
for i, ev := range expected {
165165
name[idx] = "[" + strconv.Itoa(i) + "]"
166-
Gopt_Case_MatchTBase(t, ev, got[i], name...)
166+
XGot_Case_MatchTBase(t, ev, got[i], name...)
167167
}
168168
}
169169

170-
func Gopt_Case_MatchSet[T baseelem](t CaseT, expected TySet[T], got []T, name ...string) {
170+
func XGot_Case_MatchSet[T baseelem](t CaseT, expected TySet[T], got []T, name ...string) {
171171
if len(expected) != len(got) {
172172
t.Fatalf("unmatched set%s length - expected: %d, got: %d\n", nameCtx(name), len(expected), len(got))
173173
}
@@ -178,7 +178,7 @@ func Gopt_Case_MatchSet[T baseelem](t CaseT, expected TySet[T], got []T, name ..
178178
}
179179
}
180180

181-
func Gopt_Case_MatchAnySet(t CaseT, expected TyAnySet, got any, name ...string) {
181+
func XGot_Case_MatchAnySet(t CaseT, expected TyAnySet, got any, name ...string) {
182182
if gv, ok := got.([]any); ok {
183183
matchAnySet(t, expected, gv)
184184
return
@@ -224,97 +224,97 @@ func hasAnyElem(v any, expected []any) bool {
224224
return false
225225
}
226226

227-
func Gopt_Case_MatchAny(t CaseT, expected, got any, name ...string) {
227+
func XGot_Case_MatchAny(t CaseT, expected, got any, name ...string) {
228228
t.Helper()
229229
retry:
230230
switch ev := expected.(type) {
231231
case string:
232232
switch gv := got.(type) {
233233
case string:
234-
Gopt_Case_MatchTBase(t, ev, gv, name...)
234+
XGot_Case_MatchTBase(t, ev, gv, name...)
235235
return
236236
case *Var__0[string]:
237-
Gopt_Case_MatchTBase(t, ev, gv.Val(), name...)
237+
XGot_Case_MatchTBase(t, ev, gv.Val(), name...)
238238
return
239239
}
240240
case int:
241241
switch gv := got.(type) {
242242
case int:
243-
Gopt_Case_MatchTBase(t, ev, gv, name...)
243+
XGot_Case_MatchTBase(t, ev, gv, name...)
244244
return
245245
case *Var__0[int]:
246-
Gopt_Case_MatchTBase(t, ev, gv.Val(), name...)
246+
XGot_Case_MatchTBase(t, ev, gv.Val(), name...)
247247
return
248248
}
249249
case bool:
250250
switch gv := got.(type) {
251251
case bool:
252-
Gopt_Case_MatchTBase(t, ev, gv, name...)
252+
XGot_Case_MatchTBase(t, ev, gv, name...)
253253
return
254254
case *Var__0[bool]:
255-
Gopt_Case_MatchTBase(t, ev, gv.Val(), name...)
255+
XGot_Case_MatchTBase(t, ev, gv.Val(), name...)
256256
return
257257
}
258258
case float64:
259259
switch gv := got.(type) {
260260
case float64:
261-
Gopt_Case_MatchTBase(t, ev, gv, name...)
261+
XGot_Case_MatchTBase(t, ev, gv, name...)
262262
return
263263
case *Var__0[float64]:
264-
Gopt_Case_MatchTBase(t, ev, gv.Val(), name...)
264+
XGot_Case_MatchTBase(t, ev, gv.Val(), name...)
265265
return
266266
}
267267
case map[string]any:
268268
switch gv := got.(type) {
269269
case map[string]any:
270-
Gopt_Case_MatchMap(t, ev, gv, name...)
270+
XGot_Case_MatchMap(t, ev, gv, name...)
271271
return
272272
case *Var__1[map[string]any]:
273-
Gopt_Case_MatchMap(t, ev, gv.Val(), name...)
273+
XGot_Case_MatchMap(t, ev, gv.Val(), name...)
274274
return
275275
default:
276276
if gv, ok := tryToMapAny(got); ok {
277-
Gopt_Case_MatchMap(t, ev, gv, name...)
277+
XGot_Case_MatchMap(t, ev, gv, name...)
278278
return
279279
}
280280
}
281281
case []any:
282282
switch gv := got.(type) {
283283
case []any:
284-
Gopt_Case_MatchSlice(t, ev, gv, name...)
284+
XGot_Case_MatchSlice(t, ev, gv, name...)
285285
return
286286
case *Var__2[[]any]:
287-
Gopt_Case_MatchSlice(t, ev, gv.Val(), name...)
287+
XGot_Case_MatchSlice(t, ev, gv.Val(), name...)
288288
return
289289
}
290290
case []string:
291291
switch gv := got.(type) {
292292
case []string:
293-
Gopt_Case_MatchBaseSlice(t, ev, gv, name...)
293+
XGot_Case_MatchBaseSlice(t, ev, gv, name...)
294294
return
295295
case *Var__3[[]string]:
296-
Gopt_Case_MatchBaseSlice(t, ev, gv.Val(), name...)
296+
XGot_Case_MatchBaseSlice(t, ev, gv.Val(), name...)
297297
return
298298
case []any:
299-
Gopt_Case_MatchSlice(t, ev, gv, name...)
299+
XGot_Case_MatchSlice(t, ev, gv, name...)
300300
return
301301
}
302302
case TySet[string]:
303303
switch gv := got.(type) {
304304
case []string:
305-
Gopt_Case_MatchSet(t, ev, gv, name...)
305+
XGot_Case_MatchSet(t, ev, gv, name...)
306306
return
307307
case *Var__3[[]string]:
308-
Gopt_Case_MatchSet(t, ev, gv.Val(), name...)
308+
XGot_Case_MatchSet(t, ev, gv.Val(), name...)
309309
return
310310
}
311311
case TyAnySet:
312312
switch gv := got.(type) {
313313
case *Var__2[[]any]:
314-
Gopt_Case_MatchAnySet(t, ev, gv.Val(), name...)
314+
XGot_Case_MatchAnySet(t, ev, gv.Val(), name...)
315315
return
316316
default:
317-
Gopt_Case_MatchAnySet(t, ev, gv, name...)
317+
XGot_Case_MatchAnySet(t, ev, gv, name...)
318318
return
319319
}
320320
case *Var__0[string]:
@@ -478,7 +478,7 @@ func (p *Var__0[T]) Match(t CaseT, v T, name ...string) {
478478
return
479479
}
480480
t.Helper()
481-
Gopt_Case_MatchTBase(t, p.val, v, name...)
481+
XGot_Case_MatchTBase(t, p.val, v, name...)
482482
}
483483

484484
func (p *Var__0[T]) MatchNil(t CaseT, name ...string) {
@@ -524,7 +524,7 @@ func (p *Var__1[T]) Match(t CaseT, v T, name ...string) {
524524
return
525525
}
526526
t.Helper()
527-
Gopt_Case_MatchMap(t, p.val, v, name...)
527+
XGot_Case_MatchMap(t, p.val, v, name...)
528528
}
529529

530530
// -----------------------------------------------------------------------------
@@ -565,7 +565,7 @@ func (p *Var__2[T]) Match(t CaseT, v T, name ...string) {
565565
return
566566
}
567567
t.Helper()
568-
Gopt_Case_MatchSlice(t, p.val, v, name...)
568+
XGot_Case_MatchSlice(t, p.val, v, name...)
569569
}
570570

571571
// -----------------------------------------------------------------------------
@@ -606,24 +606,24 @@ func (p *Var__3[T]) Match(t CaseT, v T, name ...string) {
606606
return
607607
}
608608
t.Helper()
609-
Gopt_Case_MatchBaseSlice(t, p.val, v, name...)
609+
XGot_Case_MatchBaseSlice(t, p.val, v, name...)
610610
}
611611

612612
// -----------------------------------------------------------------------------
613613

614-
func Gopx_Var_Cast__0[T basetype]() *Var__0[T] {
614+
func XGox_Var_Cast__0[T basetype]() *Var__0[T] {
615615
return new(Var__0[T])
616616
}
617617

618-
func Gopx_Var_Cast__1[T map[string]any]() *Var__1[T] {
618+
func XGox_Var_Cast__1[T map[string]any]() *Var__1[T] {
619619
return new(Var__1[T])
620620
}
621621

622-
func Gopx_Var_Cast__2[T []any]() *Var__2[T] {
622+
func XGox_Var_Cast__2[T []any]() *Var__2[T] {
623623
return new(Var__2[T])
624624
}
625625

626-
func Gopx_Var_Cast__3[T []string]() *Var__3[T] {
626+
func XGox_Var_Cast__3[T []string]() *Var__3[T] {
627627
return new(Var__3[T])
628628
}
629629

0 commit comments

Comments
 (0)