Skip to content

Commit 5b64bd9

Browse files
committedDec 7, 2022
Run gofmt with Go v1.19
1 parent 9852be6 commit 5b64bd9

File tree

14 files changed

+144
-139
lines changed

14 files changed

+144
-139
lines changed
 

‎acceptance/gnocchi/metric/v1/archivepolicies_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance || metric || archivepolicies
12
// +build acceptance metric archivepolicies
23

34
package v1

‎acceptance/gnocchi/metric/v1/measures_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance || metric || measures
12
// +build acceptance metric measures
23

34
package v1

‎acceptance/gnocchi/metric/v1/metrics_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance || metric || metrics
12
// +build acceptance metric metrics
23

34
package v1

‎acceptance/gnocchi/metric/v1/resources_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance || metric || resources
12
// +build acceptance metric resources
23

34
package v1

‎acceptance/gnocchi/metric/v1/resourcetypes_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance || metric || resourcetypes
12
// +build acceptance metric resourcetypes
23

34
package v1

‎acceptance/openstack/objectstorage/v1/objects_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance
12
// +build acceptance
23

34
package v1

‎client/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,5 @@ Example usage with additinal headers:
142142
Region: os.Getenv("OS_REGION_NAME"),
143143
})
144144
}
145-
146145
*/
147146
package client

‎env/env.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !windows
12
// +build !windows
23

34
package env

‎gnocchi/metric/v1/archivepolicies/doc.go

+43-43
Original file line numberDiff line numberDiff line change
@@ -28,54 +28,54 @@ Example of Getting an archive policy
2828
2929
Example of Creating an archive policy
3030
31-
createOpts := archivepolicies.CreateOpts{
32-
BackWindow: 31,
33-
AggregationMethods: []string{
34-
"sum",
35-
"mean",
36-
"count",
37-
},
38-
Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
39-
{
40-
Granularity: "1:00:00",
41-
TimeSpan: "90 days, 0:00:00",
42-
},
43-
{
44-
Granularity: "1 day, 0:00:00",
45-
TimeSpan: "100 days, 0:00:00",
46-
},
47-
},
48-
Name: "test_policy",
49-
}
50-
archivePolicy, err := archivepolicies.Create(gnocchiClient, createOpts).Extract()
51-
if err != nil {
52-
panic(err)
53-
}
31+
createOpts := archivepolicies.CreateOpts{
32+
BackWindow: 31,
33+
AggregationMethods: []string{
34+
"sum",
35+
"mean",
36+
"count",
37+
},
38+
Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
39+
{
40+
Granularity: "1:00:00",
41+
TimeSpan: "90 days, 0:00:00",
42+
},
43+
{
44+
Granularity: "1 day, 0:00:00",
45+
TimeSpan: "100 days, 0:00:00",
46+
},
47+
},
48+
Name: "test_policy",
49+
}
50+
archivePolicy, err := archivepolicies.Create(gnocchiClient, createOpts).Extract()
51+
if err != nil {
52+
panic(err)
53+
}
5454
5555
Example of Updating an archive policy
5656
57-
updateOpts := archivepolicies.UpdateOpts{
58-
Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
59-
{
60-
Granularity: "12:00:00",
61-
TimeSpan: "30 days, 0:00:00",
62-
},
63-
{
64-
Granularity: "1 day, 0:00:00",
65-
TimeSpan: "90 days, 0:00:00",
66-
},
67-
},
68-
}
69-
archivePolicy, err := archivepolicies.Update(gnocchiClient, "test_policy", updateOpts).Extract()
70-
if err != nil {
71-
panic(err)
72-
}
57+
updateOpts := archivepolicies.UpdateOpts{
58+
Definition: []archivepolicies.ArchivePolicyDefinitionOpts{
59+
{
60+
Granularity: "12:00:00",
61+
TimeSpan: "30 days, 0:00:00",
62+
},
63+
{
64+
Granularity: "1 day, 0:00:00",
65+
TimeSpan: "90 days, 0:00:00",
66+
},
67+
},
68+
}
69+
archivePolicy, err := archivepolicies.Update(gnocchiClient, "test_policy", updateOpts).Extract()
70+
if err != nil {
71+
panic(err)
72+
}
7373
7474
Example of Deleting a Gnocchi archive policy
7575
76-
err := archivepolicies.Delete(gnocchiClient, "test_policy").ExtractErr()
77-
if err != nil {
78-
panic(err)
79-
}
76+
err := archivepolicies.Delete(gnocchiClient, "test_policy").ExtractErr()
77+
if err != nil {
78+
panic(err)
79+
}
8080
*/
8181
package archivepolicies

