![Steven Clark](/assets/img/avatar_default.png)
* Fix licensing on various files * Update CI and release files to BUSL-1.1 * Update offset within config_test_helpers.go - Fix a test the same way it's been fixed on main/1.15
32 lines
1.0 KiB
YAML
32 lines
1.0 KiB
YAML
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
# https://github.com/golang/go/issues/28308, from @stapelberg
|
|
rules:
|
|
- id: sprintf-host-port
|
|
pattern-either:
|
|
- patterns:
|
|
- pattern-either:
|
|
- pattern: fmt.Sprintf("%s:%s", $NET, $XX)
|
|
- pattern: fmt.Sprintf("%s:%d", $NET, $XX)
|
|
- pattern: fmt.Sprintf("%s:%s", $XX, $NET)
|
|
- pattern: fmt.Sprintf("%s:%d", $XX, $NET)
|
|
- pattern: $NET = fmt.Sprintf("%s:%d", ..., ...)
|
|
- pattern: $NET = fmt.Sprintf("%s:%s", ..., ...)
|
|
- metavariable-regex:
|
|
metavariable: '$NET'
|
|
regex: '(?i).*(port|addr|host|listen|bind|ip)'
|
|
- patterns:
|
|
- pattern: fmt.Sprintf($XX, $NET)
|
|
- metavariable-regex:
|
|
metavariable: '$XX'
|
|
regex: '"%s:[0-9]+"'
|
|
- metavariable-regex:
|
|
metavariable: '$NET'
|
|
regex: '(?i).*(port|addr|host|listen|bind|ip)'
|
|
message: |
|
|
use net.JoinHostPort instead of fmt.Sprintf($XX, $NET)
|
|
languages: [go]
|
|
severity: ERROR
|
|
|