Explorar el Código

refactor: replace iota with explicit values for log type constants

CaIon hace 4 meses
padre
commit
69b87b5d8e
Se han modificado 1 ficheros con 8 adiciones y 7 borrados
  1. 8 7
      model/log.go

+ 8 - 7
model/log.go

@@ -39,14 +39,15 @@ type Log struct {
 	Other            string `json:"other"`
 }
 
+// don't use iota, avoid change log type value
 const (
-	LogTypeUnknown = iota
-	LogTypeTopup
-	LogTypeConsume
-	LogTypeManage
-	LogTypeSystem
-	LogTypeError
-	LogTypeRefund
+	LogTypeUnknown = 0
+	LogTypeTopup   = 1
+	LogTypeConsume = 2
+	LogTypeManage  = 3
+	LogTypeSystem  = 4
+	LogTypeError   = 5
+	LogTypeRefund  = 6
 )
 
 func formatUserLogs(logs []*Log) {