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 | |
type stack []int | |
func main() { | |
var value stack | |
value.push(5) | |
value.pop() | |
} |
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 ( | |
"strings" | |
"golang.org/x/tour/wc" | |
) | |
func WordCount(s string) map[string]int { | |
var strs = make(map[string]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 ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
wc := NewWordCount() | |
wc = wc.AddWord("I am") |
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" | |
"strings" | |
) | |
func main() { | |
wc := NewWordCount() | |
wc = wc.AddWord("I am") |
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
module.exports = { | |
outDir: 'public', | |
babel: { | |
babelrc: false | |
}, | |
banner: true, | |
format: ['umd-min'], | |
css: true, | |
plugins: ['vue'] | |
}; |
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
module.exports = { | |
css: { extract: false }, | |
outputDir: 'lib' | |
} |
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 "golang.org/x/tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
slice := make([][]uint8, dx, dx) | |
// loop dx | |
for x := 0; x < dx; x++ { | |
slice[x] = make([]uint8, dy, dy) | |
// loop dy |
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
version: "3.9" | |
services: | |
zookeeper: | |
image: 'bitnami/zookeeper:latest' | |
ports: | |
- '2181:2181' | |
environment: | |
- ALLOW_ANONYMOUS_LOGIN=yes | |
kafka: |
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 init() { | |
var exporter sdktrace.SpanExporter | |
var err error | |
// use zipkin exporter | |
exporter, err = zipkin.New("http://zipkin:9411/api/v2/spans") | |
if err != nil { | |
panic(err) | |
} |
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 main() { | |
// create server | |
mux := http.NewServeMux() | |
// wrapped handler for use propagation to extract trace signal from http header to request context | |
// it like a middleware | |
wrappedHandler := otelhttp.NewHandler(http.HandlerFunc(httpHandler), "http-server") | |
mux.Handle("/", wrappedHandler) | |
// start server |
OlderNewer