This is an example of Go code calling to a C++ library with a C wrapper.
go build # this only ensures it compiles
原文:高可用架构
导读:监控是架构可用性中最关键的环节之一,高可用架构邀请了滴滴的研发工程师聂安,分享了滴滴监控系统 DD-Falcon 近期的一些进展。
作者简介
聂安,滴滴运维研发工程师,长期从事监控、部署等运维工具平台的开发。现就职于滴滴,曾就职于阿里、小米。
很高兴和大家一起分享滴滴监控系统 DD-Falcon 近期的一些进展。今天分享主要包括如下几个部分 (技术架构、产品形态):
package main | |
import ( | |
"encoding/base64" | |
"fmt" | |
rand "math/rand" | |
"time" | |
"github.com/gin-gonic/gin" |
package main | |
import ( | |
"bytes" | |
"io" | |
"io/ioutil" | |
"log" | |
"net" | |
"net/http" | |
"sync" |
Here's the simplest example showing how to do functional options in Golang.
They're a great way to enable users to set options and ease adding new options later.
package main
import (
"flag"
"fmt"
From: https://commandcenter.blogspot.de/2014/01/self-referential-functions-and-design.html
#!/bin/sh | |
NODES=`redis-cli -h $1 cluster nodes | cut -f2 -d' '` | |
IFS=" | |
" | |
for node in $NODES; do | |
echo Flushing node $node... | |
redis-cli -h ${node%:*} -p ${node##*:} flushall |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func main() { | |
wg := sync.WaitGroup{} |
package main | |
import ( | |
"fmt" | |
"gopkg.in/mgo.v2" | |
"gopkg.in/mgo.v2/bson" | |
"time" | |
) | |
type Content struct { |