‎gnocchi/metric/v1/measures/results.go

+12-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@ UnmarshalJSON helps to unmarshal response from reading Gnocchi measures.
4747
Gnocchi APIv1 returns measures in a such format:
4848
4949
[
50-
[
51-
"2017-01-08T10:00:00+00:00",
52-
300.0,
53-
146.0
54-
],
55-
[
56-
"2017-01-08T10:05:00+00:00",
57-
300.0,
58-
58.0
59-
]
50+
51+
[
52+
"2017-01-08T10:00:00+00:00",
53+
300.0,
54+
146.0
55+
],
56+
[
57+
"2017-01-08T10:05:00+00:00",
58+
300.0,
59+
58.0
60+
]
61+
6062
]
6163
6264
Helper unmarshals every nested array into the Measure type.

‎gnocchi/metric/v1/resourcetypes/doc.go

+79-79
Original file line numberDiff line numberDiff line change
@@ -3,98 +3,98 @@ Package resourcetypes provides ability to manage resource types through the Gnoc
33
44
Example of Listing resource types
55
6-
allPages, err := resourcetypes.List(client).AllPages()
7-
if err != nil {
8-
panic(err)
9-
}
6+
allPages, err := resourcetypes.List(client).AllPages()
7+
if err != nil {
8+
panic(err)
9+
}
1010
11-
allResourceTypes, err := resourcetypes.ExtractResourceTypes(allPages)
12-
if err != nil {
13-
panic(err)
14-
}
11+
allResourceTypes, err := resourcetypes.ExtractResourceTypes(allPages)
12+
if err != nil {
13+
panic(err)
14+
}
1515
16-
for _, resourceType := range allResourceTypes {
17-
fmt.Printf("%+v\n", resourceType)
18-
}
16+
for _, resourceType := range allResourceTypes {
17+
fmt.Printf("%+v\n", resourceType)
18+
}
1919
2020
Example of Getting a resource type
2121
22-
resourceTypeName := "compute_instance"
23-
resourceType, err := resourcetypes.Get(gnocchiClient, resourceTypeName).Extract()
24-
if err != nil {
25-
panic(err)
26-
}
22+
resourceTypeName := "compute_instance"
23+
resourceType, err := resourcetypes.Get(gnocchiClient, resourceTypeName).Extract()
24+
if err != nil {
25+
panic(err)
26+
}
2727
2828
Example of Creating a resource type
2929
30-
resourceTypeOpts := resourcetypes.CreateOpts{
31-
Name: "compute_instance_network",
32-
Attributes: map[string]resourcetypes.AttributeOpts{
33-
"port_name": resourcetypes.AttributeOpts{
34-
Type: "string",
35-
Details: map[string]interface{}{
36-
"max_length": 128,
37-
"required": false,
38-
},
39-
},
40-
"port_id": resourcetypes.AttributeOpts{
41-
Type: "uuid",
42-
Details: map[string]interface{}{
43-
"required": true,
44-
},
45-
},
46-
},
47-
}
48-
resourceType, err := resourcetypes.Create(gnocchiClient, resourceTypeOpts).Extract()
49-
if err != nil {
50-
panic(err)
51-
}
30+
resourceTypeOpts := resourcetypes.CreateOpts{
31+
Name: "compute_instance_network",
32+
Attributes: map[string]resourcetypes.AttributeOpts{
33+
"port_name": resourcetypes.AttributeOpts{
34+
Type: "string",
35+
Details: map[string]interface{}{
36+
"max_length": 128,
37+
"required": false,
38+
},
39+
},
40+
"port_id": resourcetypes.AttributeOpts{
41+
Type: "uuid",
42+
Details: map[string]interface{}{
43+
"required": true,
44+
},
45+
},
46+
},
47+
}
48+
resourceType, err := resourcetypes.Create(gnocchiClient, resourceTypeOpts).Extract()
49+
if err != nil {
50+
panic(err)
51+
}
5252
5353
Example of Updating a resource type
5454
55-
enabledAttributeOptions := resourcetypes.AttributeOpts{
56-
Details: map[string]interface{}{
57-
"required": true,
58-
"options": map[string]interface{}{
59-
"fill": true,
60-
},
61-
},
62-
Type: "bool",
63-
}
64-
parendIDAttributeOptions := resourcetypes.AttributeOpts{
65-
Details: map[string]interface{}{
66-
"required": false,
67-
},
68-
Type: "uuid",
69-
}
70-
resourceTypeOpts := resourcetypes.UpdateOpts{
71-
Attributes: []resourcetypes.AttributeUpdateOpts{
72-
{
73-
Name: "enabled",
74-
Operation: resourcetypes.AttributeAdd,
75-
Value: &enabledAttributeOptions,
76-
},
77-
{
78-
Name: "parent_id",
79-
Operation: resourcetypes.AttributeAdd,
80-
Value: &parendIDAttributeOptions,
81-
},
82-
{
83-
Name: "domain_id",
84-
Operation: resourcetypes.AttributeRemove,
85-
},
86-
},
87-
}
88-
resourceType, err := resourcetypes.Update(gnocchiClient, resourceTypeOpts).Extract()
89-
if err != nil {
90-
panic(err)
91-
}
55+
enabledAttributeOptions := resourcetypes.AttributeOpts{
56+
Details: map[string]interface{}{
57+
"required": true,
58+
"options": map[string]interface{}{
59+
"fill": true,
60+
},
61+
},
62+
Type: "bool",
63+
}
64+
parendIDAttributeOptions := resourcetypes.AttributeOpts{
65+
Details: map[string]interface{}{
66+
"required": false,
67+
},
68+
Type: "uuid",
69+
}
70+
resourceTypeOpts := resourcetypes.UpdateOpts{
71+
Attributes: []resourcetypes.AttributeUpdateOpts{
72+
{
73+
Name: "enabled",
74+
Operation: resourcetypes.AttributeAdd,
75+
Value: &enabledAttributeOptions,
76+
},
77+
{
78+
Name: "parent_id",
79+
Operation: resourcetypes.AttributeAdd,
80+
Value: &parendIDAttributeOptions,
81+
},
82+
{
83+
Name: "domain_id",
84+
Operation: resourcetypes.AttributeRemove,
85+
},
86+
},
87+
}
88+
resourceType, err := resourcetypes.Update(gnocchiClient, resourceTypeOpts).Extract()
89+
if err != nil {
90+
panic(err)
91+
}
9292
9393
Example of Deleting a resource type
9494
95-
err := resourcetypes.Delete(gnocchiClient, resourceType).ExtractErr()
96-
if err != nil {
97-
panic(err)
98-
}
95+
err := resourcetypes.Delete(gnocchiClient, resourceType).ExtractErr()
96+
if err != nil {
97+
panic(err)
98+
}
9999
*/
100100
package resourcetypes

