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 ( | |
"bytes" | |
"fmt" | |
"os/exec" | |
) | |
func main() { | |
cmd := exec.Command("C:\\Program Files (x86)\\Notepad++\\notepad++.exe", "C:\\Program Files (x86)\\Notepad++\\LICENSE") |
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 ex | |
type Foo struct { | |
Val string | |
} | |
func (f *Foo) Bar() string { | |
return f.Val | |
} |
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" | |
) | |
func main() { | |
b := make([]byte, 0, 4096) | |
fmt.Printf("len: %d\t\tcap: %d\t%#v\n", len(b), cap(b), 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 main | |
import "fmt" | |
var foo = map[string]func(){} | |
func init() { | |
foo["a"] = a | |
foo["b"] = 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 main | |
import "fmt" | |
var foo = map[string]func(){} | |
func init() { | |
foo["a"] = a | |
foo["b"] = 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
type T struct { | |
time.Time | |
} | |
func TestTimeCopy(t *testing.T) { | |
tests := []struct{ | |
Y int | |
M time.Month | |
D int | |
h int |
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 ( | |
"encoding/json" | |
"fmt" | |
"time" | |
"github.com/mohae/deepcopy" | |
) |
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
Group Name Ops ns/Op B/Op Allocs/Op | |
------------------------------------------------------------------------------------------ | |
CPU joefriday/cpu/facts.Get 200000 8590 800 18 | |
CPU joefriday/cpu/stats.Get 200000 7706 264 4 | |
CPU DataDog/gohai/cpu.Cpu.Collect 10000 273546 999489 822 | |
CPU shirou/gopsutil/cpu.Info 50000 32987 9656 120 | |
CPU shirou/gopsutil/cpu.Times 50000 27780 10384 28 | |
Memory joefriday/mem.Get 200000 7746 352 1 |
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" | |
"os" | |
"os/exec" | |
"github.com/mohae/randchars" | |
) |
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 min | |
import ( | |
"testing" | |
) | |
var ( | |
n10 = []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | |
n50 = []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | |
n100 = []int{ |
NewerOlder