Chinese takes three bytes in the Go language, Len or range a Chinese string is different from what we expected.UTF8 for length. Runecountinstring, traversing with RuneFunc Main () { txt:"ABC good learning " fmt. Println ("len Length:", Len
Recently in the development process encountered several goroutine communication problems, I think these questions are very representative, so take out and share with you.
Check if channel is closed
In the development process encountered such a
1. Go Environment installation
SOURCE Installation
wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gztar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
Set environment variables,
vim /etc/profile
Then add the environment variables, Gopath is
Map must be familiar to everyone, below a simple record of today's development encountered pit.
Basic Concepts > dictionaries (MAP)
A dictionary is a set of unordered, key-value pairs. A dictionary is also called an associative array, because the
Sort. Slice is a method of slicing sorting provided by Golang,
Where the reflection (reflect) package is used
241 // Slice sorts the provided slice given the provided less function.242 //243 // The sort is not guaranteed to be stable. For
In the development. Sometimes we may be using git to introduce another Git repository under the project directory from the Web.
Such as. When I use the Vendor directory to store my Golang dependent libraries. Because the library in this directory is
Drop, drip ... Why is such a beginning, brush vibrato understand, there is a period of time driving in the road, a bunch of shaking friends by the horn let you pick up the signal, embarrassed a embarrassed, that this and today talk about the topic
have been concerned about Golang and Kotlin, just recently a small project, considered a, decided to use Golang try.Had to spit on the groove, Golang's reliance on management is really pretty rotten, and maven, NPM this completely can't be compared,
Sensitivewords
Get
GitHub Address: Https://github.com/TomatoMr/SensitiveWords.git
Or
Go get github.com/tomatomr/sensitivewords
Introduction
Sensitivewords is a sensitive vocabulary detection plug-in based on the DFA algorithm, which can be deployed
First, the Language foundation
Main.main function Execution procedureImage.png
Slice the underlying array part is passed by an implicit pointer (the pointer itself is a value, only pointing to the same data), and the callee modifies the data
Since I started writing code with GO, it has been a puzzle for me how to organize my Code and use the Package keyword. The package keyword is similar to a namespace in C #, but its convention is to bind the package name to the directory structure.
Fallen for a period of time, and finally found the motivation to study, full of blood back ...
We know that in the full swing of the blockchain application of the Red Sea, Golang more and more play an irreplaceable role. On the one hand, it is based
Given an example, use Mime/multipart to implement how the client uploads a file to the server, and then how the server accepts the file.
See Server.go Code
package mainimport ( "io" "os" "fmt" "io/ioutil" "net/http")func uploadHandler(
WIN10_WSL installation Golang
1 ~ WSL Installation
1. Open Win10 Bash on the Ubuntu on Windows feature
Open Windows设置 (shortcut key win+i) search应用和功能
Select the relevant settings in the upper left程序和功能
In the new window,
The following preparations are required to successfully compile ontology:
Golang version 1.9 and above
Install the third-party package management tool Glide
The right Go language development environment
Operating systems supported by the
package mainimport ( "fmt")func main() { s := []interface{}{1, 2, 3, 4, 5, 6, 7, 8}HERE: for k, v := range s { if v == 4 || v == 6 || v == 7 { // temp := s[k+1:] fmt.Println("k", k) temp :=
Through sync. Once instance to ensure that the do of a once instance is executed only once, regardless of whether the Func in do has multiple or one, using this feature to implement the singleton pattern in the design pattern, there is no such thing
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.