diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 32cac6d..ab14ae8 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,6 +27,7 @@ jobs: # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. version: v1.54 + args: --out-format=colored-line-number # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/pkg/zhmcclient/client.go b/pkg/zhmcclient/client.go index 20686e2..dae383b 100644 --- a/pkg/zhmcclient/client.go +++ b/pkg/zhmcclient/client.go @@ -1,3 +1,4 @@ + // Copyright 2021-2023 IBM Corp. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,8 +37,8 @@ import ( ) func NewZapLogger() Logger { - zapLogger, _ := zap.NewProduction() - return zapLogger + zapLogger, _ := zap.NewProduction() + return zapLogger } var logger = NewZapLogger() @@ -107,8 +108,8 @@ type Client struct { func NewClient(endpoint string, opts *Options, l Logger) (ClientAPI, *HmcError) { if l != nil { - logger = l - } + logger = l + } tslConfig, err := SetCertificate(opts, &tls.Config{}) if err != nil { diff --git a/pkg/zhmcclient/cpc.go b/pkg/zhmcclient/cpc.go index 12c40eb..0811aba 100644 --- a/pkg/zhmcclient/cpc.go +++ b/pkg/zhmcclient/cpc.go @@ -25,6 +25,7 @@ import ( ) // CpcAPI defines an interface for issuing CPC requests to ZHMC +// //go:generate counterfeiter -o fakes/cpc.go --fake-name CpcAPI . CpcAPI type CpcAPI interface { ListCPCs(query map[string]string) ([]CPC, int, *HmcError) diff --git a/pkg/zhmcclient/job.go b/pkg/zhmcclient/job.go index 2d0ce07..547ef87 100644 --- a/pkg/zhmcclient/job.go +++ b/pkg/zhmcclient/job.go @@ -24,6 +24,7 @@ import ( ) // JobAPI defines an interface for issuing Job requests to ZHMC +// //go:generate counterfeiter -o fakes/job.go --fake-name JobAPI . JobAPI type JobAPI interface { QueryJob(jobURI string) (*Job, int, *HmcError) diff --git a/pkg/zhmcclient/logger.go b/pkg/zhmcclient/logger.go index 3c9a7b4..483c18f 100644 --- a/pkg/zhmcclient/logger.go +++ b/pkg/zhmcclient/logger.go @@ -4,7 +4,6 @@ import ( "go.uber.org/zap/zapcore" ) - type Logger interface { Debug(msg string, fields ...zapcore.Field) Info(msg string, fields ...zapcore.Field) diff --git a/pkg/zhmcclient/lpar.go b/pkg/zhmcclient/lpar.go index 60dcf96..665697f 100644 --- a/pkg/zhmcclient/lpar.go +++ b/pkg/zhmcclient/lpar.go @@ -25,6 +25,7 @@ import ( ) // LparAPI defines an interface for issuing LPAR requests to ZHMC +// //go:generate counterfeiter -o fakes/lpar.go --fake-name LparAPI . LparAPI type LparAPI interface { CreateLPAR(cpcURI string, props *LparProperties) (string, int, *HmcError) diff --git a/pkg/zhmcclient/nic.go b/pkg/zhmcclient/nic.go index 1d2c08b..6aa5a4d 100644 --- a/pkg/zhmcclient/nic.go +++ b/pkg/zhmcclient/nic.go @@ -25,6 +25,7 @@ import ( ) // NicAPI defines an interface for issuing NIC requests to ZHMC +// //go:generate counterfeiter -o fakes/nic.go --fake-name NicAPI . NicAPI type NicAPI interface { CreateNic(lparURI string, nic *NIC) (string, int, *HmcError) diff --git a/pkg/zhmcclient/sgroup.go b/pkg/zhmcclient/sgroup.go index beabcf2..6f7e664 100644 --- a/pkg/zhmcclient/sgroup.go +++ b/pkg/zhmcclient/sgroup.go @@ -266,11 +266,12 @@ func (m *StorageGroupManager) UpdateStorageGroupProperties(storageGroupURI strin return status, nil } -/** -* POST /api/storage-groups/{storage-group-id}/operations/accept-mismatched- - storage-volumes -* Return: 200 -* or: 400, 404, 409 +/* +* + - POST /api/storage-groups/{storage-group-id}/operations/accept-mismatched- + storage-volumes + - Return: 200 + - or: 400, 404, 409 */ func (m *StorageGroupManager) FulfillStorageGroup(storageGroupURI string, request *StorageGroupProperties) (int, *HmcError) { requestUrl := m.client.CloneEndpointURL() diff --git a/pkg/zhmcclient/vswitch.go b/pkg/zhmcclient/vswitch.go index b019894..efa5425 100644 --- a/pkg/zhmcclient/vswitch.go +++ b/pkg/zhmcclient/vswitch.go @@ -25,6 +25,7 @@ import ( ) // VirtualSwitchAPI defines an interface for issuing VirtualSwitch requests to ZHMC +// //go:generate counterfeiter -o fakes/vswitch.go --fake-name VirtualSwitchAPI . VirtualSwitchAPI type VirtualSwitchAPI interface { ListVirtualSwitches(cpcURI string, query map[string]string) ([]VirtualSwitch, int, *HmcError)