[#772] node: Apply gofumpt

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-10-31 14:56:55 +03:00
parent 00aa6d9749
commit 79088baa06
136 changed files with 293 additions and 239 deletions

View file

@ -106,7 +106,7 @@ func createEACL(cmd *cobra.Command, _ []string) {
return
}
err = os.WriteFile(outArg, buf.Bytes(), 0644)
err = os.WriteFile(outArg, buf.Bytes(), 0o644)
if err != nil {
cmd.PrintErrln(err)
os.Exit(1)

View file

@ -130,6 +130,6 @@ func createToken(cmd *cobra.Command, _ []string) {
}
out, _ := cmd.Flags().GetString(outFlag)
err = os.WriteFile(out, data, 0644)
err = os.WriteFile(out, data, 0o644)
commonCmd.ExitOnErr(cmd, "can't write token to file: %w", err)
}

View file

@ -51,7 +51,7 @@ var getContainerInfoCmd = &cobra.Command{
data = cnr.Marshal()
}
err = os.WriteFile(containerPathTo, data, 0644)
err = os.WriteFile(containerPathTo, data, 0o644)
commonCmd.ExitOnErr(cmd, "can't write container to file: %w", err)
}
},

View file

@ -52,7 +52,7 @@ var getExtendedACLCmd = &cobra.Command{
cmd.Println("dumping data to file:", containerPathTo)
err = os.WriteFile(containerPathTo, data, 0644)
err = os.WriteFile(containerPathTo, data, 0o644)
commonCmd.ExitOnErr(cmd, "could not write eACL to file: %w", err)
},
}

View file

@ -20,7 +20,7 @@ var containerNodesCmd = &cobra.Command{
Short: "Show nodes for container",
Long: "Show nodes taking part in a container at the current epoch.",
Run: func(cmd *cobra.Command, args []string) {
var cnr, pkey = getContainer(cmd)
cnr, pkey := getContainer(cmd)
if pkey == nil {
pkey = key.GetOrGenerate(cmd)

View file

@ -132,7 +132,7 @@ func createOutWriter(cmd *cobra.Command, filename string) (out io.Writer, closer
out = os.Stdout
closer = func() {}
} else {
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o644)
if err != nil {
commonCmd.ExitOnErr(cmd, "", fmt.Errorf("can't open file '%s': %w", filename, err))
}

View file

@ -191,7 +191,7 @@ func getRequiredPlacement(cmd *cobra.Command, objInfo *objectNodesInfo, placemen
numOfReplicas := placementPolicy.ReplicaNumberByIndex(repIdx)
var nodeIdx uint32
for _, n := range rep {
if !objInfo.isLock && nodeIdx == numOfReplicas { //lock object should be on all container nodes
if !objInfo.isLock && nodeIdx == numOfReplicas { // lock object should be on all container nodes
break
}
nodes[n.Hash()] = n
@ -213,7 +213,8 @@ func getRequiredPlacement(cmd *cobra.Command, objInfo *objectNodesInfo, placemen
}
func getActualPlacement(cmd *cobra.Command, netmap *netmapSDK.NetMap, requiredPlacement map[uint64]netmapSDK.NodeInfo,
pk *ecdsa.PrivateKey, objInfo *objectNodesInfo) map[uint64]boolError {
pk *ecdsa.PrivateKey, objInfo *objectNodesInfo,
) map[uint64]boolError {
result := make(map[uint64]boolError)
resultMtx := &sync.Mutex{}

View file

@ -31,7 +31,8 @@ func init() {
objectHashCmd,
objectRangeCmd,
objectLockCmd,
objectNodesCmd}
objectNodesCmd,
}
Cmd.AddCommand(objectChildCommands...)

View file

@ -81,7 +81,7 @@ func createSession(cmd *cobra.Command, _ []string) {
}
filename, _ := cmd.Flags().GetString(outFlag)
err = os.WriteFile(filename, data, 0644)
err = os.WriteFile(filename, data, 0o644)
commonCmd.ExitOnErr(cmd, "can't write token to file: %w", err)
}

View file

@ -48,7 +48,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) {
return
}
err = os.WriteFile(to, data, 0644)
err = os.WriteFile(to, data, 0o644)
commonCmd.ExitOnErr(cmd, "can't write exteded ACL table to file: %w", err)
cmd.Printf("extended ACL table was successfully dumped to %s\n", to)

View file

@ -78,7 +78,7 @@ func keyerGenerate(filename string, d *keyer.Dashboard) error {
}
if filename != "" {
return os.WriteFile(filename, key, 0600)
return os.WriteFile(filename, key, 0o600)
}
return nil

View file

@ -56,7 +56,7 @@ func signBearerToken(cmd *cobra.Command, _ []string) {
return
}
err = os.WriteFile(to, data, 0644)
err = os.WriteFile(to, data, 0o644)
commonCmd.ExitOnErr(cmd, "can't write signed bearer token to file: %w", err)
cmd.Printf("signed bearer token was successfully dumped to %s\n", to)

View file

@ -76,7 +76,7 @@ func signSessionToken(cmd *cobra.Command, _ []string) {
return
}
err = os.WriteFile(to, data, 0644)
err = os.WriteFile(to, data, 0o644)
if err != nil {
commonCmd.ExitOnErr(cmd, "", fmt.Errorf("can't write signed session token to %s: %w", to, err))
}