VOL-1900 lint warning fixes rw_core
Change-Id: Icaa84d7ce24163da90c91ff2babcbb78ff4e9141
diff --git a/rw_core/core/id.go b/rw_core/core/id.go
index 369b4f1..399bf1d 100644
--- a/rw_core/core/id.go
+++ b/rw_core/core/id.go
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package core
import (
@@ -32,36 +33,37 @@
return hex.EncodeToString(bytes), nil
}
-// CreateDeviceId produces a device ID. DeviceId is 16 hex long - lower 12 hex is the device id.
+// CreateDeviceID produces a device ID. DeviceId is 16 hex long - lower 12 hex is the device id.
// TODO: A cluster unique ID may be required
-func CreateDeviceId() string {
+func CreateDeviceID() string {
val, _ := randomHex(12)
return val
}
-// CreateLogicalDeviceId is not used for now as the logical device ID is derived from the
+// CreateLogicalDeviceID is not used for now as the logical device ID is derived from the
// OLT MAC address
-func CreateLogicalDeviceId() string {
+func CreateLogicalDeviceID() string {
// logical device id is 16 hex long - lower 12 hex is the logical device id. For now just generate the 12 hex
val, _ := randomHex(12)
return val
}
-// CreateLogicalPortId produces a random port ID for a logical device.
-func CreateLogicalPortId() uint32 {
+// CreateLogicalPortID produces a random port ID for a logical device.
+func CreateLogicalPortID() uint32 {
// A logical port is a uint32
return m.Uint32()
}
-func CreateDataPathId(idInHexString string) (uint64, error) {
+// CreateDataPathID creates uint64 pathid from string pathid
+func CreateDataPathID(idInHexString string) (uint64, error) {
if idInHexString == "" {
return 0, errors.New("id-empty")
}
// First prepend 0x to the string
- newId := fmt.Sprintf("0x%s", idInHexString)
- if d, err := strconv.ParseUint(newId, 0, 64); err != nil {
+ newID := fmt.Sprintf("0x%s", idInHexString)
+ d, err := strconv.ParseUint(newID, 0, 64)
+ if err != nil {
return 0, err
- } else {
- return d, nil
}
+ return d, nil
}