3 回答

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

TA貢獻2021條經驗 獲得超8個贊
對命令調用進行硬編碼。沒有其他選擇AFAIS。
golangci.example.yml
存儲庫中的示例配置。
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 關注
- 348 瀏覽
添加回答
舉報