cleanup: replace TypeToPtr helper methods with pointer.Of (#14151)

Bumping compile time requirement to go 1.18 allows us to simplify our pointer helper methods.
This commit is contained in:
Piotr Kazmierczak
2022-08-17 18:26:34 +02:00
committed by GitHub
parent b9fec224ba
commit c4be2c6078
136 changed files with 2403 additions and 2521 deletions

View File

@@ -10,7 +10,7 @@ import (
"time"
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/nomad/helper"
"github.com/hashicorp/nomad/helper/pointer"
"github.com/hashicorp/nomad/plugins/base"
"github.com/hashicorp/nomad/plugins/device"
"github.com/hashicorp/nomad/plugins/shared/hclspec"
@@ -343,23 +343,23 @@ func (d *FsDevice) collectStats() (*device.DeviceGroupStats, error) {
s := &device.DeviceStats{
Summary: &structs.StatValue{
IntNumeratorVal: helper.Int64ToPtr(f.Size()),
IntNumeratorVal: pointer.Of(f.Size()),
Unit: "bytes",
Desc: "Filesize in bytes",
},
Stats: &structs.StatObject{
Attributes: map[string]*structs.StatValue{
"size": {
IntNumeratorVal: helper.Int64ToPtr(f.Size()),
IntNumeratorVal: pointer.Of(f.Size()),
Unit: "bytes",
Desc: "Filesize in bytes",
},
"modify_time": {
StringVal: helper.StringToPtr(f.ModTime().String()),
StringVal: pointer.Of(f.ModTime().String()),
Desc: "Last modified",
},
"mode": {
StringVal: helper.StringToPtr(f.Mode().String()),
StringVal: pointer.Of(f.Mode().String()),
Desc: "File mode",
},
},