Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
go fmt all source files.
Browse files Browse the repository at this point in the history
  • Loading branch information
huandu committed Aug 19, 2016
1 parent 59145d4 commit 4429e1d
Show file tree
Hide file tree
Showing 1,521 changed files with 54,320 additions and 54,310 deletions.
38 changes: 19 additions & 19 deletions hack/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"go/printer"
"go/token"
"os"
"path/filepath"
"strings"
"regexp"
"strings"
)

var reBuildIgnoreFlag = regexp.MustCompile(`^/(/|\*)[[:blank:]]*\+build[[:blank:]]+ignore`)
Expand All @@ -33,7 +33,7 @@ type Generator struct {
context *Context
parsedPkgs map[string]bool
pkgs []string
hackers map[string]Hacker
hackers map[string]Hacker
}

func NewGenerator(context *Context, hackers ...Hacker) *Generator {
Expand All @@ -52,7 +52,7 @@ func NewGenerator(context *Context, hackers ...Hacker) *Generator {
context: context,
parsedPkgs: parsedPkgs,
pkgs: pkgs,
hackers: hackersMap,
hackers: hackersMap,
}
}

Expand Down Expand Up @@ -84,16 +84,16 @@ func (g *Generator) parsePkg(pkg string) {

logDebugf("Parsed package `%v`...", pkg)

if _, ok := pkgs["main"]; ok {
delete(pkgs, "main")
}
if _, ok := pkgs["main"]; ok {
delete(pkgs, "main")
}

if len(pkgs) != 1 {
keys := []string{}
keys := []string{}

for k, _ := range pkgs {
keys = append(keys, k)
}
for k, _ := range pkgs {
keys = append(keys, k)
}

panic(fmt.Errorf("there must be only one package name in a package. [pkgs:%v]", strings.Join(keys, ", ")))
}
Expand Down Expand Up @@ -149,7 +149,7 @@ FilesLoop:
if importName == nil {
segments := strings.Split(importPath, "/")
importName = &ast.Ident{
Name: segments[len(segments) - 1],
Name: segments[len(segments)-1],
}
}

Expand Down Expand Up @@ -187,20 +187,20 @@ FilesLoop:
}

