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
935d6b0c
Unverified
Commit
935d6b0c
authored
Jun 25, 2020
by
Arve Knudsen
Committed by
GitHub
Jun 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build: Let building of Go code work even if $GOPATH isn't set (#25805)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent
6e3e9b7c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
19 deletions
+6
-19
build.go
+6
-19
No files found.
build.go
View file @
935d6b0c
...
...
@@ -9,6 +9,7 @@ import (
"encoding/json"
"flag"
"fmt"
"go/build"
"io"
"io/ioutil"
"log"
...
...
@@ -57,8 +58,6 @@ func main() {
log
.
SetOutput
(
os
.
Stdout
)
log
.
SetFlags
(
0
)
ensureGoPath
()
var
buildIdRaw
string
flag
.
StringVar
(
&
goarch
,
"goarch"
,
runtime
.
GOARCH
,
"GOARCH"
)
...
...
@@ -106,16 +105,16 @@ func main() {
case
"build-srv"
,
"build-server"
:
clean
()
b
uild
(
"grafana-server"
,
"./pkg/cmd/grafana-server"
,
[]
string
{})
doB
uild
(
"grafana-server"
,
"./pkg/cmd/grafana-server"
,
[]
string
{})
case
"build-cli"
:
clean
()
b
uild
(
"grafana-cli"
,
"./pkg/cmd/grafana-cli"
,
[]
string
{})
doB
uild
(
"grafana-cli"
,
"./pkg/cmd/grafana-cli"
,
[]
string
{})
case
"build"
:
//clean()
for
_
,
binary
:=
range
binaries
{
b
uild
(
binary
,
"./pkg/cmd/"
+
binary
,
[]
string
{})
doB
uild
(
binary
,
"./pkg/cmd/"
+
binary
,
[]
string
{})
}
case
"build-frontend"
:
...
...
@@ -417,18 +416,6 @@ func createPackage(options linuxPackageOptions) {
runPrint
(
"fpm"
,
append
([]
string
{
"-t"
,
options
.
packageType
},
args
...
)
...
)
}
func
ensureGoPath
()
{
if
os
.
Getenv
(
"GOPATH"
)
==
""
{
cwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
gopath
:=
filepath
.
Clean
(
filepath
.
Join
(
cwd
,
"../../../../"
))
log
.
Println
(
"GOPATH is"
,
gopath
)
os
.
Setenv
(
"GOPATH"
,
gopath
)
}
}
func
grunt
(
params
...
string
)
{
if
runtime
.
GOOS
==
windows
{
runPrint
(
`.\node_modules\.bin\grunt`
,
params
...
)
...
...
@@ -476,7 +463,7 @@ func test(pkg string) {
runPrint
(
"go"
,
"test"
,
"-short"
,
"-timeout"
,
"60s"
,
pkg
)
}
func
b
uild
(
binaryName
,
pkg
string
,
tags
[]
string
)
{
func
doB
uild
(
binaryName
,
pkg
string
,
tags
[]
string
)
{
libcPart
:=
""
if
libc
!=
""
{
libcPart
=
fmt
.
Sprintf
(
"-%s"
,
libc
)
...
...
@@ -554,7 +541,7 @@ func clean() {
rmr
(
"dist"
)
rmr
(
"tmp"
)
rmr
(
filepath
.
Join
(
os
.
Getenv
(
"GOPATH"
)
,
fmt
.
Sprintf
(
"pkg/%s_%s/github.com/grafana"
,
goos
,
goarch
)))
rmr
(
filepath
.
Join
(
build
.
Default
.
GOPATH
,
fmt
.
Sprintf
(
"pkg/%s_%s/github.com/grafana"
,
goos
,
goarch
)))
}
func
setBuildEnv
()
{
...
...
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