Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
37e25258
Commit
37e25258
authored
Mar 24, 2017
by
Péter Szilágyi
Committed by
GitHub
Mar 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3813 from fjl/build-fixes-2
build: unify vendor skipping, always run go vet
parents
bb7dca27
69ac6cc7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
36 deletions
+45
-36
.travis.yml
.travis.yml
+5
-3
appveyor.yml
appveyor.yml
+1
-1
ci.go
build/ci.go
+5
-31
util.go
internal/build/util.go
+28
-0
handler.go
log/handler.go
+6
-1
No files found.
.travis.yml
View file @
37e25258
...
@@ -12,8 +12,10 @@ matrix:
...
@@ -12,8 +12,10 @@ matrix:
-
sudo modprobe fuse
-
sudo modprobe fuse
-
sudo chmod 666 /dev/fuse
-
sudo chmod 666 /dev/fuse
-
sudo chown root:$USER /etc/fuse.conf
-
sudo chown root:$USER /etc/fuse.conf
-
go run build/ci.go install
-
go run build/ci.go test -coverage
# These are the latest Go versions
, only run go vet and misspell on these
# These are the latest Go versions
.
-
os
:
linux
-
os
:
linux
dist
:
trusty
dist
:
trusty
sudo
:
required
sudo
:
required
...
@@ -24,7 +26,7 @@ matrix:
...
@@ -24,7 +26,7 @@ matrix:
-
sudo chmod 666 /dev/fuse
-
sudo chmod 666 /dev/fuse
-
sudo chown root:$USER /etc/fuse.conf
-
sudo chown root:$USER /etc/fuse.conf
-
go run build/ci.go install
-
go run build/ci.go install
-
go run build/ci.go test -coverage -
vet -
misspell
-
go run build/ci.go test -coverage -misspell
-
os
:
osx
-
os
:
osx
go
:
1.8
go
:
1.8
...
@@ -34,7 +36,7 @@ matrix:
...
@@ -34,7 +36,7 @@ matrix:
-
brew install caskroom/cask/brew-cask
-
brew install caskroom/cask/brew-cask
-
brew cask install osxfuse
-
brew cask install osxfuse
-
go run build/ci.go install
-
go run build/ci.go install
-
go run build/ci.go test -coverage -
vet -
misspell
-
go run build/ci.go test -coverage -misspell
# This builder does the Ubuntu PPA and Linux Azure uploads
# This builder does the Ubuntu PPA and Linux Azure uploads
-
os
:
linux
-
os
:
linux
...
...
appveyor.yml
View file @
37e25258
...
@@ -36,4 +36,4 @@ after_build:
...
@@ -36,4 +36,4 @@ after_build:
test_script
:
test_script
:
-
set CGO_ENABLED=1
-
set CGO_ENABLED=1
-
go run build\ci.go test -
vet -
coverage
-
go run build\ci.go test -coverage
build/ci.go
View file @
37e25258
...
@@ -24,7 +24,7 @@ Usage: go run ci.go <command> <command flags/arguments>
...
@@ -24,7 +24,7 @@ Usage: go run ci.go <command> <command flags/arguments>
Available commands are:
Available commands are:
install [ -arch architecture ] [ packages... ] -- builds packages and executables
install [ -arch architecture ] [ packages... ] -- builds packages and executables
test [ -coverage ] [ -
vet ] [ -misspell ] [ packages... ]
-- runs the tests
test [ -coverage ] [ -
misspell ] [ packages... ]
-- runs the tests
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
importkeys -- imports signing keys from env
importkeys -- imports signing keys from env
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
...
@@ -173,19 +173,7 @@ func doInstall(cmdline []string) {
...
@@ -173,19 +173,7 @@ func doInstall(cmdline []string) {
if
flag
.
NArg
()
>
0
{
if
flag
.
NArg
()
>
0
{
packages
=
flag
.
Args
()
packages
=
flag
.
Args
()
}
}
packages
=
build
.
ExpandPackagesNoVendor
(
packages
)
// Resolve ./... manually and remove vendor/bazil/fuse (fuse is not in windows)
out
,
err
:=
goTool
(
"list"
,
"./..."
)
.
CombinedOutput
()
if
err
!=
nil
{
log
.
Fatalf
(
"package listing failed: %v
\n
%s"
,
err
,
string
(
out
))
}
packages
=
[]
string
{}
for
_
,
line
:=
range
strings
.
Split
(
string
(
out
),
"
\n
"
)
{
if
!
strings
.
Contains
(
line
,
"vendor"
)
{
packages
=
append
(
packages
,
strings
.
TrimSpace
(
line
))
}
}
if
*
arch
==
""
||
*
arch
==
runtime
.
GOARCH
{
if
*
arch
==
""
||
*
arch
==
runtime
.
GOARCH
{
goinstall
:=
goTool
(
"install"
,
buildFlags
(
env
)
...
)
goinstall
:=
goTool
(
"install"
,
buildFlags
(
env
)
...
)
...
@@ -274,7 +262,6 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
...
@@ -274,7 +262,6 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
func
doTest
(
cmdline
[]
string
)
{
func
doTest
(
cmdline
[]
string
)
{
var
(
var
(
vet
=
flag
.
Bool
(
"vet"
,
false
,
"Whether to run go vet"
)
misspell
=
flag
.
Bool
(
"misspell"
,
false
,
"Whether to run the spell checker"
)
misspell
=
flag
.
Bool
(
"misspell"
,
false
,
"Whether to run the spell checker"
)
coverage
=
flag
.
Bool
(
"coverage"
,
false
,
"Whether to record code coverage"
)
coverage
=
flag
.
Bool
(
"coverage"
,
false
,
"Whether to record code coverage"
)
)
)
...
@@ -284,23 +271,10 @@ func doTest(cmdline []string) {
...
@@ -284,23 +271,10 @@ func doTest(cmdline []string) {
if
len
(
flag
.
CommandLine
.
Args
())
>
0
{
if
len
(
flag
.
CommandLine
.
Args
())
>
0
{
packages
=
flag
.
CommandLine
.
Args
()
packages
=
flag
.
CommandLine
.
Args
()
}
}
if
len
(
packages
)
==
1
&&
packages
[
0
]
==
"./..."
{
packages
=
build
.
ExpandPackagesNoVendor
(
packages
)
// Resolve ./... manually since go vet will fail on vendored stuff
out
,
err
:=
goTool
(
"list"
,
"./..."
)
.
CombinedOutput
()
if
err
!=
nil
{
log
.
Fatalf
(
"package listing failed: %v
\n
%s"
,
err
,
string
(
out
))
}
packages
=
[]
string
{}
for
_
,
line
:=
range
strings
.
Split
(
string
(
out
),
"
\n
"
)
{
if
!
strings
.
Contains
(
line
,
"vendor"
)
{
packages
=
append
(
packages
,
strings
.
TrimSpace
(
line
))
}
}
}
// Run analysis tools before the tests.
// Run analysis tools before the tests.
if
*
vet
{
build
.
MustRun
(
goTool
(
"vet"
,
packages
...
))
build
.
MustRun
(
goTool
(
"vet"
,
packages
...
))
}
if
*
misspell
{
if
*
misspell
{
spellcheck
(
packages
)
spellcheck
(
packages
)
}
}
...
...
internal/build/util.go
View file @
37e25258
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"os"
"os"
"os/exec"
"os/exec"
"path/filepath"
"path/filepath"
"runtime"
"strings"
"strings"
"text/template"
"text/template"
)
)
...
@@ -136,3 +137,30 @@ func CopyFile(dst, src string, mode os.FileMode) {
...
@@ -136,3 +137,30 @@ func CopyFile(dst, src string, mode os.FileMode) {
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
}
}
// ExpandPackagesNoVendor expands a cmd/go import path pattern, skipping
// vendored packages.
func
ExpandPackagesNoVendor
(
patterns
[]
string
)
[]
string
{
expand
:=
false
for
_
,
pkg
:=
range
patterns
{
if
strings
.
Contains
(
pkg
,
"..."
)
{
expand
=
true
}
}
if
expand
{
args
:=
append
([]
string
{
"list"
},
patterns
...
)
cmd
:=
exec
.
Command
(
filepath
.
Join
(
runtime
.
GOROOT
(),
"bin"
,
"go"
),
args
...
)
out
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
log
.
Fatalf
(
"package listing failed: %v
\n
%s"
,
err
,
string
(
out
))
}
var
packages
[]
string
for
_
,
line
:=
range
strings
.
Split
(
string
(
out
),
"
\n
"
)
{
if
!
strings
.
Contains
(
line
,
"/vendor/"
)
{
packages
=
append
(
packages
,
strings
.
TrimSpace
(
line
))
}
}
return
packages
}
return
patterns
}
log/handler.go
View file @
37e25258
...
@@ -106,11 +106,16 @@ func CallerFileHandler(h Handler) Handler {
...
@@ -106,11 +106,16 @@ func CallerFileHandler(h Handler) Handler {
// the context with key "fn".
// the context with key "fn".
func
CallerFuncHandler
(
h
Handler
)
Handler
{
func
CallerFuncHandler
(
h
Handler
)
Handler
{
return
FuncHandler
(
func
(
r
*
Record
)
error
{
return
FuncHandler
(
func
(
r
*
Record
)
error
{
r
.
Ctx
=
append
(
r
.
Ctx
,
"fn"
,
f
mt
.
Sprintf
(
"%+n"
,
r
.
Call
))
r
.
Ctx
=
append
(
r
.
Ctx
,
"fn"
,
f
ormatCall
(
"%+n"
,
r
.
Call
))
return
h
.
Log
(
r
)
return
h
.
Log
(
r
)
})
})
}
}
// This function is here to please go vet on Go < 1.8.
func
formatCall
(
format
string
,
c
stack
.
Call
)
string
{
return
fmt
.
Sprintf
(
format
,
c
)
}
// CallerStackHandler returns a Handler that adds a stack trace to the context
// CallerStackHandler returns a Handler that adds a stack trace to the context
// with key "stack". The stack trace is formated as a space separated list of
// with key "stack". The stack trace is formated as a space separated list of
// call sites inside matching []'s. The most recent call site is listed first.
// call sites inside matching []'s. The most recent call site is listed first.
...
...
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