Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
beaver
Commits
82eca81e3dcd
Commit
82eca81e3dcd
authored
2 years ago
by
steeve.chailloux
Browse files
Options
Downloads
Patches
Plain Diff
improved version command
parent
dc69dd959c5b
No related branches found
No related tags found
No related merge requests found
Pipeline
#36722
passed
2 years ago
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Taskfile.yml
+1
-2
1 addition, 2 deletions
Taskfile.yml
cmd/cmd.go
+3
-1
3 additions, 1 deletion
cmd/cmd.go
cmd/version.go
+1
-1
1 addition, 1 deletion
cmd/version.go
lib/main.go
+13
-1
13 additions, 1 deletion
lib/main.go
with
18 additions
and
5 deletions
Taskfile.yml
+
1
−
2
View file @
82eca81e
...
...
@@ -10,7 +10,6 @@
version
:
'
3'
vars
:
VERSION
:
2.0.0
EXE
:
beaver{{exeExt}}
OUTPUT
:
"
build/{{.EXE}}"
GOLANGCI_LINT_VERSION
:
v1.44.0
...
...
@@ -29,7 +28,7 @@
-
mkdir -p build
-
|
go build \
-ldflags "-X orus.io/orus-io/beaver/lib.version=
{{ .VERSION }}
" \
-ldflags "-X
'
orus.io/orus-io/beaver/lib.version=
${CI_COMMIT_TAG}' -X 'orus.io/orus-io/beaver/lib.commitSha=$(hg id -i --debug)' -X 'orus.io/orus-io/beaver/lib.buildDate=$(date)'
" \
-o {{.OUTPUT}} \
main.go
generates
:
...
...
This diff is collapsed.
Click to expand it.
cmd/cmd.go
+
3
−
1
View file @
82eca81e
...
...
@@ -12,7 +12,9 @@
)
var
(
Version
=
beaver
.
GetVersion
()
Version
=
beaver
.
GetVersion
()
CommitSha
=
beaver
.
GetCommitSha
()
BuildDate
=
beaver
.
GetBuildDate
()
)
var
(
...
...
This diff is collapsed.
Click to expand it.
cmd/version.go
+
1
−
1
View file @
82eca81e
...
...
@@ -9,7 +9,7 @@
// Execute the 'version' commands
func
(
cmd
*
VersionCmd
)
Execute
([]
string
)
error
{
fmt
.
Printf
(
"Beaver %
q
\n
"
,
Version
)
fmt
.
Printf
(
"Beaver %
s
\n
Build Date: %s
\n
Commit SHA: %s
\n
"
,
Version
,
BuildDate
,
CommitSha
)
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
lib/main.go
+
13
−
1
View file @
82eca81e
package
beaver
var
version
=
""
var
(
version
=
""
commitSha
=
""
buildDate
=
""
)
func
GetVersion
()
string
{
return
version
}
...
...
@@ -4,4 +8,12 @@
func
GetVersion
()
string
{
return
version
}
func
GetCommitSha
()
string
{
return
commitSha
}
func
GetBuildDate
()
string
{
return
buildDate
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment