Skip to content

Instantly share code, notes, and snippets.

@lysu
lysu / xx.go
Last active July 15, 2016 05:59
package main
import "fmt"
type TempData struct {
F1 string
F2 string
}
type TranData struct {
package math
// Export for testing.
var Math = math
package math_test
import (
"testing"
"xx/math"
)
func TestName(t *testing.T) {
if 2 != math.Sum(1, 1) {
t.Fatalf("Sum of %d + %d not 2")
@lysu
lysu / sum.go
Last active April 24, 2016 14:40
package math
func sum(a, b int) int {
return a + b
}
package metrics
import (
"fmt"
"sync"
"sync/atomic"
"time"
)
type counter struct {
/* start prcess/process.go */
package process
var Fetch Fetch // Gobal variable, but no initilize, and For Extension!!!
func Process(x string) {
fetch.Fetch(x)
}
/* end prcess/process.go */
/* start prcess/process.go */
package process
type Processer struct{
fetch Fetch // use processor's field
}
func (p *Processor) Process(x string) { // as processer metho
fetch.Fetch(x)
}
/* start prcess/process.go */
package process
var fetch Fetch = fetch.NewHttpFetch() // as Gobal field
// or someone like this..
// func int() {
// fetch = fetch.NewHttpFetch()
// }
0x0034 00052 (test.go:12) CALL strconv.FormatInt(SB)
0x0039 00057 (test.go:12) MOVQ 16(SP), CX
0x003e 00062 (test.go:12) MOVQ 24(SP), AX
0x0043 00067 (test.go:12) LEAQ "".autotmp_0004+88(SP), BX
0x0048 00072 (test.go:12) MOVQ BX, (SP)
0x004c 00076 (test.go:12) MOVQ "".sql+160(FP), BX
0x0054 00084 (test.go:12) MOVQ BX, 8(SP)
0x0059 00089 (test.go:12) MOVQ "".sql+168(FP), BX
0x0061 00097 (test.go:12) MOVQ BX, 16(SP)
0x0066 00102 (test.go:12) LEAQ go.string."/*requestID:"(SB), BX
func concatstrings(a []string) string {
idx := 0
l := 0
count := 0
for i, x := range a {
n := len(x)
if n == 0 {
continue
}
if l+n < l {