switch n := node.(type) {
case *ast.SelectorExpr:
case *ast.SelectorExpr:
if _, ok := n.X.(*ast.Ident); !ok {
break
}

pkgName := n.X.(*ast.Ident).Name
typeName := n.Sel.Name
pkgName := n.X.(*ast.Ident).Name
typeName := n.Sel.Name

// Ignore entire type spec if it contains any type imported from C.
if pkgName == "C" {
if pkgName == "C" {
logErrorf("It's not possible to parsee C type `%v.%v` for type. [type:%v]", pkgName, typeName, spec)
needWalk = false
break
}
break
}

if _, ok := usedImports[pkgName]; !ok {
importPath, ok := importPathMap[pkgName]
Expand Down Expand Up @@ -239,7 +239,7 @@ FilesLoop:
continue
}

hackedDecls := make([]ast.Decl, 0, len(neededDecls) + len(allImportDecls))
hackedDecls := make([]ast.Decl, 0, len(neededDecls)+len(allImportDecls))
hackedImportSpecs := make([]*ast.ImportSpec, 0, len(allImportDecls))
hackedComments := make([]*ast.CommentGroup, 0, len(f.Comments))

Expand Down
10 changes: 5 additions & 5 deletions hack/go1_5/runtime/alg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ package runtime
import "unsafe"

const (
c0 = uintptr((8-ptrSize)/4*2860486313 + (ptrSize-4)/4*33054211828000289)
c1 = uintptr((8-ptrSize)/4*3267000013 + (ptrSize-4)/4*23344194077549503)
c0 = uintptr((8-ptrSize)/4*2860486313 + (ptrSize-4)/4*33054211828000289)
c1 = uintptr((8-ptrSize)/4*3267000013 + (ptrSize-4)/4*23344194077549503)
)

// type algorithms - known to compiler
const (
alg_MEM = iota
alg_MEM = iota
alg_MEM0
alg_MEM8
alg_MEM16
Expand Down Expand Up @@ -41,9 +41,9 @@ const (
// typeAlg is also copied/used in reflect/type.go.
// keep them in sync.
type typeAlg struct {
hash func(unsafe.Pointer, uintptr) uintptr
hash func(unsafe.Pointer, uintptr) uintptr

equal func(unsafe.Pointer, unsafe.Pointer) bool
equal func(unsafe.Pointer, unsafe.Pointer) bool
}

const hashRandomBytes = ptrSize / 4 * 64
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '8'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = goos_nacl*65536 + (1-goos_nacl)*4096
_PCQuantum = 1
_Int64Align = 4
hugePageSize = 1 << 21
thechar = '8'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = goos_nacl*65536 + (1-goos_nacl)*4096
_PCQuantum = 1
_Int64Align = 4
hugePageSize = 1 << 21
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '6'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 4096
_PCQuantum = 1
_Int64Align = 8
hugePageSize = 1 << 21
thechar = '6'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 4096
_PCQuantum = 1
_Int64Align = 8
hugePageSize = 1 << 21
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_amd64p32.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '6'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 65536*goos_nacl + 4096*(1-goos_nacl)
_PCQuantum = 1
_Int64Align = 8
hugePageSize = 1 << 21
thechar = '6'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 65536*goos_nacl + 4096*(1-goos_nacl)
_PCQuantum = 1
_Int64Align = 8
hugePageSize = 1 << 21
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '5'
_BigEndian = 0
_CacheLineSize = 32
_PhysPageSize = 65536*goos_nacl + 4096*(1-goos_nacl)
_PCQuantum = 4
_Int64Align = 4
hugePageSize = 0
thechar = '5'
_BigEndian = 0
_CacheLineSize = 32
_PhysPageSize = 65536*goos_nacl + 4096*(1-goos_nacl)
_PCQuantum = 4
_Int64Align = 4
hugePageSize = 0
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '7'
_BigEndian = 0
_CacheLineSize = 32
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
thechar = '7'
_BigEndian = 0
_CacheLineSize = 32
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '9'
_BigEndian = 1
_CacheLineSize = 64
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
thechar = '9'
_BigEndian = 1
_CacheLineSize = 64
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
)
14 changes: 7 additions & 7 deletions hack/go1_5/runtime/arch1_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package runtime

const (
thechar = '9'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
thechar = '9'
_BigEndian = 0
_CacheLineSize = 64
_PhysPageSize = 65536
_PCQuantum = 4
_Int64Align = 8
hugePageSize = 0
)
32 changes: 16 additions & 16 deletions hack/go1_5/runtime/chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ package runtime
import "unsafe"

const (
maxAlign = 8
hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1))
debugChan = false
maxAlign = 8
hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1))
debugChan = false
)

type hchan struct {
qcount uint
dataqsiz uint
buf unsafe.Pointer
elemsize uint16
closed uint32
elemtype *_type
sendx uint
recvx uint
recvq waitq
sendq waitq
lock mutex
qcount uint
dataqsiz uint
buf unsafe.Pointer
elemsize uint16
closed uint32
elemtype *_type
sendx uint
recvx uint
recvq waitq
sendq waitq
lock mutex
}

type waitq struct {
first *sudog
last *sudog
first *sudog
last *sudog
}
42 changes: 21 additions & 21 deletions hack/go1_5/runtime/cpuprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,36 @@
package runtime

const (
numBuckets = 1 << 10
logSize = 1 << 17
assoc = 4
maxCPUProfStack = 64
numBuckets = 1 << 10
logSize = 1 << 17
assoc = 4
maxCPUProfStack = 64
)

type cpuprofEntry struct {
count uintptr
depth int
stack [maxCPUProfStack]uintptr
count uintptr
depth int
stack [maxCPUProfStack]uintptr
}

type cpuProfile struct {
on bool
wait note
count uintptr
evicts uintptr
lost uintptr
on bool
wait note
count uintptr
evicts uintptr
lost uintptr

hash [numBuckets]struct {
hash [numBuckets]struct {
entry [assoc]cpuprofEntry
}

log [2][logSize / 2]uintptr
nlog int
toggle int32
handoff uint32
log [2][logSize / 2]uintptr
nlog int
toggle int32
handoff uint32

wtoggle uint32
wholding bool
flushing bool
eodSent bool
wtoggle uint32
wholding bool
flushing bool
eodSent bool
}
Loading

0 comments on commit 4429e1d

Please sign in to comment.