Skip to content

Commit

Permalink
Replace func available in pointer package
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Sep 11, 2024
1 parent 2c46555 commit f617d9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
11 changes: 5 additions & 6 deletions cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/fi-ts/cloud-go/api/client/volume"
"github.com/fi-ts/cloud-go/api/models"
"github.com/fi-ts/cloudctl/cmd/helper"
"github.com/fi-ts/cloudctl/cmd/output"
"github.com/gardener/gardener/pkg/apis/core/v1beta1"
"github.com/google/go-cmp/cmp"
"github.com/metal-stack/metal-lib/pkg/cache"
Expand Down Expand Up @@ -1266,9 +1265,9 @@ func newCache(cloud *client.CloudAPI, expiration time.Duration, partition, tenan
return &apiCache{
clusters: cache.New(expiration, func(ctx context.Context, _ string) ([]*models.V1ClusterResponse, error) {
resp, err := cloud.Cluster.FindClusters(cluster.NewFindClustersParams().WithBody(&models.V1ClusterFindRequest{
PartitionID: output.StrDeref(partition),
Tenant: output.StrDeref(tenant),
Purpose: output.StrDeref(purpose),
PartitionID: pointer.PointerOrDefault(partition, ""),
Tenant: pointer.PointerOrDefault(tenant, ""),
Purpose: pointer.PointerOrDefault(purpose, ""),
}).WithReturnMachines(pointer.Pointer(false)).WithContext(ctx), nil)
if err != nil {
return nil, err
Expand All @@ -1277,8 +1276,8 @@ func newCache(cloud *client.CloudAPI, expiration time.Duration, partition, tenan
}),
volumes: cache.New(expiration, func(ctx context.Context, _ string) ([]*models.V1VolumeResponse, error) {
resp, err := cloud.Volume.FindVolumes(volume.NewFindVolumesParams().WithBody(&models.V1VolumeFindRequest{
PartitionID: output.StrDeref(partition),
TenantID: output.StrDeref(tenant),
PartitionID: pointer.PointerOrDefault(partition, ""),
TenantID: pointer.PointerOrDefault(tenant, ""),
}).WithContext(ctx), nil)
if err != nil {
return nil, err
Expand Down
7 changes: 0 additions & 7 deletions cmd/output/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ func sortIPs(v1ips []*models.ModelsV1IPResponse) []*models.ModelsV1IPResponse {
return result
}

func StrDeref(s string) *string {
if s == "" {
return nil
}
return &s
}

func printStringSlice(s []string) {
var dashed []string
for _, elem := range s {
Expand Down

0 comments on commit f617d9a

Please sign in to comment.