Skip to content

Commit 37fb9a1

Browse files
committed
Apply gofmt to comments
With go 1.19, automated go formatting with `go fmt` applies to comments as well. This caused the unit test job to fail on new PRs. Let's apply the go 1.19 formatting to the whole code base. Fixes gophercloud#2449
1 parent 0721d75 commit 37fb9a1

File tree

108 files changed

+1383
-1420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1383
-1420
lines changed

Diff for: acceptance/openstack/compute/v2/compute.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ func WaitForComputeStatus(client *gophercloud.ServiceClient, server *servers.Ser
11401140
})
11411141
}
11421142

1143-
//Convenience method to fill an QuotaSet-UpdateOpts-struct from a QuotaSet-struct
1143+
// Convenience method to fill an QuotaSet-UpdateOpts-struct from a QuotaSet-struct
11441144
func FillUpdateOptsFromQuotaSet(src quotasets.QuotaSet, dest *quotasets.UpdateOpts) {
11451145
dest.FixedIPs = &src.FixedIPs
11461146
dest.FloatingIPs = &src.FloatingIPs

Diff for: acceptance/openstack/networking/v2/extensions/fwaas/fwaas.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func CreatePolicy(t *testing.T, client *gophercloud.ServiceClient, ruleID string
117117
}
118118

119119
// CreateRule will create a Firewall Rule with a random source address and
120-
//source port, destination address and port. An error will be returned if
120+
// source port, destination address and port. An error will be returned if
121121
// the rule could not be created.
122122
func CreateRule(t *testing.T, client *gophercloud.ServiceClient) (*rules.Rule, error) {
123123
ruleName := tools.RandomString("TESTACC-", 8)

Diff for: acceptance/openstack/networking/v2/extensions/fwaas_v2/fwaas_v2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func CreatePolicy(t *testing.T, client *gophercloud.ServiceClient, ruleID string
6969
}
7070

7171
// CreateRule will create a Firewall Rule with a random source address and
72-
//source port, destination address and port. An error will be returned if
72+
// source port, destination address and port. An error will be returned if
7373
// the rule could not be created.
7474
func CreateRule(t *testing.T, client *gophercloud.ServiceClient) (*rules.Rule, error) {
7575
ruleName := tools.RandomString("TESTACC-", 8)

Diff for: auth_options.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ provider.
1212
1313
An example of manually providing authentication information:
1414
15-
opts := gophercloud.AuthOptions{
16-
IdentityEndpoint: "https://openstack.example.com:5000/v2.0",
17-
Username: "{username}",
18-
Password: "{password}",
19-
TenantID: "{tenant_id}",
20-
}
15+
opts := gophercloud.AuthOptions{
16+
IdentityEndpoint: "https://openstack.example.com:5000/v2.0",
17+
Username: "{username}",
18+
Password: "{password}",
19+
TenantID: "{tenant_id}",
20+
}
2121
22-
provider, err := openstack.AuthenticatedClient(opts)
22+
provider, err := openstack.AuthenticatedClient(opts)
2323
2424
An example of using AuthOptionsFromEnv(), where the environment variables can
2525
be read from a file, such as a standard openrc file:
2626
27-
opts, err := openstack.AuthOptionsFromEnv()
28-
provider, err := openstack.AuthenticatedClient(opts)
27+
opts, err := openstack.AuthOptionsFromEnv()
28+
provider, err := openstack.AuthenticatedClient(opts)
2929
*/
3030
type AuthOptions struct {
3131
// IdentityEndpoint specifies the HTTP endpoint that is required to work with

Diff for: doc.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package gophercloud provides a multi-vendor interface to OpenStack-compatible
33
clouds. The library has a three-level hierarchy: providers, services, and
44
resources.
55
6-
Authenticating with Providers
6+
# Authenticating with Providers
77
88
Provider structs represent the cloud providers that offer and manage a
99
collection of services. You will generally want to create one Provider
@@ -49,7 +49,7 @@ instead of "project".
4949
opts, err := openstack.AuthOptionsFromEnv()
5050
provider, err := openstack.AuthenticatedClient(opts)
5151
52-
Service Clients
52+
# Service Clients
5353
5454
Service structs are specific to a provider and handle all of the logic and
5555
operations for a particular OpenStack service. Examples of services include:
@@ -60,7 +60,7 @@ pass in the parent provider, like so:
6060
6161
client, err := openstack.NewComputeV2(provider, opts)
6262
63-
Resources
63+
# Resources
6464
6565
Resource structs are the domain models that services make use of in order
6666
to work with and represent the state of API resources:
@@ -144,6 +144,5 @@ An example retry backoff function, which respects the 429 HTTP response code and
144144
145145
return nil
146146
}
147-
148147
*/
149148
package gophercloud

Diff for: docs/contributor-tutorial/.template/doc.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/*
22
Package NAME manages and retrieves RESOURCE in the OpenStack SERVICE Service.
33
4-
Example to List RESOURCE
4+
# Example to List RESOURCE
55
6-
Example to Create a RESOURCE
6+
# Example to Create a RESOURCE
77
8-
Example to Update a RESOURCE
8+
# Example to Update a RESOURCE
99
1010
Example to Delete a RESOURCE
11-
1211
*/
1312
package RESOURCE

Diff for: openstack/baremetal/apiversions/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ Package apiversions provides information about the versions supported by a speci
1818
if err != nil {
1919
panic("unable to get API version: " + err.Error())
2020
}
21-
2221
*/
2322
package apiversions

Diff for: openstack/baremetal/httpbasic/doc.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Package httpbasic provides support for http_basic bare metal endpoints.
33
44
Example of obtaining and using a client:
55
6-
client, err := httpbasic.NewBareMetalHTTPBasic(httpbasic.Endpoints{
7-
IronicEndpoing: "http://localhost:6385/v1/",
8-
IronicUser: "myUser",
9-
IronicUserPassword: "myPassword",
10-
})
11-
if err != nil {
12-
panic(err)
13-
}
6+
client, err := httpbasic.NewBareMetalHTTPBasic(httpbasic.Endpoints{
7+
IronicEndpoing: "http://localhost:6385/v1/",
8+
IronicUser: "myUser",
9+
IronicUserPassword: "myPassword",
10+
})
11+
if err != nil {
12+
panic(err)
13+
}
1414
15-
client.Microversion = "1.50"
16-
nodes.ListDetail(client, nodes.listOpts{})
15+
client.Microversion = "1.50"
16+
nodes.ListDetail(client, nodes.listOpts{})
1717
*/
1818
package httpbasic

Diff for: openstack/baremetal/v1/nodes/results.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ type DriverValidation struct {
373373
Reason string `json:"reason"`
374374
}
375375

376-
// Ironic validates whether the Node’s driver has enough information to manage the Node. This polls each interface on
377-
// the driver, and returns the status of that interface as an DriverValidation struct.
376+
// Ironic validates whether the Node’s driver has enough information to manage the Node. This polls each interface on
377+
// the driver, and returns the status of that interface as an DriverValidation struct.
378378
type NodeValidation struct {
379379
BIOS DriverValidation `json:"bios"`
380380
Boot DriverValidation `json:"boot"`

Diff for: openstack/baremetal/v1/ports/doc.go

+54-56
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,83 @@
11
/*
2-
Package ports contains the functionality to Listing, Searching, Creating, Updating,
3-
and Deleting of bare metal Port resources
4-
5-
API reference: https://developer.openstack.org/api-ref/baremetal/#ports-ports
2+
Package ports contains the functionality to Listing, Searching, Creating, Updating,
3+
and Deleting of bare metal Port resources
64
5+
API reference: https://developer.openstack.org/api-ref/baremetal/#ports-ports
76
87
Example to List Ports with Detail
98
10-
ports.ListDetail(client, nil).EachPage(func(page pagination.Page) (bool, error) {
11-
portList, err := ports.ExtractPorts(page)
12-
if err != nil {
13-
return false, err
14-
}
9+
ports.ListDetail(client, nil).EachPage(func(page pagination.Page) (bool, error) {
10+
portList, err := ports.ExtractPorts(page)
11+
if err != nil {
12+
return false, err
13+
}
1514
16-
for _, n := range portList {
17-
// Do something
18-
}
15+
for _, n := range portList {
16+
// Do something
17+
}
1918
20-
return true, nil
21-
})
19+
return true, nil
20+
})
2221
2322
Example to List Ports
2423
25-
listOpts := ports.ListOpts{
26-
Limit: 10,
27-
}
24+
listOpts := ports.ListOpts{
25+
Limit: 10,
26+
}
2827
29-
ports.List(client, listOpts).EachPage(func(page pagination.Page) (bool, error) {
30-
portList, err := ports.ExtractPorts(page)
31-
if err != nil {
32-
return false, err
33-
}
28+
ports.List(client, listOpts).EachPage(func(page pagination.Page) (bool, error) {
29+
portList, err := ports.ExtractPorts(page)
30+
if err != nil {
31+
return false, err
32+
}
3433
35-
for _, n := range portList {
36-
// Do something
37-
}
34+
for _, n := range portList {
35+
// Do something
36+
}
3837
39-
return true, nil
40-
})
38+
return true, nil
39+
})
4140
4241
Example to Create a Port
4342
44-
createOpts := ports.CreateOpts{
45-
NodeUUID: "e8920409-e07e-41bb-8cc1-72acb103e2dd",
46-
Address: "00:1B:63:84:45:E6",
47-
PhysicalNetwork: "my-network",
48-
}
43+
createOpts := ports.CreateOpts{
44+
NodeUUID: "e8920409-e07e-41bb-8cc1-72acb103e2dd",
45+
Address: "00:1B:63:84:45:E6",
46+
PhysicalNetwork: "my-network",
47+
}
4948
50-
createPort, err := ports.Create(client, createOpts).Extract()
51-
if err != nil {
52-
panic(err)
53-
}
49+
createPort, err := ports.Create(client, createOpts).Extract()
50+
if err != nil {
51+
panic(err)
52+
}
5453
5554
Example to Get a Port
5655
57-
showPort, err := ports.Get(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").Extract()
58-
if err != nil {
59-
panic(err)
60-
}
56+
showPort, err := ports.Get(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").Extract()
57+
if err != nil {
58+
panic(err)
59+
}
6160
6261
Example to Update a Port
6362
64-
updateOpts := ports.UpdateOpts{
65-
ports.UpdateOperation{
66-
Op: ReplaceOp,
67-
Path: "/address",
68-
Value: "22:22:22:22:22:22",
69-
},
70-
}
63+
updateOpts := ports.UpdateOpts{
64+
ports.UpdateOperation{
65+
Op: ReplaceOp,
66+
Path: "/address",
67+
Value: "22:22:22:22:22:22",
68+
},
69+
}
7170
72-
updatePort, err := ports.Update(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474", updateOpts).Extract()
73-
if err != nil {
74-
panic(err)
75-
}
71+
updatePort, err := ports.Update(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474", updateOpts).Extract()
72+
if err != nil {
73+
panic(err)
74+
}
7675
7776
Example to Delete a Port
7877
79-
err = ports.Delete(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").ExtractErr()
80-
if err != nil {
81-
panic(err)
82-
}
83-
78+
err = ports.Delete(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").ExtractErr()
79+
if err != nil {
80+
panic(err)
81+
}
8482
*/
8583
package ports

Diff for: openstack/blockstorage/apiversions/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Example of Retrieving all API Versions
1818
fmt.Printf("%+v\n", version)
1919
}
2020
21-
2221
Example of Retrieving an API Version
2322
2423
version, err := apiversions.Get(client, "v3").Extract()

Diff for: openstack/blockstorage/extensions/availabilityzones/doc.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ available volume availability zones.
44
55
Example of Get Availability Zone Information
66
7-
allPages, err := availabilityzones.List(volumeClient).AllPages()
8-
if err != nil {
9-
panic(err)
10-
}
7+
allPages, err := availabilityzones.List(volumeClient).AllPages()
8+
if err != nil {
9+
panic(err)
10+
}
1111
12-
availabilityZoneInfo, err := availabilityzones.ExtractAvailabilityZones(allPages)
13-
if err != nil {
14-
panic(err)
15-
}
12+
availabilityZoneInfo, err := availabilityzones.ExtractAvailabilityZones(allPages)
13+
if err != nil {
14+
panic(err)
15+
}
1616
17-
for _, zoneInfo := range availabilityZoneInfo {
18-
fmt.Printf("%+v\n", zoneInfo)
19-
}
17+
for _, zoneInfo := range availabilityZoneInfo {
18+
fmt.Printf("%+v\n", zoneInfo)
19+
}
2020
*/
2121
package availabilityzones

Diff for: openstack/blockstorage/extensions/limits/doc.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Package limits shows rate and limit information for a project you authorized for
33
44
Example to Retrieve Limits
55
6-
limits, err := limits.Get(blockStorageClient).Extract()
7-
if err != nil {
8-
panic(err)
9-
}
6+
limits, err := limits.Get(blockStorageClient).Extract()
7+
if err != nil {
8+
panic(err)
9+
}
1010
11-
fmt.Printf("%+v\n", limits)
11+
fmt.Printf("%+v\n", limits)
1212
*/
1313
package limits

Diff for: openstack/blockstorage/extensions/quotasets/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Example to Update a Quota set with volume_type quotas
5050
5151
fmt.Printf("%+v\n", quotaset)
5252
53-
5453
Example to Delete a Quota Set
5554
5655
err := quotasets.Delete(blockStorageClient, "project-id").ExtractErr()

Diff for: openstack/blockstorage/extensions/volumeactions/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Example of Attaching a Volume to an Instance
2525
panic(err)
2626
}
2727
28-
2928
Example of Creating an Image from a Volume
3029
3130
uploadImageOpts := volumeactions.UploadImageOpts{

Diff for: openstack/blockstorage/v3/attachments/doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,5 @@ Example to Delete Attachment
8282
if err != nil {
8383
panic(err)
8484
}
85-
8685
*/
8786
package attachments

Diff for: openstack/blockstorage/v3/attachments/requests.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type CreateOptsBuilder interface {
1212
}
1313

1414
// CreateOpts contains options for creating a Volume attachment. This object is
15-
//passed to the Create function. For more information about these parameters,
15+
// passed to the Create function. For more information about these parameters,
1616
// see the Attachment object.
1717
type CreateOpts struct {
1818
// VolumeUUID is the UUID of the Cinder volume to create the attachment

Diff for: openstack/blockstorage/v3/qos/doc.go

-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ Example of updating QoSSpec
7878
}
7979
fmt.Printf("%+v\n", specs)
8080
81-
8281
Example of deleting specific keys/specs from a QoS
8382
8483
qosID := "de075d5e-8afc-4e23-9388-b84a5183d1c0"
@@ -143,6 +142,5 @@ Example of listing all associations of a QoS
143142
for _, association := range allAssociations {
144143
fmt.Printf("Association: %+v\n", association)
145144
}
146-
147145
*/
148146
package qos

0 commit comments

Comments
 (0)