Commit cac4ca7f authored by Janos Guljas's avatar Janos Guljas

fix lint warnings

parent 4ef1d3f5
package cmd_test package cmd_test
import ( import (
"errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"testing" "testing"
"time"
"github.com/janos/bee/cmd/bee/cmd" "github.com/janos/bee/cmd/bee/cmd"
) )
var homeDir string var homeDir string
var errTest = errors.New("test error")
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
dir, err := ioutil.TempDir("", "bee-cmd-") dir, err := ioutil.TempDir("", "bee-cmd-")
if err != nil { if err != nil {
...@@ -37,13 +33,3 @@ func newCommand(t *testing.T, opts ...cmd.Option) (c *cmd.Command) { ...@@ -37,13 +33,3 @@ func newCommand(t *testing.T, opts ...cmd.Option) (c *cmd.Command) {
} }
return c return c
} }
func newTime(t *testing.T, s string) (tm time.Time) {
t.Helper()
tm, err := time.Parse(time.RFC3339Nano, s)
if err != nil {
t.Fatal(err)
}
return tm
}
...@@ -11,11 +11,11 @@ var ( ...@@ -11,11 +11,11 @@ var (
NewCommand = newCommand NewCommand = newCommand
) )
func WithCfgFile(f string) func(c *Command) { // func WithCfgFile(f string) func(c *Command) {
return func(c *Command) { // return func(c *Command) {
c.cfgFile = f // c.cfgFile = f
} // }
} // }
func WithHomeDir(dir string) func(c *Command) { func WithHomeDir(dir string) func(c *Command) {
return func(c *Command) { return func(c *Command) {
...@@ -29,11 +29,11 @@ func WithArgs(a ...string) func(c *Command) { ...@@ -29,11 +29,11 @@ func WithArgs(a ...string) func(c *Command) {
} }
} }
func WithInput(r io.Reader) func(c *Command) { // func WithInput(r io.Reader) func(c *Command) {
return func(c *Command) { // return func(c *Command) {
c.root.SetIn(r) // c.root.SetIn(r)
} // }
} // }
func WithOutput(w io.Writer) func(c *Command) { func WithOutput(w io.Writer) func(c *Command) {
return func(c *Command) { return func(c *Command) {
...@@ -41,8 +41,8 @@ func WithOutput(w io.Writer) func(c *Command) { ...@@ -41,8 +41,8 @@ func WithOutput(w io.Writer) func(c *Command) {
} }
} }
func WithErrorOutput(w io.Writer) func(c *Command) { // func WithErrorOutput(w io.Writer) func(c *Command) {
return func(c *Command) { // return func(c *Command) {
c.root.SetErr(w) // c.root.SetErr(w)
} // }
} // }
...@@ -74,7 +74,9 @@ func (c *command) initStartCmd() (err error) { ...@@ -74,7 +74,9 @@ func (c *command) initStartCmd() (err error) {
cmd.Flags().String(optionNameListen, ":8500", "HTTP API listen address") cmd.Flags().String(optionNameListen, ":8500", "HTTP API listen address")
c.config.BindPFlags(cmd.Flags()) if err := c.config.BindPFlags(cmd.Flags()); err != nil {
return err
}
c.root.AddCommand(cmd) c.root.AddCommand(cmd)
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment