We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent39530c0 commit63da3d8Copy full SHA for 63da3d8
cli/core/download.go
@@ -64,7 +64,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
64
Version:platformRef.Version,
65
}
66
_,err:=core.PlatformDownload(context.Background(),platformDownloadreq,output.ProgressBar(),
67
-globals.HTTPClientHeader)
+globals.NewHTTPClientHeader())
68
iferr!=nil {
69
feedback.Errorf("Error downloading %s: %v",args[i],err)
70
os.Exit(errorcodes.ErrNetwork)
cli/core/install.go
@@ -65,7 +65,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
_,err:=core.PlatformInstall(context.Background(),plattformInstallReq,output.ProgressBar(),
-output.TaskProgress(),globals.HTTPClientHeader)
+output.TaskProgress(),globals.NewHTTPClientHeader())
feedback.Errorf("Error during install: %v",err)
71
os.Exit(errorcodes.ErrGeneric)
cli/core/upgrade.go
@@ -90,7 +90,7 @@ func runUpgradeCommand(cmd *cobra.Command, args []string) {
90
Architecture:platformRef.Architecture,
91
92
93
-_,err:=core.PlatformUpgrade(context.Background(),r,output.ProgressBar(),output.TaskProgress(),globals.HTTPClientHeader)
+_,err:=core.PlatformUpgrade(context.Background(),r,output.ProgressBar(),output.TaskProgress(),globals.NewHTTPClientHeader())
94
iferr==core.ErrAlreadyLatest {
95
feedback.Printf("Platform %s is already at the latest version",platformRef)
96
}elseiferr!=nil {
cli/globals/globals.go
@@ -31,8 +31,6 @@ var (
31
Debugbool
32
// OutputFormat can be "text" or "json"
33
OutputFormatstring
34
-// HTTPClientHeader is the object that will be propagated to configure the clients inside the downloaders
35
-HTTPClientHeader=getHTTPClientHeader()
36
// VersionInfo contains all info injected during build
37
VersionInfo=version.NewInfo(filepath.Base(os.Args[0]))
38
// Config FIXMEDOC
@@ -46,9 +44,9 @@ var (
46
44
LogLevelstring
47
45
)
48
49
-funcgetHTTPClientHeader() http.Header {
+// NewHTTPClientHeader returns the http.Header object that must be used by the clients inside the downloaders
+funcNewHTTPClientHeader() http.Header {
50
userAgentValue:=fmt.Sprintf("%s/%s (%s; %s; %s) Commit:%s",VersionInfo.Application,
51
VersionInfo.VersionString,runtime.GOARCH,runtime.GOOS,runtime.Version(),VersionInfo.Commit)
52
-downloaderHeaders:= http.Header{"User-Agent": []string{userAgentValue}}
53
-returndownloaderHeaders
+return http.Header{"User-Agent": []string{userAgentValue}}
54
cli/instance/instance.go
@@ -36,7 +36,7 @@ func initInstance() *rpc.InitResp {
logrus.Info("Initializing package manager")
req:=packageManagerInitReq()
39
-resp,err:=commands.Init(context.Background(),req,output.ProgressBar(),output.TaskProgress(),globals.HTTPClientHeader)
+resp,err:=commands.Init(context.Background(),req,output.ProgressBar(),output.TaskProgress(),globals.NewHTTPClientHeader())
40
41
feedback.Errorf("Error initializing package manager: %v",err)
42
cli/lib/download.go
@@ -60,7 +60,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
60
Version:library.Version,
61
62
_,err:=lib.LibraryDownload(context.Background(),libraryDownloadReq,output.ProgressBar(),
63
feedback.Errorf("Error downloading %s: %v",library,err)
cli/lib/install.go
@@ -60,7 +60,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
err:=lib.LibraryInstall(context.Background(),libraryInstallReq,output.ProgressBar(),
feedback.Errorf("Error installing %s: %v",library,err)
cli/lib/upgrade.go
@@ -50,13 +50,13 @@ func runUpgradeCommand(cmd *cobra.Command, args []string) {
instance:=instance.CreateInstaceIgnorePlatformIndexErrors()
iflen(args)==0 {
-err:=lib.LibraryUpgradeAll(instance.Id,output.ProgressBar(),output.TaskProgress(),globals.HTTPClientHeader)
+err:=lib.LibraryUpgradeAll(instance.Id,output.ProgressBar(),output.TaskProgress(),globals.NewHTTPClientHeader())
55
feedback.Errorf("Error upgrading libraries: %v",err)
56
57
58
}else {
59
-err:=lib.LibraryUpgrade(instance.Id,args,output.ProgressBar(),output.TaskProgress(),globals.HTTPClientHeader)
+err:=lib.LibraryUpgrade(instance.Id,args,output.ProgressBar(),output.TaskProgress(),globals.NewHTTPClientHeader())
commands/board/list.go
@@ -40,7 +40,7 @@ var (
funcapiByVidPid(urlstring) ([]*rpc.BoardListItem,error) {
retVal:= []*rpc.BoardListItem{}
req,_:=http.NewRequest("GET",url,nil)
43
-req.Header=globals.HTTPClientHeader
+req.Header=globals.NewHTTPClientHeader()
req.Header.Set("Content-Type","application/json")
ifres,err:=http.DefaultClient.Do(req);err==nil {