This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type TempData struct { | |
F1 string | |
F2 string | |
} | |
type TranData struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package math | |
// Export for testing. | |
var Math = math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package math | |
func sum(a, b int) int { | |
return a + b | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metrics | |
import ( | |
"fmt" | |
"sync" | |
"sync/atomic" | |
"time" | |
) | |
type counter struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* start prcess/process.go */ | |
package process | |
var fetch Fetch = fetch.NewHttpFetch() // as Gobal field | |
// or someone like this.. | |
// func int() { | |
// fetch = fetch.NewHttpFetch() | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |