packagesyncPoolimport("bytes""io/ioutil""sync""testing")varpool=sync.Pool{New:func()interface{}{returnnew(bytes.Buffer)},}varfileName="test_sync_pool.log"vardata=make([]byte,10000)funcBenchmarkWriteFile(b*testin
Format != pix_fmt { /* To handle this change, one could call av_image_alloc again and * decode the following frames into another rawvideo file. */ fmt.Printf("Error: Width, height and pixel format have to be constant in a rawvideo file, but the width, height or pixel format of ...
package main import ( "log" "net" ) func main() { listen, err := net.Listen("tcp", ":8888") if err != nil { log.Println("listen error: ", err) return } for { conn, err := listen.Accept() if err != nil { log.Println("accept error: ", err) break } // start a ne...
package main import ( "fmt" "os" "syscall" ) const maxMapSize = 0x8000000000 const maxMmapStep = 1 << 30 // 1GB func main() { file, err := os.OpenFile("my.db", os.O_RDWR|os.O_CREATE, 0644) if err != nil { panic(err) } defer file.Close() stat, err := os.Stat(...
package main import ( "fmt" "github.com/akamensky/argparse" "os" ) func main() { // Create new parser object parser := argparse.NewParser("print", "Prints provided string to stdout") // Create string flag s := parser.String("s", "string", &argparse.Options{Required: true, Help...
To use the MQ module in your application, yourgo.modfile contains require ( github.com/ibm-messaging/mq-golang/v5 v5.x.y ) and your application code includes import ibmmq "github.com/ibm-messaging/mq-golang/v5/ibmmq" If you have not moved to using modules in your application, you ...
packagemainimport("flag""fmt""net""os""time")varRemoteAddr *stringvarConcurNum *intvarLocalAddr *stringfuncinit(){ RemoteAddr = flag.String("remote-ip","127.0.0.1","ip addr of remote server") ConcurNum = flag.Int("concurrent-num",100,"concurrent number of client") ...
There are many instances of people attempting to use thisrstripapproach to strip off a file extension. For instance, you might be converting an image from one filetype to another, and need to construct the final path. Or you might want to rename a bunch of files to have consistent extension...
import ( "bytes" "io/ioutil" "sync" "testing" ) var pool = sync.Pool{ New: func() interface{} { return new(bytes.Buffer) }, } var fileName = "test_sync_pool.log" var data = make([]byte, 10000) func BenchmarkWriteFile(b *testing.B) { ...
If you have encountered an issue, or wish to try the latest code for another reason, then run go get github.com/eclipse/paho.mqtt.golang@master to get the latest commit. GOPATH Installation is as easy as: go get github.com/eclipse/paho.mqtt.golang The client depends on Google's ...