VOL-1900 lint warning fixes rw_core
Change-Id: Icaa84d7ce24163da90c91ff2babcbb78ff4e9141
diff --git a/rw_core/utils/core_utils.go b/rw_core/utils/core_utils.go
index 3a71623..584d923 100644
--- a/rw_core/utils/core_utils.go
+++ b/rw_core/utils/core_utils.go
@@ -13,27 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package utils
import (
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
"os"
"time"
+
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
)
+// DeviceID represent device id attribute
type DeviceID struct {
- Id string
+ ID string
}
+// LogicalDeviceID rpresent logical device id attribute
type LogicalDeviceID struct {
- Id string
+ ID string
}
+// GetHostName returns host name
func GetHostName() string {
return os.Getenv("HOSTNAME")
}
+// Response -
type Response struct {
*response
}
@@ -43,6 +49,7 @@
done bool
}
+// NewResponse -
func NewResponse() Response {
return Response{
&response{
diff --git a/rw_core/utils/core_utils_test.go b/rw_core/utils/core_utils_test.go
index 9f8dd87..cc48b10 100644
--- a/rw_core/utils/core_utils_test.go
+++ b/rw_core/utils/core_utils_test.go
@@ -16,13 +16,14 @@
package utils
import (
+ "math/rand"
+ "testing"
+ "time"
+
"github.com/opencord/voltha-lib-go/v2/pkg/log"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
- "math/rand"
- "testing"
- "time"
)
var (
@@ -31,7 +32,10 @@
)
func init() {
- log.AddPackage(log.JSON, log.WarnLevel, nil)
+ _, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+ if err != nil {
+ log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+ }
timeoutError = status.Errorf(codes.Aborted, "timeout")
taskFailureError = status.Error(codes.Internal, "test failure task")
}
@@ -56,7 +60,7 @@
responses[i] = NewResponse()
if numSuccessfulTaskCreated < numSuccessfulTask {
go runSuccessfulTask(responses[i], taskDurationRange)
- numSuccessfulTaskCreated += 1
+ numSuccessfulTaskCreated++
continue
}
go runFailureTask(responses[i], taskDurationRange)
@@ -71,11 +75,11 @@
for _, input := range inputs {
if input != nil {
if input.Error() == timeoutError.Error() {
- numTimeout += 1
+ numTimeout++
}
- numFailure += 1
+ numFailure++
} else {
- numSuccess += 1
+ numSuccess++
}
}
return