Skip to content

Commit 4bb4c59

Browse files
committed
Fixed linter warnings
1 parent efa1fa7 commit 4bb4c59

File tree

16 files changed

+27
-27
lines changed

16 files changed

+27
-27
lines changed

cli/board/attach.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func runAttachCommand(cmd *cobra.Command, args []string) {
5757
if len(args) > 0 {
5858
path = args[1]
5959
}
60-
_, err := board.BoardAttach(context.Background(), &rpc.BoardAttachReq{
60+
_, err := board.Attach(context.Background(), &rpc.BoardAttachReq{
6161
Instance: instance,
6262
BoardUri: args[0],
6363
SketchPath: path,

cli/board/details.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func initDetailsCommand() *cobra.Command {
4545
func runDetailsCommand(cmd *cobra.Command, args []string) {
4646
instance := cli.CreateInstance()
4747

48-
res, err := board.BoardDetails(context.Background(), &rpc.BoardDetailsReq{
48+
res, err := board.Details(context.Background(), &rpc.BoardDetailsReq{
4949
Instance: instance,
5050
Fqbn: args[0],
5151
})

cli/board/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func runListCommand(cmd *cobra.Command, args []string) {
6262
time.Sleep(timeout)
6363
}
6464

65-
resp, err := board.BoardList(context.Background(), &rpc.BoardListReq{Instance: instance})
65+
resp, err := board.List(context.Background(), &rpc.BoardListReq{Instance: instance})
6666
if err != nil {
6767
formatter.PrintError(err, "Error detecting boards")
6868
os.Exit(cli.ErrNetwork)

cli/board/listall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func initListAllCommand() *cobra.Command {
5151
func runListAllCommand(cmd *cobra.Command, args []string) {
5252
instance := cli.CreateInstance()
5353

54-
list, err := board.BoardListAll(context.Background(), &rpc.BoardListAllReq{
54+
list, err := board.ListAll(context.Background(), &rpc.BoardListAllReq{
5555
Instance: instance,
5656
SearchArgs: args,
5757
})

cli/cli_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,11 @@ board_manager:
576576
require.NoError(t, err, "Writing empty json index file")
577577

578578
// Empty cores list
579-
exitCode, d := executeWithArgs(t, "--config-file", configFile.String(), "core", "list")
579+
exitCode, _ := executeWithArgs(t, "--config-file", configFile.String(), "core", "list")
580580
require.Zero(t, exitCode, "exit code")
581581

582582
// Dump config with cmd-line specific file
583-
exitCode, d = executeWithArgs(t, "--config-file", configFile.String(), "config", "dump")
583+
exitCode, d := executeWithArgs(t, "--config-file", configFile.String(), "config", "dump")
584584
require.Zero(t, exitCode, "exit code")
585585
require.Contains(t, string(d), "- http://www.invalid-domain-asjkdakdhadjkh.com/package_example_index.json")
586586

cli/daemon/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"google.golang.org/grpc"
3030
)
3131

32-
// InitCommand initalize the command
32+
// InitCommand initialize the command
3333
func InitCommand() *cobra.Command {
3434
cmd := &cobra.Command{
3535
Use: "daemon",

cli/root/root.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ import (
2929
"github.com/arduino/arduino-cli/cli/daemon"
3030
"github.com/arduino/arduino-cli/cli/lib"
3131
"github.com/arduino/arduino-cli/cli/upload"
32+
"github.com/arduino/arduino-cli/cli/version"
3233
"github.com/arduino/arduino-cli/commands/config"
3334
"github.com/arduino/arduino-cli/commands/generatedocs"
3435
"github.com/arduino/arduino-cli/commands/sketch"
35-
"github.com/arduino/arduino-cli/cli/version"
3636
"github.com/arduino/arduino-cli/common/formatter"
3737
"github.com/arduino/arduino-cli/configs"
3838
paths "github.com/arduino/go-paths-helper"
@@ -42,7 +42,7 @@ import (
4242
"golang.org/x/crypto/ssh/terminal"
4343
)
4444

45-
// Init prepares the cobra root command.
45+
// Init prepares the cobra root command.
4646
func Init() *cobra.Command {
4747
command := &cobra.Command{
4848
Use: "arduino-cli",

commands/board/attach.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
paths "github.com/arduino/go-paths-helper"
3535
)
3636

37-
func BoardAttach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskProgressCB) (*rpc.BoardAttachResp, error) {
37+
func Attach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskProgressCB) (*rpc.BoardAttachResp, error) {
3838

3939
pm := commands.GetPackageManager(req)
4040
if pm == nil {

commands/board/details.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/arduino/arduino-cli/rpc"
2828
)
2929

30-
func BoardDetails(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsResp, error) {
30+
func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsResp, error) {
3131
pm := commands.GetPackageManager(req)
3232
if pm == nil {
3333
return nil, errors.New("invalid instance")

commands/board/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/arduino/arduino-cli/rpc"
2727
)
2828

29-
func BoardList(ctx context.Context, req *rpc.BoardListReq) (*rpc.BoardListResp, error) {
29+
func List(ctx context.Context, req *rpc.BoardListReq) (*rpc.BoardListResp, error) {
3030
pm := commands.GetPackageManager(req)
3131
if pm == nil {
3232
return nil, errors.New("invalid instance")

commands/board/listall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/arduino/arduino-cli/rpc"
2727
)
2828

29-
func BoardListAll(ctx context.Context, req *rpc.BoardListAllReq) (*rpc.BoardListAllResp, error) {
29+
func ListAll(ctx context.Context, req *rpc.BoardListAllReq) (*rpc.BoardListAllResp, error) {
3030
pm := commands.GetPackageManager(req)
3131
if pm == nil {
3232
return nil, errors.New("invalid instance")

commands/core/download.go

-1
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ func downloadTool(pm *packagemanager.PackageManager, tool *cores.ToolRelease, do
8080

8181
return commands.DownloadToolRelease(pm, tool, downloadCB)
8282
}
83-

commands/instances.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ func Rescan(ctx context.Context, req *rpc.RescanReq) (*rpc.RescanResp, error) {
305305
}, nil
306306
}
307307

308-
func createInstance(ctx context.Context, config *configs.Configuration, getLibOnly bool) (*packagemanager.PackageManager, *librariesmanager.LibrariesManager, []string, string, error) {
308+
func createInstance(ctx context.Context, config *configs.Configuration, getLibOnly bool) (
309+
*packagemanager.PackageManager, *librariesmanager.LibrariesManager, []string, string, error) {
309310
var pm *packagemanager.PackageManager
310311
platformIndexErrors := []string{}
311312
if !getLibOnly {

commands/upload/upload.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr
5555
// FIXME: make a specification on how a port is specified via command line
5656
port := req.GetPort()
5757
if port == "" {
58-
return nil, fmt.Errorf("No port provided")
58+
return nil, fmt.Errorf("no upload port provided")
5959
}
6060

6161
fqbnIn := req.GetFqbn()
6262
if fqbnIn == "" && sketch != nil && sketch.Metadata != nil {
6363
fqbnIn = sketch.Metadata.CPU.Fqbn
6464
}
6565
if fqbnIn == "" {
66-
return nil, fmt.Errorf("No Fully Qualified Board Name provided")
66+
return nil, fmt.Errorf("no Fully Qualified Board Name provided")
6767
}
6868
fqbn, err := cores.ParseFQBN(fqbnIn)
6969
if err != nil {
@@ -170,9 +170,8 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr
170170
if _, err := uploadFile.Stat(); err != nil {
171171
if os.IsNotExist(err) {
172172
return nil, fmt.Errorf("compiled sketch %s not found", uploadFile.String())
173-
} else {
174-
return nil, fmt.Errorf("cannot open sketch: %s", err)
175173
}
174+
return nil, fmt.Errorf("cannot open sketch: %s", err)
176175
}
177176

178177
// Perform reset via 1200bps touch if requested

daemon/daemon.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ func runDaemonCommand(cmd *cobra.Command, args []string) {
5858
type ArduinoCoreServerImpl struct{}
5959

6060
func (s *ArduinoCoreServerImpl) BoardDetails(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsResp, error) {
61-
return board.BoardDetails(ctx, req)
61+
return board.Details(ctx, req)
6262
}
6363

6464
func (s *ArduinoCoreServerImpl) BoardList(ctx context.Context, req *rpc.BoardListReq) (*rpc.BoardListResp, error) {
65-
return board.BoardList(ctx, req)
65+
return board.List(ctx, req)
6666
}
6767

6868
func (s *ArduinoCoreServerImpl) BoardListAll(ctx context.Context, req *rpc.BoardListAllReq) (*rpc.BoardListAllResp, error) {
69-
return board.BoardListAll(ctx, req)
69+
return board.ListAll(ctx, req)
7070
}
7171

7272
func (s *ArduinoCoreServerImpl) BoardAttach(req *rpc.BoardAttachReq, stream rpc.ArduinoCore_BoardAttachServer) error {
7373

74-
resp, err := board.BoardAttach(stream.Context(), req,
74+
resp, err := board.Attach(stream.Context(), req,
7575
func(p *rpc.TaskProgress) { stream.Send(&rpc.BoardAttachResp{TaskProgress: p}) },
7676
)
7777
if err != nil {
@@ -207,10 +207,10 @@ func feedStream(streamer func(data []byte)) io.Writer {
207207
go func() {
208208
data := make([]byte, 1024)
209209
for {
210-
if n, err := r.Read(data); err != nil {
211-
return
212-
} else {
210+
if n, err := r.Read(data); err == nil {
213211
streamer(data[:n])
212+
} else {
213+
return
214214
}
215215
}
216216
}()

output/output.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ import (
2121
colorable "github.com/mattn/go-colorable"
2222
)
2323

24-
var colorStdout = colorable.NewColorableStdout()
24+
// TODO: Feed text output into colorable stdOut
25+
var _ = colorable.NewColorableStdout()

0 commit comments

Comments
 (0)