‎openstack/clientconfig/doc.go

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Example to Create a Provider Client From clouds.yaml
1515
panic(err)
1616
}
1717
18-
1918
Example to Manually Create a Provider Client
2019
2120
opts := &clientconfig.ClientOpts{
@@ -33,7 +32,6 @@ Example to Manually Create a Provider Client
3332
panic(err)
3433
}
3534
36-
3735
Example to Create a Service Client from clouds.yaml
3836
3937
opts := &clientconfig.ClientOpts{
@@ -44,6 +42,5 @@ Example to Create a Service Client from clouds.yaml
4442
if err != nil {
4543
panic(err)
4644
}
47-
4845
*/
4946
package clientconfig

‎openstack/helpers/doc.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Package helpers collects generic functionality over the Gophercloud OpenStack Go SDK.
33
4-
OpenStack Project Purge
4+
# OpenStack Project Purge
55
66
Set of method to purge resources associated to an OpenStack project.
77
This is partially inspired on the following projects:
@@ -12,7 +12,6 @@ This is partially inspired on the following projects:
1212
1313
- https://opendev.org/x/ospurge
1414
15-
1615
Example to Purge all the resources and Delete a Project
1716
1817
purgeOpts := ProjectPurgeOpts {

‎openstack/objectstorage/v1/objects/upload.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ type UploadOpts struct {
6565
}
6666

6767
// originalObject is an interal structure used to store information about an
68-
// existing object.
68+
//
69+
// existing object.
6970
type originalObject struct {
7071
headers *objects.GetHeader
7172
metadata map[string]string

0 commit comments

Comments
 (0)
Please sign in to comment.