-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.go
54 lines (50 loc) · 976 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package go2go
import (
"go/types"
"strings"
)
func getBasicTypeName(k types.BasicKind) string {
switch k {
case types.Bool:
return "bool"
case types.Int:
return "int"
case types.Int8:
return "int8"
case types.Int16:
return "int16"
case types.Int32:
return "int32"
case types.Int64:
return "int64"
case types.Uint:
return "uint"
case types.Uint8:
return "uint8"
case types.Uint16:
return "uint16"
case types.Uint32:
return "uint32"
case types.Uint64:
return "uint64"
case types.Uintptr:
return "uintptr"
case types.Float32:
return "float32"
case types.Float64:
return "float64"
case types.Complex64:
return "complex64"
case types.Complex128:
return "complex128"
case types.String:
return "string"
default:
return "interface{}" // Unsupported type
}
}
// SplitPackegeStruct - package.structを分割
func SplitPackegeStruct(s string) (string, string) {
idx := strings.LastIndex(s, ".")
return s[:idx], s[idx+1:]
}