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 关注
- 260 浏览
添加回答
举报