Golang Packages

Search standard Go packages here: https://pkg.go.dev/std

What are packages belong to golang.org/x: These packages are part of the Go Project but outside the main Go tree. They are developed under looser compatibility requirements than the Go core. Install them with “go get”.

List of commonly used packages fmt: Common use placeholder: %q, %v, %d, %c(one string), %T(type), %p(address). fmt.Errorf() fmt.Sprintf() logrus: structured logger for Go strings: strings.LastIndex(s,“/”), strings([]byte{‘a’,‘b’}) strconv: strconv.Itoa(55), strconv.Atoi(“1”), strconv.ParseInt(“23”, 10, 64) bytes: bytes.Buffer, []byte(“hello”) unicode/utf8: utf8.RuneCountInString(“Hello, 世界”)

kubernetes: https://github.com/kubernetes/kubernetes kubernetes/client-go: https://pkg.go.dev/k8s.io/client-go/kubernetes

os: os.Args, os.Stdin, os.Open, os.Exit(1) flag: extract options/flags from CLI, like Python Click cobra: powerful CLI for modern app: k8s, etcd, istio, etc viper: a complete configuration solution for Go app path/filepath

httpRouter net/http: minimal server, http.Handlefunc(x,handler), http.ListenAndServe(x,x) func handler(w http.ResponseWriter, r *http.Request) {} net/url context encoding/json https://pkg.go.dev/encoding/json json.Marshal(), json.MarshalIndent() yaml: gopkg.in/yaml.v3

math/rand: rand is a subdirectory in math package. bufio: Some help for textual I/O: bufio.NewScanner(os.Stdin), bufio.NewReader(os.Stdin) runtime runtime.Stack() io/ioutil: ioutil.ReadAll() sync: sync.Mutex

sort: sort.Interface sort.Strings(<[]string>) sort.Ints(<[]int>) sort.Reverse(sort.IntSlice(<[]int>)) sort.IsSorted() text/template text/tabwriter html/template

errors time: time.Now(), time.Since(xx).Seconds()

testify

hugo: a static site website generator

0%