diff --git a/game/builtin/attrs.go b/game/builtin/attrs.go index 505bf17..04b2fcd 100644 --- a/game/builtin/attrs.go +++ b/game/builtin/attrs.go @@ -272,7 +272,7 @@ func (slf *Attrs) GetAttrInt64(id int) int64 { case int32: return int64(value) case int64: - return int64(value) + return value } return 0 } diff --git a/planner/configexport/configexport.go b/planner/configexport/configexport.go index 006c283..abffe9c 100644 --- a/planner/configexport/configexport.go +++ b/planner/configexport/configexport.go @@ -11,6 +11,7 @@ import ( "go.uber.org/zap" "os/exec" "path/filepath" + "runtime/debug" "strings" "text/template" ) @@ -39,11 +40,12 @@ func New(xlsxPath string) *ConfigExport { zap.String("Info", "Excluded non-configuration table files"), ) default: - log.ErrorHideStack("ConfigExport", + log.Error("ConfigExport", zap.String("File", xlsxPath), zap.String("Sheet", sheet.Name), zap.String("Info", "Excluded non-configuration table files"), ) + debug.PrintStack() } } else { if config == nil { diff --git a/planner/configexport/internal/errors.go b/planner/configexport/internal/errors.go index 2e2472f..2e8fbf3 100644 --- a/planner/configexport/internal/errors.go +++ b/planner/configexport/internal/errors.go @@ -9,8 +9,6 @@ var ( ErrReadConfigFailedWithName = errors.New("read config name failed, can not found position") ErrReadConfigFailedWithIndexCount = errors.New("read config index count failed, can not found position") ErrReadConfigFailedWithIndexCountLessThanZero = errors.New("read config index count failed, value less than zero") - ErrReadConfigFailedWithFieldPosition = errors.New("read config index count failed, field position exception") ErrReadConfigFailedWithNameDuplicate = errors.New("read config index count failed, duplicate field names") - ErrReadConfigFailedWithExportParamException = errors.New("read config index count failed, export param must is s or c or sc or cs") ErrReadConfigFailedWithIndexTypeException = errors.New("read config index count failed, the index type is only allowed to be the basic type") ) diff --git a/report/reporter_strategy.go b/report/reporter_strategy.go index d76143b..eecaaba 100644 --- a/report/reporter_strategy.go +++ b/report/reporter_strategy.go @@ -9,9 +9,9 @@ import ( // ReporterStrategy 上报器策略 type ReporterStrategy func(reporter *Reporter) -// ReportStrategyLoop 循环上报 +// StrategyLoop 循环上报 // - 将在创建后上报一次,并且在每隔一段时间后继续上报 -func ReportStrategyLoop(t time.Duration) ReporterStrategy { +func StrategyLoop(t time.Duration) ReporterStrategy { return func(reporter *Reporter) { reporter.ticker.Loop(fmt.Sprintf("ReportStrategyLoop_%d", t.Milliseconds()), timer.Instantly, t, timer.Forever, func() { if err := reporter.Report(); err != nil && reporter.errorHandle != nil { @@ -21,8 +21,8 @@ func ReportStrategyLoop(t time.Duration) ReporterStrategy { } } -// ReportStrategyFixedTime 将在每天的固定时间上报 -func ReportStrategyFixedTime(hour, min, sec int) ReporterStrategy { +// StrategyFixedTime 将在每天的固定时间上报 +func StrategyFixedTime(hour, min, sec int) ReporterStrategy { return func(reporter *Reporter) { now := time.Now() current := now.Unix() diff --git a/utils/asynchronous/map.go b/utils/asynchronous/map.go index a852ff1..36524a4 100644 --- a/utils/asynchronous/map.go +++ b/utils/asynchronous/map.go @@ -146,7 +146,7 @@ func (slf *Map[Key, Value]) rangeFree(handle func(key Key, value Value, skip fun func (slf *Map[Key, Value]) Keys() []Key { var s = make([]Key, 0, len(slf.data)) - for k, _ := range slf.data { + for k := range slf.data { s = append(s, k) } return s diff --git a/utils/file/file.go b/utils/file/file.go index c17936c..871eeb4 100644 --- a/utils/file/file.go +++ b/utils/file/file.go @@ -102,10 +102,10 @@ func LineCount(filePath string) int { return line } -// FilePaths 获取指定目录下的所有文件路径 +// Paths 获取指定目录下的所有文件路径 // - 包括了子目录下的文件 // - 不包含目录 -func FilePaths(dir string) []string { +func Paths(dir string) []string { var paths []string abs, err := filepath.Abs(dir) if err != nil { @@ -119,7 +119,7 @@ func FilePaths(dir string) []string { for _, file := range files { fileAbs := filepath.Join(abs, file.Name()) if file.IsDir() { - paths = append(paths, FilePaths(fileAbs)...) + paths = append(paths, Paths(fileAbs)...) continue } paths = append(paths, fileAbs) diff --git a/utils/file/file_test.go b/utils/file/file_test.go index 7f24ff4..ae45998 100644 --- a/utils/file/file_test.go +++ b/utils/file/file_test.go @@ -10,7 +10,7 @@ import ( func TestFilePaths(t *testing.T) { var line int var fileCount int - for _, path := range file.FilePaths(`D:\sources\minotaur`) { + for _, path := range file.Paths(`D:\sources\minotaur`) { if !strings.HasSuffix(path, ".go") { continue } diff --git a/utils/geometry/navmesh/navmesh_example_test.go b/utils/geometry/navmesh/navmesh_example_test.go index 5075147..2571a51 100644 --- a/utils/geometry/navmesh/navmesh_example_test.go +++ b/utils/geometry/navmesh/navmesh_example_test.go @@ -69,7 +69,7 @@ func ExampleNavMesh_FindPath() { for x := sx; x <= bx; x++ { for y := sy; y <= by; y++ { - fp.Put(geometry.NewPoint[int](int(x), int(y)), '+') + fp.Put(geometry.NewPoint[int](x, y), '+') } } } diff --git a/utils/hash/srot_map.go b/utils/hash/srot_map.go index 9df2975..a913413 100644 --- a/utils/hash/srot_map.go +++ b/utils/hash/srot_map.go @@ -55,7 +55,7 @@ func (slf *SortMap[K, V]) For(handle func(key K, value V) bool) { func (slf *SortMap[K, V]) ForSort(handle func(key K, value V) bool) { var indexes []int - for i, _ := range slf.s { + for i := range slf.s { indexes = append(indexes, i) } sort.Ints(indexes) @@ -85,7 +85,7 @@ func (slf *SortMap[K, V]) ToSlice() []V { func (slf *SortMap[K, V]) ToSliceSort() []V { var indexes []int - for i, _ := range slf.s { + for i := range slf.s { indexes = append(indexes, i) } sort.Ints(indexes) diff --git a/utils/maths/math.go b/utils/maths/math.go index 03ef7f4..991ddb6 100644 --- a/utils/maths/math.go +++ b/utils/maths/math.go @@ -27,7 +27,7 @@ func Pow(a, n int) int { if n == 1 { return a } - var result int = 1 + var result = 1 factor := a for n != 0 { if n&1 != 0 { diff --git a/utils/synchronization/map.go b/utils/synchronization/map.go index 947f35a..f1b0974 100644 --- a/utils/synchronization/map.go +++ b/utils/synchronization/map.go @@ -216,7 +216,7 @@ func (slf *Map[Key, Value]) Keys() []Key { defer slf.lock.RUnlock() } var s = make([]Key, 0, len(slf.data)) - for k, _ := range slf.data { + for k := range slf.data { s = append(s, k) } return s diff --git a/utils/synchronization/map_segment.go b/utils/synchronization/map_segment.go index 853bd44..414e72e 100644 --- a/utils/synchronization/map_segment.go +++ b/utils/synchronization/map_segment.go @@ -183,7 +183,7 @@ func (slf *MapSegment[Key, Value]) RangeFree(handle func(key Key, value Value, s func (slf *MapSegment[Key, Value]) Keys() []Key { var s = make([]Key, 0, len(slf.cache)) slf.lock.RLock() - for k, _ := range slf.cache { + for k := range slf.cache { s = append(s, k) } defer slf.lock.RUnlock()