西维蜀黍

【Golang】编译 - 交叉编译(Cross Compilation)

GOOS and GOARCH

$ go tool dist list
aix/ppc64
android/386
android/amd64
android/arm
android/arm64
darwin/386
darwin/amd64
darwin/arm
darwin/arm64
dragonfly/amd64
freebsd/386
freebsd/amd64
freebsd/arm
illumos/amd64
js/wasm
linux/386
linux/amd64
linux/arm
linux/arm64
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
linux/ppc64
linux/ppc64le
linux/s390x
nacl/386
nacl/amd64p32
nacl/arm
netbsd/386
netbsd/amd64
netbsd/arm
netbsd/arm64
openbsd/386
openbsd/amd64
openbsd/arm
openbsd/arm64
plan9/386
plan9/amd64
plan9/arm
solaris/amd64
windows/386
windows/amd64
windows/arm
  ...


【Golang】关键字 - const

Constants

Constants are declared like variables, but with the const keyword.

Constants can be character, string, boolean, or numeric values.

Constants cannot be declared using the := syntax.

package main

import "fmt"

const Pi = 3.14

func main() {
	const World = "世界"
	fmt.Println("Hello", World)
	fmt.Println("Happy", Pi, "Day")

	const Truth = true
	fmt.Println("Go rules?", Truth)
}
  ...


【Protobuf】Protocol Buffers 性能

  ...


【Protobuf】Protocol Buffers Demo

Where to find the example code

Our example is a set of command-line applications for managing an address book data file, encoded using protocol buffers. The command add_person_go adds a new entry to the data file. The command list_people_go parses the data file and prints the data to the console.

You can find the complete example in the examples directory of the GitHub repository.

  ...


【Golang】位运算

& - 按位与运算符

按位与运算符"&“是双目运算符。 其功能是参与运算的两数各对应的二进位相与。

| - 按位或运算符

按位或运算符”|“是双目运算符。 其功能是参与运算的两数各对应的二进位相或。

  ...