fix lint issues

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-03-11 22:08:50 +01:00
parent 6c7155d87b
commit 3c99d72dc3
6 changed files with 10 additions and 7 deletions

View File

@@ -136,10 +136,10 @@ func NewWithFlags(app *kingpin.Application) *Collector {
}
sb := strings.Builder{}
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object"))
_, _ = fmt.Fprintf(&sb, "%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object")
for _, cname := range ConfigDefaults.CollectorsEnabled {
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", cname, collectorDesc[cname]))
_, _ = fmt.Fprintf(&sb, "%-32s %-32s\n", cname, collectorDesc[cname])
}
app.UsageTemplate(sb.String()).Usage(nil)

View File

@@ -118,7 +118,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
Metric: []*dto.Metric{&metric1, &metric2},
}
var duplicateFamily []*dto.MetricFamily
duplicateFamily := make([]*dto.MetricFamily, 0, 1)
duplicateFamily = append(duplicateFamily, &duplicate)
@@ -146,7 +146,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
Metric: []*dto.Metric{&metric1, &metric3},
}
duplicateFamily = []*dto.MetricFamily{}
duplicateFamily = make([]*dto.MetricFamily, 0, 1)
duplicateFamily = append(duplicateFamily, &differentLabels)
// Additional label on second metric should not be cause for duplicate detection
@@ -171,7 +171,7 @@ func TestDuplicateMetricEntry(t *testing.T) {
Type: &metric_type,
Metric: []*dto.Metric{&metric3, &metric4},
}
duplicateFamily = []*dto.MetricFamily{}
duplicateFamily = make([]*dto.MetricFamily, 0, 1)
duplicateFamily = append(duplicateFamily, &differentValues)
// Additional label with different values metric should not be cause for duplicate detection

View File

@@ -71,6 +71,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
for _, subnet := range subnets {
if err := (func() error {
var subnetInfo *DHCP_SUBNET_INFO
err := dhcpGetSubnetInfo(subnet.SubnetAddress, &subnetInfo)
if err != nil {
return fmt.Errorf("failed to get subnet info: %w", err)
@@ -109,6 +110,7 @@ func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error) {
}
var subnetStatistics *DHCP_FAILOVER_STATISTICS
err = dhcpV4FailoverGetScopeStatistics(subnet.SubnetAddress, &subnetStatistics)
defer dhcpRpcFreeMemory(unsafe.Pointer(subnetStatistics))

View File

@@ -142,7 +142,7 @@ func (c *ClassDecl) Properties() []*PropertyDecl {
// Iterate over the number of properties and fetch each property
for i := range c.NumProperties {
// Get the property pointer at index i
propertyPtr := *(**PropertyDecl)(unsafe.Pointer(uintptr(unsafe.Pointer(propertiesArray)) + uintptr(i)*unsafe.Sizeof(uintptr(0))))
propertyPtr := *(**PropertyDecl)(unsafe.Add(unsafe.Pointer(propertiesArray), uintptr(i)*unsafe.Sizeof(uintptr(0))))
// Append the property to the slice
properties[i] = propertyPtr

View File

@@ -12,6 +12,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build windows
package testutils