Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
52af346e
Commit
52af346e
authored
Dec 01, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3375 from hartfordfive/issue-3374
Add flag option to display app version (Issue 3374)
parents
8e0bba4f
8deb6d92
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
README.md
+3
-1
main.go
+10
-0
No files found.
README.md
View file @
52af346e
...
@@ -85,11 +85,13 @@ go get github.com/grafana/grafana
...
@@ -85,11 +85,13 @@ go get github.com/grafana/grafana
```
```
### Building the backend
### Building the backend
Replace X.Y.Z by actual version number.
```
```
cd $GOPATH/src/github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana
go run build.go setup (only needed once to install godep)
go run build.go setup (only needed once to install godep)
godep restore (will pull down all golang lib dependencies in your current GOPATH)
godep restore (will pull down all golang lib dependencies in your current GOPATH)
go build .
go build -ldflags "-X main.build_date=`date +%Y-%m-%d` -X main.version=X.Y.Z -X main.commit=`git rev-parse --verify HEAD`"
```
```
### Building frontend assets
### Building frontend assets
...
...
main.go
View file @
52af346e
...
@@ -2,6 +2,7 @@ package main
...
@@ -2,6 +2,7 @@ package main
import
(
import
(
"flag"
"flag"
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"os/signal"
"os/signal"
...
@@ -27,6 +28,7 @@ import (
...
@@ -27,6 +28,7 @@ import (
var
version
=
"master"
var
version
=
"master"
var
commit
=
"NA"
var
commit
=
"NA"
var
buildstamp
string
var
buildstamp
string
var
build_date
string
var
configFile
=
flag
.
String
(
"config"
,
""
,
"path to config file"
)
var
configFile
=
flag
.
String
(
"config"
,
""
,
"path to config file"
)
var
homePath
=
flag
.
String
(
"homepath"
,
""
,
"path to grafana install/home path, defaults to working directory"
)
var
homePath
=
flag
.
String
(
"homepath"
,
""
,
"path to grafana install/home path, defaults to working directory"
)
...
@@ -38,6 +40,14 @@ func init() {
...
@@ -38,6 +40,14 @@ func init() {
}
}
func
main
()
{
func
main
()
{
v
:=
flag
.
Bool
(
"v"
,
false
,
"prints current version and exits"
)
flag
.
Parse
()
if
*
v
{
fmt
.
Printf
(
"Version %s (commit: %s)
\n
"
,
version
,
commit
)
os
.
Exit
(
0
)
}
buildstampInt64
,
_
:=
strconv
.
ParseInt
(
buildstamp
,
10
,
64
)
buildstampInt64
,
_
:=
strconv
.
ParseInt
(
buildstamp
,
10
,
64
)
setting
.
BuildVersion
=
version
setting
.
BuildVersion
=
version
...
...
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