Skip to content

Commit 2447395

Browse files
committed
Fixed RPC_REQUEST_STANDARD_NAME and RPC_REQUEST_RESPONSE_UNIQUE lint warning
There is one error remaining that require a more involved refactoring.
1 parent 208adaf commit 2447395

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2397
-2381
lines changed

cli/board/attach.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func runAttachCommand(cmd *cobra.Command, args []string) {
6464
path = initSketchPath(path)
6565
}
6666

67-
if _, err = board.Attach(context.Background(), &rpc.BoardAttachReq{
67+
if _, err = board.Attach(context.Background(), &rpc.BoardAttachRequest{
6868
Instance: instance,
6969
BoardUri: args[0],
7070
SketchPath: path.String(),

cli/board/details.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func runDetailsCommand(cmd *cobra.Command, args []string) {
6666
fqbn = args[0]
6767
}
6868

69-
res, err := board.Details(context.Background(), &rpc.BoardDetailsReq{
69+
res, err := board.Details(context.Background(), &rpc.BoardDetailsRequest{
7070
Instance: inst,
7171
Fqbn: fqbn,
7272
})

cli/board/listall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func runListAllCommand(cmd *cobra.Command, args []string) {
5656
os.Exit(errorcodes.ErrGeneric)
5757
}
5858

59-
list, err := board.ListAll(context.Background(), &rpc.BoardListAllReq{
59+
list, err := board.ListAll(context.Background(), &rpc.BoardListAllRequest{
6060
Instance: inst,
6161
SearchArgs: args,
6262
IncludeHiddenBoards: showHiddenBoard,

cli/board/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
5858
os.Exit(errorcodes.ErrGeneric)
5959
}
6060

61-
res, err := board.Search(context.Background(), &rpc.BoardSearchReq{
61+
res, err := board.Search(context.Background(), &rpc.BoardSearchRequest{
6262
Instance: inst,
6363
SearchArgs: strings.Join(args, " "),
6464
IncludeHiddenBoards: searchFlags.showHiddenBoard,

cli/burnbootloader/burnbootloader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func run(command *cobra.Command, args []string) {
6666
os.Exit(errorcodes.ErrGeneric)
6767
}
6868

69-
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderReq{
69+
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
7070
Instance: instance,
7171
Fqbn: fqbn,
7272
Port: port,

cli/compile/compile.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func run(cmd *cobra.Command, args []string) {
152152
overrides = o.Overrides
153153
}
154154

155-
compileReq := &rpc.CompileReq{
155+
compileRequest := &rpc.CompileRequest{
156156
Instance: inst,
157157
Fqbn: fqbn,
158158
SketchPath: sketchPath.String(),
@@ -177,13 +177,13 @@ func run(cmd *cobra.Command, args []string) {
177177
verboseCompile := configuration.Settings.GetString("logging.level") == "debug"
178178
var compileRes *rpc.CompileResponse
179179
if output.OutputFormat == "json" {
180-
compileRes, err = compile.Compile(context.Background(), compileReq, compileOut, compileErr, verboseCompile)
180+
compileRes, err = compile.Compile(context.Background(), compileRequest, compileOut, compileErr, verboseCompile)
181181
} else {
182-
compileRes, err = compile.Compile(context.Background(), compileReq, os.Stdout, os.Stderr, verboseCompile)
182+
compileRes, err = compile.Compile(context.Background(), compileRequest, os.Stdout, os.Stderr, verboseCompile)
183183
}
184184

185185
if err == nil && uploadAfterCompile {
186-
uploadReq := &rpc.UploadReq{
186+
uploadRequest := &rpc.UploadRequest{
187187
Instance: inst,
188188
Fqbn: fqbn,
189189
SketchPath: sketchPath.String(),
@@ -198,9 +198,9 @@ func run(cmd *cobra.Command, args []string) {
198198
// TODO: do not print upload output in json mode
199199
uploadOut := new(bytes.Buffer)
200200
uploadErr := new(bytes.Buffer)
201-
_, err = upload.Upload(context.Background(), uploadReq, uploadOut, uploadErr)
201+
_, err = upload.Upload(context.Background(), uploadRequest, uploadOut, uploadErr)
202202
} else {
203-
_, err = upload.Upload(context.Background(), uploadReq, os.Stdout, os.Stderr)
203+
_, err = upload.Upload(context.Background(), uploadRequest, os.Stdout, os.Stderr)
204204
}
205205
if err != nil {
206206
feedback.Errorf("Error during Upload: %v", err)

cli/core/download.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
6060
}
6161

6262
for i, platformRef := range platformsRefs {
63-
platformDownloadreq := &rpc.PlatformDownloadReq{
63+
platformDownloadreq := &rpc.PlatformDownloadRequest{
6464
Instance: inst,
6565
PlatformPackage: platformRef.PackageName,
6666
Architecture: platformRef.Architecture,

cli/core/install.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
9898
}
9999

100100
for _, platformRef := range platformsRefs {
101-
platformInstallReq := &rpc.PlatformInstallReq{
101+
platformInstallRequest := &rpc.PlatformInstallRequest{
102102
Instance: inst,
103103
PlatformPackage: platformRef.PackageName,
104104
Architecture: platformRef.Architecture,
105105
Version: platformRef.Version,
106106
SkipPostInstall: DetectSkipPostInstallValue(),
107107
}
108-
_, err := core.PlatformInstall(context.Background(), platformInstallReq, output.ProgressBar(), output.TaskProgress())
108+
_, err := core.PlatformInstall(context.Background(), platformInstallRequest, output.ProgressBar(), output.TaskProgress())
109109
if err != nil {
110110
feedback.Errorf("Error during install: %v", err)
111111
os.Exit(errorcodes.ErrGeneric)

cli/core/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func runListCommand(cmd *cobra.Command, args []string) {
5757

5858
logrus.Info("Executing `arduino core list`")
5959

60-
platforms, err := core.GetPlatforms(&rpc.PlatformListReq{
60+
platforms, err := core.GetPlatforms(&rpc.PlatformListRequest{
6161
Instance: inst,
6262
UpdatableOnly: listFlags.updatableOnly,
6363
All: listFlags.all,

cli/core/search.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
5858
os.Exit(errorcodes.ErrGeneric)
5959
}
6060

61-
_, err = commands.UpdateIndex(context.Background(), &rpc.UpdateIndexReq{
61+
_, err = commands.UpdateIndex(context.Background(), &rpc.UpdateIndexRequest{
6262
Instance: inst,
6363
}, output.ProgressBar())
6464
if err != nil {
@@ -69,7 +69,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
6969
arguments := strings.ToLower(strings.Join(args, " "))
7070
logrus.Infof("Executing `arduino core search` with args: '%s'", arguments)
7171

72-
resp, err := core.PlatformSearch(&rpc.PlatformSearchReq{
72+
resp, err := core.PlatformSearch(&rpc.PlatformSearchRequest{
7373
Instance: inst,
7474
SearchArgs: arguments,
7575
AllVersions: allVersions,

cli/core/uninstall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
6363
}
6464
}
6565
for _, platformRef := range platformsRefs {
66-
_, err := core.PlatformUninstall(context.Background(), &rpc.PlatformUninstallReq{
66+
_, err := core.PlatformUninstall(context.Background(), &rpc.PlatformUninstallRequest{
6767
Instance: inst,
6868
PlatformPackage: platformRef.PackageName,
6969
Architecture: platformRef.Architecture,

cli/core/update_index.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func runUpdateIndexCommand(cmd *cobra.Command, args []string) {
4545
instance := instance.CreateInstanceIgnorePlatformIndexErrors()
4646
logrus.Info("Executing `arduino core update-index`")
4747

48-
_, err := commands.UpdateIndex(context.Background(), &rpc.UpdateIndexReq{
48+
_, err := commands.UpdateIndex(context.Background(), &rpc.UpdateIndexRequest{
4949
Instance: instance,
5050
}, output.ProgressBar())
5151
if err != nil {

cli/core/upgrade.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func runUpgradeCommand(cmd *cobra.Command, args []string) {
5757

5858
// if no platform was passed, upgrade allthethings
5959
if len(args) == 0 {
60-
targets, err := core.GetPlatforms(&rpc.PlatformListReq{
60+
targets, err := core.GetPlatforms(&rpc.PlatformListRequest{
6161
Instance: inst,
6262
UpdatableOnly: true,
6363
})
@@ -91,7 +91,7 @@ func runUpgradeCommand(cmd *cobra.Command, args []string) {
9191
continue
9292
}
9393

94-
r := &rpc.PlatformUpgradeReq{
94+
r := &rpc.PlatformUpgradeRequest{
9595
Instance: inst,
9696
PlatformPackage: platformRef.PackageName,
9797
Architecture: platformRef.Architecture,

cli/debug/debug.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func run(command *cobra.Command, args []string) {
8181
}
8282
sketchPath := initSketchPath(path)
8383

84-
debugConfigRequested := &dbg.DebugConfigReq{
84+
debugConfigRequested := &dbg.DebugConfigRequest{
8585
Instance: instance,
8686
Fqbn: fqbn,
8787
SketchPath: sketchPath.String(),

cli/instance/instance.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func CreateInstance() (*rpc.Instance, error) {
4848

4949
func getInitResponse() (*rpc.InitResponse, error) {
5050
// invoke Init()
51-
resp, err := commands.Init(context.Background(), &rpc.InitReq{}, output.ProgressBar(), output.TaskProgress())
51+
resp, err := commands.Init(context.Background(), &rpc.InitRequest{}, output.ProgressBar(), output.TaskProgress())
5252

5353
// Init() failed
5454
if err != nil {
@@ -66,7 +66,7 @@ func getInitResponse() (*rpc.InitResponse, error) {
6666

6767
// update all indexes
6868
err := commands.UpdateLibrariesIndex(context.Background(),
69-
&rpc.UpdateLibrariesIndexReq{Instance: resp.GetInstance()}, output.ProgressBar())
69+
&rpc.UpdateLibrariesIndexRequest{Instance: resp.GetInstance()}, output.ProgressBar())
7070
if err != nil {
7171
return nil, errors.Wrap(err, "updating the library index")
7272
}
@@ -95,7 +95,7 @@ func getInitResponse() (*rpc.InitResponse, error) {
9595
if packageIndex.NotExist() {
9696
// update platform index
9797
_, err := commands.UpdateIndex(context.Background(),
98-
&rpc.UpdateIndexReq{Instance: resp.GetInstance()}, output.ProgressBar())
98+
&rpc.UpdateIndexRequest{Instance: resp.GetInstance()}, output.ProgressBar())
9999
if err != nil {
100100
return nil, errors.Wrap(err, "updating the core index")
101101
}

cli/lib/args.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func ParseLibraryReferenceArgs(args []string) ([]*LibraryReferenceArg, error) {
7676
// library and possibly adjust the case of the name to match a library in the index
7777
func ParseLibraryReferenceArgAndAdjustCase(instance *rpc.Instance, arg string) (*LibraryReferenceArg, error) {
7878
libRef, err := ParseLibraryReferenceArg(arg)
79-
res, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchReq{
79+
res, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
8080
Instance: instance,
8181
Query: libRef.Name,
8282
})

cli/lib/check_deps.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func runDepsCommand(cmd *cobra.Command, args []string) {
5151
os.Exit(errorcodes.ErrBadArgument)
5252
}
5353

54-
deps, err := lib.LibraryResolveDependencies(context.Background(), &rpc.LibraryResolveDependenciesReq{
54+
deps, err := lib.LibraryResolveDependencies(context.Background(), &rpc.LibraryResolveDependenciesRequest{
5555
Instance: instance,
5656
Name: libRef.Name,
5757
Version: libRef.Version,

cli/lib/download.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
5151
}
5252

5353
for _, library := range refs {
54-
libraryDownloadReq := &rpc.LibraryDownloadReq{
54+
libraryDownloadRequest := &rpc.LibraryDownloadRequest{
5555
Instance: instance,
5656
Name: library.Name,
5757
Version: library.Version,
5858
}
59-
_, err := lib.LibraryDownload(context.Background(), libraryDownloadReq, output.ProgressBar())
59+
_, err := lib.LibraryDownload(context.Background(), libraryDownloadRequest, output.ProgressBar())
6060
if err != nil {
6161
feedback.Errorf("Error downloading %s: %v", library, err)
6262
os.Exit(errorcodes.ErrNetwork)

cli/lib/examples.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func runExamplesCommand(cmd *cobra.Command, args []string) {
5959
name = args[0]
6060
}
6161

62-
res, err := lib.LibraryList(context.Background(), &rpc.LibraryListReq{
62+
res, err := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{
6363
Instance: instance,
6464
All: true,
6565
Name: name,

cli/lib/install.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
7676

7777
if installFlags.zipPath {
7878
for _, path := range args {
79-
err := lib.ZipLibraryInstall(context.Background(), &rpc.ZipLibraryInstallReq{
79+
err := lib.ZipLibraryInstall(context.Background(), &rpc.ZipLibraryInstallRequest{
8080
Instance: instance,
8181
Path: path,
8282
Overwrite: true,
@@ -99,7 +99,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
9999
}
100100
url = wd.String()
101101
}
102-
err := lib.GitLibraryInstall(context.Background(), &rpc.GitLibraryInstallReq{
102+
err := lib.GitLibraryInstall(context.Background(), &rpc.GitLibraryInstallRequest{
103103
Instance: instance,
104104
Url: url,
105105
Overwrite: true,
@@ -119,13 +119,13 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
119119
}
120120

121121
for _, libRef := range libRefs {
122-
libraryInstallReq := &rpc.LibraryInstallReq{
122+
libraryInstallRequest := &rpc.LibraryInstallRequest{
123123
Instance: instance,
124124
Name: libRef.Name,
125125
Version: libRef.Version,
126126
NoDeps: installFlags.noDeps,
127127
}
128-
err := lib.LibraryInstall(context.Background(), libraryInstallReq, output.ProgressBar(), output.TaskProgress())
128+
err := lib.LibraryInstall(context.Background(), libraryInstallRequest, output.ProgressBar(), output.TaskProgress())
129129
if err != nil {
130130
feedback.Errorf("Error installing %s: %v", libRef.Name, err)
131131
os.Exit(errorcodes.ErrGeneric)

cli/lib/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func runListCommand(cmd *cobra.Command, args []string) {
6464
name = args[0]
6565
}
6666

67-
res, err := lib.LibraryList(context.Background(), &rpc.LibraryListReq{
67+
res, err := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{
6868
Instance: instance,
6969
All: listFlags.all,
7070
Updatable: listFlags.updatable,

cli/lib/search.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var searchFlags struct {
5454
func runSearchCommand(cmd *cobra.Command, args []string) {
5555
instance := instance.CreateInstanceIgnorePlatformIndexErrors()
5656

57-
err := commands.UpdateLibrariesIndex(context.Background(), &rpc.UpdateLibrariesIndexReq{
57+
err := commands.UpdateLibrariesIndex(context.Background(), &rpc.UpdateLibrariesIndexRequest{
5858
Instance: instance,
5959
}, output.ProgressBar())
6060
if err != nil {
@@ -63,7 +63,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
6363
}
6464

6565
logrus.Info("Executing `arduino lib search`")
66-
searchResp, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchReq{
66+
searchResp, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
6767
Instance: instance,
6868
Query: (strings.Join(args, " ")),
6969
})

cli/lib/uninstall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
5252
}
5353

5454
for _, library := range refs {
55-
err := lib.LibraryUninstall(context.Background(), &rpc.LibraryUninstallReq{
55+
err := lib.LibraryUninstall(context.Background(), &rpc.LibraryUninstallRequest{
5656
Instance: instance,
5757
Name: library.Name,
5858
Version: library.Version,

cli/lib/update_index.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func initUpdateIndexCommand() *cobra.Command {
3737
Args: cobra.NoArgs,
3838
Run: func(cmd *cobra.Command, args []string) {
3939
instance := instance.CreateInstanceIgnorePlatformIndexErrors()
40-
err := commands.UpdateLibrariesIndex(context.Background(), &rpc.UpdateLibrariesIndexReq{
40+
err := commands.UpdateLibrariesIndex(context.Background(), &rpc.UpdateLibrariesIndexRequest{
4141
Instance: instance,
4242
}, output.ProgressBar())
4343
if err != nil {

cli/outdated/outdated.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func runOutdatedCommand(cmd *cobra.Command, args []string) {
5353

5454
logrus.Info("Executing `arduino outdated`")
5555

56-
outdatedResp, err := commands.Outdated(context.Background(), &rpc.OutdatedReq{
56+
outdatedResp, err := commands.Outdated(context.Background(), &rpc.OutdatedRequest{
5757
Instance: inst,
5858
})
5959
if err != nil {

cli/sketch/archive.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func runArchiveCommand(cmd *cobra.Command, args []string) {
7474
}
7575

7676
_, err := sketch.ArchiveSketch(context.Background(),
77-
&rpc.ArchiveSketchReq{
77+
&rpc.ArchiveSketchRequest{
7878
SketchPath: sketchPath,
7979
ArchivePath: archivePath,
8080
IncludeBuildDir: includeBuildDir,

cli/update/update.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func runUpdateCommand(cmd *cobra.Command, args []string) {
5353

5454
logrus.Info("Executing `arduino update`")
5555

56-
err := commands.UpdateCoreLibrariesIndex(context.Background(), &rpc.UpdateCoreLibrariesIndexReq{
56+
err := commands.UpdateCoreLibrariesIndex(context.Background(), &rpc.UpdateCoreLibrariesIndexRequest{
5757
Instance: instance,
5858
}, output.ProgressBar())
5959
if err != nil {
@@ -62,7 +62,7 @@ func runUpdateCommand(cmd *cobra.Command, args []string) {
6262
}
6363

6464
if updateFlags.showOutdated {
65-
outdatedResp, err := commands.Outdated(context.Background(), &rpc.OutdatedReq{
65+
outdatedResp, err := commands.Outdated(context.Background(), &rpc.OutdatedRequest{
6666
Instance: instance,
6767
})
6868
if err != nil {

cli/upgrade/upgrade.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func runUpgradeCommand(cmd *cobra.Command, args []string) {
5454

5555
logrus.Info("Executing `arduino upgrade`")
5656

57-
err = commands.Upgrade(context.Background(), &rpc.UpgradeReq{
57+
err = commands.Upgrade(context.Background(), &rpc.UpgradeRequest{
5858
Instance: inst,
5959
SkipPostInstall: core.DetectSkipPostInstallValue(),
6060
}, output.NewDownloadProgressBarCB(), output.TaskProgress())

cli/upload/upload.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func run(command *cobra.Command, args []string) {
9191
}
9292
}
9393

94-
if _, err := upload.Upload(context.Background(), &rpc.UploadReq{
94+
if _, err := upload.Upload(context.Background(), &rpc.UploadRequest{
9595
Instance: instance,
9696
Fqbn: fqbn,
9797
SketchPath: sketchPath.String(),

commands/board/attach.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
// Attach FIXMEDOC
36-
func Attach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskProgressCB) (*rpc.BoardAttachResponse, error) {
36+
func Attach(ctx context.Context, req *rpc.BoardAttachRequest, taskCB commands.TaskProgressCB) (*rpc.BoardAttachResponse, error) {
3737
pm := commands.GetPackageManager(req.GetInstance().GetId())
3838
if pm == nil {
3939
return nil, errors.New("invalid instance")

0 commit comments

Comments
 (0)