Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
acha-bill committed Nov 29, 2023
1 parent 6fe9ba3 commit de97ab0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 13 additions & 10 deletions cmd/bee/cmd/split.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2023 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cmd

import (
Expand Down Expand Up @@ -54,6 +58,15 @@ func (c *command) initSplitCmd() error {
Use: "split",
Short: "Split a file into a list chunks. The 1st line is the root hash",
RunE: func(cmd *cobra.Command, args []string) error {
inputFileName, err := cmd.Flags().GetString(optionNameInputFile)
if err != nil {
return fmt.Errorf("get input file name: %w", err)
}
outputFileName, err := cmd.Flags().GetString(optionNameOutputFile)
if err != nil {
return fmt.Errorf("get output file name: %w", err)
}

v, err := cmd.Flags().GetString(optionNameVerbosity)
if err != nil {
return fmt.Errorf("get verbosity: %w", err)
Expand All @@ -64,11 +77,6 @@ func (c *command) initSplitCmd() error {
return fmt.Errorf("new logger: %w", err)
}

inputFileName, err := cmd.Flags().GetString(optionNameInputFile)
if err != nil {
return fmt.Errorf("get input file name: %w", err)
}

reader, err := os.Open(inputFileName)
if err != nil {
return fmt.Errorf("open input file: %w", err)
Expand All @@ -88,11 +96,6 @@ func (c *command) initSplitCmd() error {
}
store.rootHash = rootHash.String()

outputFileName, err := cmd.Flags().GetString(optionNameOutputFile)
if err != nil {
return fmt.Errorf("get output file name: %w", err)
}

logger.Info("writing output", "file", outputFileName)
writer, err := os.OpenFile(outputFileName, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions cmd/bee/cmd/split_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2023 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cmd_test

import (
Expand Down

0 comments on commit de97ab0

Please sign in to comment.