标签 golang技术 下的文章
关于‘go list‘ failed with: error obtaining VCS status error obtaining VCS status: exit status 128问题的解决
降级go版本到1.6就可以。
golang图形库
GLIBCXX_3.4.20
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found #766
GLIBCXX_3.4.20' not found
sudo find / -name "libstdc++.so.6*"
sudo cp somewhere/libstdc++.so.6.0.25 /usr/lib64/
GLIBC_2.18' not found
curl -O http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxf glibc-2.18.tar.gz
cd glibc-2.18/
mkdir build
cd build/
../configure --prefix=/usr
make -j2
make install
go语言字符集转换
/* Golang 中的 UTF-8 与 GBK 编码转换 */ package main import ( "bytes" "fmt" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" "io/ioutil" ) // GBK 转 UTF-8 func GbkToUtf8(s []byte) ([]byte, error) { reader := transform.NewReader(bytes.NewReader(s), simplifiedchinese.GBK.NewDecoder()) d, e := ioutil.ReadAll(reader) if e != nil { return nil, e } return d, nil } // UTF-8 转 GBK func Utf8ToGbk(s []byte) ([]byte, error) { reader := transform.NewReader(bytes.NewReader(s), simplifiedchinese.GBK.NewEncoder()) d, e := ioutil.ReadAll(reader) if e != nil { return nil, e } return d, nil } // 编码转换测试 func main() { s := "[debug]: 编码转换测试" gbk, err := Utf8ToGbk([]byte(s)) if err != nil { fmt.Println(err) } else { fmt.Println(string(gbk)) } utf8, err := GbkToUtf8(gbk) if err != nil { fmt.Println(err) } else { fmt.Println(string(utf8)) } }
https://studygolang.com/articles/32899?fr=sidebar