all: fix warnings pointed to by golangci-lint

Update #977
This commit is contained in:
Dmitry Vyukov 2019-03-28 15:30:18 +01:00
parent 742f448304
commit 4a9fce1952
8 changed files with 10 additions and 12 deletions

View File

@ -164,10 +164,9 @@ func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) {
// Updates desc and returns set of unsupported syscalls and flags.
func (comp *compiler) patchConsts(consts map[string]uint64) {
for _, decl := range comp.desc.Nodes {
switch decl.(type) {
switch n := decl.(type) {
case *ast.IntFlags:
// Unsupported flag values are dropped.
n := decl.(*ast.IntFlags)
var values []*ast.Int
for _, v := range n.Values {
if comp.patchIntConst(&v.Value, &v.Ident, consts, nil) {

View File

@ -60,7 +60,7 @@ func TestGenerate(t *testing.T) {
}
func testTarget(t *testing.T, target *prog.Target, full bool) {
seed := int64(time.Now().UnixNano())
seed := time.Now().UnixNano()
if os.Getenv("TRAVIS") != "" {
seed = 0 // required for deterministic coverage reports
}

View File

@ -36,7 +36,7 @@ func TestMode(t *testing.T) {
}
func TestDecode(t *testing.T) {
seed := int64(time.Now().UnixNano())
seed := time.Now().UnixNano()
if os.Getenv("TRAVIS") != "" {
seed = 0 // required for deterministic coverage reports
}

View File

@ -37,7 +37,7 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, EnvFlags) {
if testing.Short() {
iters = 10
}
seed := int64(time.Now().UnixNano())
seed := time.Now().UnixNano()
if os.Getenv("TRAVIS") != "" {
seed = 0 // required for deterministic coverage reports
}

View File

@ -18,7 +18,7 @@ func initTest(t *testing.T) (*rand.Rand, int) {
if testing.Short() {
iters = 100
}
seed := int64(time.Now().UnixNano())
seed := time.Now().UnixNano()
if os.Getenv("TRAVIS") != "" {
seed = 0 // required for deterministic coverage reports
}

View File

@ -32,7 +32,7 @@ func initTargetTest(t *testing.T, os, arch string) *Target {
}
func randSource(t *testing.T) rand.Source {
seed := int64(time.Now().UnixNano())
seed := time.Now().UnixNano()
if os.Getenv("TRAVIS") != "" {
seed = 0 // required for deterministic coverage reports
}

View File

@ -328,12 +328,11 @@ func (inst *instance) getBatteryLevel(numRetry int) (int, error) {
// sleep for 5 seconds before retrying
time.Sleep(5 * time.Second)
out, err = inst.adb("shell", "dumpsys battery | grep level:")
} else {
if err != nil {
return 0, err
}
}
}
if err != nil {
return 0, err
}
val := 0
for _, c := range out {
if c >= '0' && c <= '9' {

View File

@ -336,7 +336,7 @@ func (inst *instance) Diagnose() ([]byte, bool) {
func init() {
if os.Getenv("SYZ_GVISOR_PROXY") != "" {
fmt.Fprintf(os.Stderr, initStartMsg)
fmt.Fprint(os.Stderr, initStartMsg)
select {}
}
}