3 回答

TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超9個(gè)贊
您可以使用注釋排除特定行,而不是禁用 linter;
exec.Command(params[0], params[1:]...) //nolint:gosec

TA貢獻(xiàn)1813條經(jīng)驗(yàn) 獲得超2個(gè)贊
如果您只想禁用此檢查,您可以
exec.Command(params[0], params[1:]...) // #nosec G204

TA貢獻(xiàn)2021條經(jīng)驗(yàn) 獲得超8個(gè)贊
對(duì)命令調(diào)用進(jìn)行硬編碼。沒有其他選擇AFAIS。
golangci.example.yml
存儲(chǔ)庫(kù)中的示例配置。
linters-settings:
? gosec:
? ? # To select a subset of rules to run.
? ? # Available rules: https://github.com/securego/gosec#available-rules
? ? includes:
? ? ? - G401
? ? ? - G306
? ? ? - G101
? ? # To specify a set of rules to explicitly exclude.
? ? # Available rules: https://github.com/securego/gosec#available-rules
? ? excludes:
? ? ? - G204
? ? # To specify the configuration of rules.
? ? # The configuration of rules is not fully documented by gosec:
? ? # https://github.com/securego/gosec#configuration
? ? # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
? ? config:
? ? ? G306: "0600"
? ? ? G101:
? ? ? ? pattern: "(?i)example"
? ? ? ? ignore_entropy: false
? ? ? ? entropy_threshold: "80.0"
? ? ? ? per_char_threshold: "3.0"
? ? ? ? truncate: "32"
- 3 回答
- 0 關(guān)注
- 337 瀏覽
添加回答
舉報(bào)