Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
0c950877
Unverified
Commit
0c950877
authored
Jul 23, 2019
by
Massimiliano Pippi
Committed by
GitHub
Jul 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove build date from the version (#300)
parent
633e9ab2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
30 deletions
+8
-30
cli/daemon/daemon.go
cli/daemon/daemon.go
+2
-2
cli/globals/globals.go
cli/globals/globals.go
+2
-2
test/test_main.py
test/test_main.py
+0
-1
version/version.go
version/version.go
+4
-21
version/version_test.go
version/version_test.go
+0
-4
No files found.
cli/daemon/daemon.go
View file @
0c950877
...
...
@@ -55,8 +55,8 @@ func runDaemonCommand(cmd *cobra.Command, args []string) {
}
s
:=
grpc
.
NewServer
()
userAgentValue
:=
fmt
.
Sprintf
(
"%s/%s daemon (%s; %s; %s) Commit:%s
/Build:%s
"
,
globals
.
VersionInfo
.
Application
,
globals
.
VersionInfo
.
VersionString
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
(),
globals
.
VersionInfo
.
Commit
,
globals
.
VersionInfo
.
BuildDate
)
userAgentValue
:=
fmt
.
Sprintf
(
"%s/%s daemon (%s; %s; %s) Commit:%s"
,
globals
.
VersionInfo
.
Application
,
globals
.
VersionInfo
.
VersionString
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
(),
globals
.
VersionInfo
.
Commit
)
headers
:=
http
.
Header
{
"User-Agent"
:
[]
string
{
userAgentValue
}}
coreServer
:=
daemon
.
ArduinoCoreServerImpl
{
...
...
cli/globals/globals.go
View file @
0c950877
...
...
@@ -42,8 +42,8 @@ var (
)
func
getHTTPClientHeader
()
http
.
Header
{
userAgentValue
:=
fmt
.
Sprintf
(
"%s/%s (%s; %s; %s) Commit:%s
/Build:%s
"
,
VersionInfo
.
Application
,
VersionInfo
.
VersionString
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
(),
VersionInfo
.
Commit
,
VersionInfo
.
BuildDate
)
userAgentValue
:=
fmt
.
Sprintf
(
"%s/%s (%s; %s; %s) Commit:%s"
,
VersionInfo
.
Application
,
VersionInfo
.
VersionString
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
(),
VersionInfo
.
Commit
)
downloaderHeaders
:=
http
.
Header
{
"User-Agent"
:
[]
string
{
userAgentValue
}}
return
downloaderHeaders
}
test/test_main.py
View file @
0c950877
...
...
@@ -106,4 +106,3 @@ def test_command_version():
assert
parsed_out
.
get
(
'Application'
,
False
)
==
'arduino-cli'
assert
isinstance
(
semver
.
parse
(
parsed_out
.
get
(
'VersionString'
,
False
)),
dict
)
assert
isinstance
(
parsed_out
.
get
(
'Commit'
,
False
),
str
)
assert
datetime
.
strptime
(
parsed_out
.
get
(
'BuildDate'
)[:
-
2
],
'%Y-%m-%dT%H:%M:%S.%f'
)
version/version.go
View file @
0c950877
...
...
@@ -19,34 +19,19 @@ package version
import
(
"fmt"
"time"
)
var
(
defaultVersionString
=
"0.3.7-alpha.preview"
versionString
=
""
commit
=
""
buildDate
=
rfc3339Time
{}
)
type
rfc3339Time
struct
{
time
.
Time
}
func
(
r
rfc3339Time
)
format
()
string
{
return
r
.
Time
.
Format
(
time
.
RFC3339
)
}
func
(
r
rfc3339Time
)
MarshalJSON
()
([]
byte
,
error
)
{
return
[]
byte
(
`"`
+
r
.
format
()
+
`"`
),
nil
}
// Info FIXMEDOC
type
Info
struct
{
Application
string
`json:"Application"`
VersionString
string
`json:"VersionString"`
Commit
string
`json:"Commit"`
BuildDate
rfc3339Time
`json:"BuildDate"`
Application
string
`json:"Application"`
VersionString
string
`json:"VersionString"`
Commit
string
`json:"Commit"`
}
// NewInfo FIXMEDOC
...
...
@@ -55,12 +40,11 @@ func NewInfo(application string) *Info {
Application
:
application
,
VersionString
:
versionString
,
Commit
:
commit
,
BuildDate
:
buildDate
,
}
}
func
(
i
*
Info
)
String
()
string
{
return
fmt
.
Sprintf
(
"%s Version: %s Commit: %s
BuildDate: %s"
,
i
.
Application
,
i
.
VersionString
,
i
.
Commit
,
i
.
BuildDate
.
format
()
)
return
fmt
.
Sprintf
(
"%s Version: %s Commit: %s
"
,
i
.
Application
,
i
.
VersionString
,
i
.
Commit
)
}
//nolint:gochecknoinits
...
...
@@ -68,5 +52,4 @@ func init() {
if
versionString
==
""
{
versionString
=
defaultVersionString
}
buildDate
=
rfc3339Time
{
time
.
Now
()
.
UTC
()}
}
version/version_test.go
View file @
0c950877
...
...
@@ -19,7 +19,6 @@ package version
import
(
"testing"
"time"
"github.com/stretchr/testify/require"
)
...
...
@@ -35,12 +34,9 @@ func TestBuildInjectedInfo(t *testing.T) {
Application
:
goldenAppName
,
VersionString
:
"0.0.0-test.preview"
,
Commit
:
"deadbeef"
,
BuildDate
:
rfc3339Time
{
time
.
Time
{}},
}
info
:=
NewInfo
(
goldenAppName
)
require
.
Equal
(
t
,
goldenInfo
.
Application
,
info
.
Application
)
require
.
Equal
(
t
,
goldenInfo
.
VersionString
,
info
.
VersionString
)
require
.
Equal
(
t
,
goldenInfo
.
Commit
,
info
.
Commit
)
require
.
IsType
(
t
,
rfc3339Time
{
time
.
Time
{}},
info
.
BuildDate
)
require
.
False
(
t
,
info
.
BuildDate
.
IsZero
())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment