-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump golangci to get the latest lints & fix lints #984
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1491,7 +1491,7 @@ func GetTiKVErrorTable(startTime, endTime string, db *gorm.DB) (TableDef, error) | |
} | ||
|
||
func GetTiDBCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error) { | ||
sql := fmt.Sprintf("select `key`,`value` from information_schema.CLUSTER_CONFIG where type='tidb' group by `key`,`value` order by `key`;") | ||
sql := "select `key`,`value` from information_schema.CLUSTER_CONFIG where type='tidb' group by `key`,`value` order by `key`;" | ||
table := TableDef{ | ||
Category: []string{CategoryConfig}, | ||
Title: "tidb_current_config", | ||
|
@@ -1507,7 +1507,7 @@ func GetTiDBCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, err | |
} | ||
|
||
func GetPDCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error) { | ||
sql := fmt.Sprintf("select `key`,`value` from information_schema.CLUSTER_CONFIG where type='pd' group by `key`,`value` order by `key`;") | ||
sql := "select `key`,`value` from information_schema.CLUSTER_CONFIG where type='pd' group by `key`,`value` order by `key`;" | ||
table := TableDef{ | ||
Category: []string{CategoryConfig}, | ||
Title: "pd_current_config", | ||
|
@@ -1523,7 +1523,7 @@ func GetPDCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error | |
} | ||
|
||
func GetTiKVCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error) { | ||
sql := fmt.Sprintf("select `key`,`value` from information_schema.CLUSTER_CONFIG where type='tikv' group by `key`,`value` order by `key`;") | ||
sql := "select `key`,`value` from information_schema.CLUSTER_CONFIG where type='tikv' group by `key`,`value` order by `key`;" | ||
table := TableDef{ | ||
Category: []string{CategoryConfig}, | ||
Title: "tikv_current_config", | ||
|
@@ -2050,7 +2050,7 @@ func GetPDEtcdStatusTable(startTime, endTime string, db *gorm.DB) (TableDef, err | |
} | ||
|
||
func GetClusterInfoTable(startTime, endTime string, db *gorm.DB) (TableDef, error) { | ||
sql := fmt.Sprintf("select * from information_schema.cluster_info order by type,start_time desc") | ||
sql := "select * from information_schema.cluster_info order by type,start_time desc" | ||
table := TableDef{ | ||
Category: []string{CategoryHeader}, | ||
Title: "cluster_info", | ||
|
@@ -2150,11 +2150,7 @@ func GetClusterHardwareInfoTable(startTime, endTime string, db *gorm.DB) (TableD | |
if !ok { | ||
m[s] = &hardWare{s, map[string]int{row[1]: 1}, make(map[string]int), 0, make(map[string]float64), ""} | ||
} | ||
if _, ok := m[s].Type[row[1]]; ok { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Smart linter... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. すげー😲 |
||
m[s].Type[row[1]]++ | ||
} else { | ||
m[s].Type[row[1]] = 1 | ||
} | ||
m[s].Type[row[1]]++ | ||
if _, ok := m[s].cpu[row[2]]; !ok { | ||
m[s].cpu[row[2]] = cpuCnt | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,8 @@ func (tg *TaskGroup) SyncRun() { | |
|
||
// Create log directory | ||
dir := path.Join(tg.service.logStoreDirectory, strconv.Itoa(int(tg.model.ID))) | ||
if err := os.MkdirAll(dir, 0777); err == nil { | ||
err := os.MkdirAll(dir, 0777) // #nosec | ||
breezewish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err == nil { | ||
tg.model.LogStoreDir = &dir | ||
tg.service.db.Save(tg.model) | ||
} | ||
|
@@ -223,7 +224,7 @@ func (t *Task) searchLog(client diagnosticspb.DiagnosticsClient, targetType diag | |
t.setError(err) | ||
return | ||
} | ||
defer f.Close() | ||
defer f.Close() // #nosec | ||
|
||
// TODO: Could we use a memory buffer for this and flush the writer regularly to avoid OOM. | ||
// This might perform an faster processing. This could also avoid creating an empty .zip | ||
|
@@ -260,7 +261,7 @@ func (t *Task) searchLog(client diagnosticspb.DiagnosticsClient, targetType diag | |
} | ||
for _, msg := range res.Messages { | ||
line := logMessageToString(msg) | ||
_, err := bufWriter.Write(*(*[]byte)(unsafe.Pointer(&line))) | ||
_, err := bufWriter.Write(*(*[]byte)(unsafe.Pointer(&line))) // #nosec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, this error is checked and why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every |
||
if err != nil { | ||
t.setError(err) | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to always include all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it still makes sense for some low risk issues to be excluded. Is it possible to get the security team to audit low risk issues instead of add
gosec
tag?