Formatting the code with https://github.com/mvdan/gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -140,7 +140,7 @@ type attacher struct {
|
| 140 | 140 |
// New creates a new Cluster instance using provided config. |
| 141 | 141 |
func New(config Config) (*Cluster, error) {
|
| 142 | 142 |
root := filepath.Join(config.Root, swarmDirName) |
| 143 |
- if err := os.MkdirAll(root, 0700); err != nil {
|
|
| 143 |
+ if err := os.MkdirAll(root, 0o700); err != nil {
|
|
| 144 | 144 |
return nil, err |
| 145 | 145 |
} |
| 146 | 146 |
if config.RuntimeRoot == "" {
|
| ... | ... |
@@ -154,7 +154,7 @@ func New(config Config) (*Cluster, error) {
|
| 154 | 154 |
config.RaftElectionTick = 10 * config.RaftHeartbeatTick |
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 |
- if err := os.MkdirAll(config.RuntimeRoot, 0700); err != nil {
|
|
| 157 |
+ if err := os.MkdirAll(config.RuntimeRoot, 0o700); err != nil {
|
|
| 158 | 158 |
return nil, err |
| 159 | 159 |
} |
| 160 | 160 |
c := &Cluster{
|
| ... | ... |
@@ -118,7 +118,8 @@ func endpointFromGRPC(e *swarmapi.Endpoint) types.Endpoint {
|
| 118 | 118 |
for _, v := range e.VirtualIPs {
|
| 119 | 119 |
endpoint.VirtualIPs = append(endpoint.VirtualIPs, types.EndpointVirtualIP{
|
| 120 | 120 |
NetworkID: v.NetworkID, |
| 121 |
- Addr: v.Addr}) |
|
| 121 |
+ Addr: v.Addr, |
|
| 122 |
+ }) |
|
| 122 | 123 |
} |
| 123 | 124 |
} |
| 124 | 125 |
|
| ... | ... |
@@ -15,12 +15,12 @@ func TestNodeCSIInfoFromGRPC(t *testing.T) {
|
| 15 | 15 |
ID: "someID", |
| 16 | 16 |
Description: &swarmapi.NodeDescription{
|
| 17 | 17 |
CSIInfo: []*swarmapi.NodeCSIInfo{
|
| 18 |
- &swarmapi.NodeCSIInfo{
|
|
| 18 |
+ {
|
|
| 19 | 19 |
PluginName: "plugin1", |
| 20 | 20 |
NodeID: "p1n1", |
| 21 | 21 |
MaxVolumesPerNode: 1, |
| 22 | 22 |
}, |
| 23 |
- &swarmapi.NodeCSIInfo{
|
|
| 23 |
+ {
|
|
| 24 | 24 |
PluginName: "plugin2", |
| 25 | 25 |
NodeID: "p2n1", |
| 26 | 26 |
MaxVolumesPerNode: 2, |
| ... | ... |
@@ -412,7 +412,7 @@ func (c *containerAdapter) wait(ctx context.Context) (<-chan containerpkg.StateS |
| 412 | 412 |
} |
| 413 | 413 |
|
| 414 | 414 |
func (c *containerAdapter) shutdown(ctx context.Context) error {
|
| 415 |
- var options = containertypes.StopOptions{}
|
|
| 415 |
+ options := containertypes.StopOptions{}
|
|
| 416 | 416 |
// Default stop grace period to nil (daemon will use the stopTimeout of the container) |
| 417 | 417 |
if spec := c.container.spec(); spec.StopGracePeriod != nil {
|
| 418 | 418 |
timeout := int(spec.StopGracePeriod.Seconds) |
| ... | ... |
@@ -32,7 +32,7 @@ func savePersistentState(root string, config nodeStartConfig) error {
|
| 32 | 32 |
if err != nil {
|
| 33 | 33 |
return err |
| 34 | 34 |
} |
| 35 |
- return ioutils.AtomicWriteFile(filepath.Join(root, stateFile), dt, 0600) |
|
| 35 |
+ return ioutils.AtomicWriteFile(filepath.Join(root, stateFile), dt, 0o600) |
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
func clearPersistentState(root string) error {
|