mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
chore(go-lint): fix golint warning (#133)
Fixes several go lint cases reported by go report. Signed-off-by: wiwen <shenggxhz@gmail.com>
This commit is contained in:
parent
639ead416e
commit
f5ae3ff476
25 changed files with 78 additions and 51 deletions
|
|
@ -21,26 +21,28 @@ const (
|
|||
|
||||
// supported events categories
|
||||
|
||||
// Install event is sent on pod starts
|
||||
// InstallEvent event is sent on pod starts
|
||||
InstallEvent string = "install"
|
||||
// Ping event is sent periodically
|
||||
Ping string = "zfs-ping"
|
||||
// VolumeProvision event is sent when a volume is created
|
||||
VolumeProvision string = "volume-provision"
|
||||
//VolumeDeprovision event is sent when a volume is deleted
|
||||
// VolumeDeprovision event is sent when a volume is deleted
|
||||
VolumeDeprovision string = "volume-deprovision"
|
||||
AppName string = "OpenEBS"
|
||||
// AppName the application name
|
||||
AppName string = "OpenEBS"
|
||||
|
||||
// RunningStatus status is running
|
||||
RunningStatus string = "running"
|
||||
// Event labels
|
||||
RunningStatus string = "running"
|
||||
EventLabelNode string = "nodes"
|
||||
EventLabelCapacity string = "capacity"
|
||||
|
||||
// Event action
|
||||
// Replica Event replication
|
||||
Replica string = "replica:"
|
||||
DefaultReplicaCount string = "replica:1"
|
||||
|
||||
// Event application name constant for volume event
|
||||
// DefaultCASType Event application name constant for volume event
|
||||
DefaultCASType string = "zfs-localpv"
|
||||
|
||||
// LocalPVReplicaCount is the constant used by usage to represent
|
||||
|
|
|
|||
|
|
@ -13,6 +13,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.
|
||||
*/
|
||||
|
||||
package usage
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/openebs/zfs-localpv/pkg/common/env"
|
||||
)
|
||||
|
||||
// OpenEBSPingPeriod ping interval of volume io analytics
|
||||
var OpenEBSPingPeriod = "OPENEBS_IO_ANALYTICS_PING_INTERVAL"
|
||||
|
||||
const (
|
||||
|
|
@ -39,7 +40,7 @@ func PingCheck() {
|
|||
u := New()
|
||||
duration := getPingPeriod()
|
||||
ticker := time.NewTicker(duration)
|
||||
for _ = range ticker.C {
|
||||
for range ticker.C {
|
||||
u.Build().
|
||||
InstallBuilder(true).
|
||||
SetCategory(Ping).
|
||||
|
|
@ -57,7 +58,8 @@ func getPingPeriod() time.Duration {
|
|||
if duration < minimumPingPeriod {
|
||||
// Avoid corner case when the ENV value is undesirable
|
||||
return time.Duration(defaultPingPeriod)
|
||||
} else {
|
||||
return time.Duration(duration)
|
||||
}
|
||||
|
||||
return time.Duration(duration)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,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.
|
||||
*/
|
||||
|
||||
package usage
|
||||
|
||||
import (
|
||||
|
|
@ -204,7 +205,7 @@ func (u *Usage) Build() *Usage {
|
|||
return u
|
||||
}
|
||||
|
||||
// Application builder is used for adding k8s&openebs environment detail
|
||||
// ApplicationBuilder Application builder is used for adding k8s&openebs environment detail
|
||||
// for non install events
|
||||
func (u *Usage) ApplicationBuilder() *Usage {
|
||||
v := NewVersion()
|
||||
|
|
@ -223,7 +224,7 @@ func (u *Usage) SetVolumeCapacity(volCapG string) *Usage {
|
|||
return u
|
||||
}
|
||||
|
||||
// Wrapper for setting the default storage-engine for volume-provision event
|
||||
// SetVolumeType Wrapper for setting the default storage-engine for volume-provision event
|
||||
func (u *Usage) SetVolumeType(volType, method string) *Usage {
|
||||
if method == VolumeProvision && volType == "" {
|
||||
// Set the default storage engine, if not specified in the request
|
||||
|
|
@ -234,7 +235,7 @@ func (u *Usage) SetVolumeType(volType, method string) *Usage {
|
|||
return u
|
||||
}
|
||||
|
||||
// Wrapper for setting replica count for volume events
|
||||
// SetReplicaCount Wrapper for setting replica count for volume events
|
||||
// NOTE: This doesn't get the replica count in a volume de-provision event.
|
||||
// TODO: Pick the current value of replica-count from the CAS-engine
|
||||
func (u *Usage) SetReplicaCount(count, method string) *Usage {
|
||||
|
|
@ -244,7 +245,7 @@ func (u *Usage) SetReplicaCount(count, method string) *Usage {
|
|||
u.SetAction(DefaultReplicaCount)
|
||||
} else {
|
||||
// Catch all case for volume-deprovision event and
|
||||
// volume-provision event with an overriden replica-count
|
||||
// volume-provision event with an overridden replica-count
|
||||
u.SetAction(Replica + count)
|
||||
}
|
||||
return u
|
||||
|
|
|
|||
|
|
@ -13,6 +13,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.
|
||||
*/
|
||||
|
||||
package usage
|
||||
|
||||
import (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue