This is a creation in Article, where the information may have evolved or changed.
The boundary of the defer
Defer is a function-bound, that is, it will only run when the current function is going to exit.
Return of Nested Channel Select
① for nested the same channel select, how to want to return layers, the best way is to directly close the channel
Package Listen Mainimport ("FMT" "Time") Func listen to main () Listen {Stopc Listen: = Listen to make (chan listen int) go listen to Func () Listen {Select Listen {case listen to <-stopc:fmt. Println ("Stopc Listen 0") Select Listen {case listen to <-stopc:fmt. Println ("Stopc listen 1")}fmt. Println ("Stopc Listen 2")}} ()//listen to STOPC <-listen to 2//listen to Stopc listen to <-listen to 2close (STOPC) time. Sleep (time. Second listen to 5)}
Also See:go Sandbox
Fork the correct posture of the other project
For example, there is a project "Http://github.com/sirupsen/logrus", you see he is a little uncomfortable want to pity dorado things. So fork a new project "Http://github.com/auxten/logrus", but the code will have a lot of "import" Http://github.com/sirupsen/logrus/xxx ""
You go directly to modify the code project will still refer to the original, pull request the original author can not be passed quickly, urgent, how to do?
①go get someone else code here is listen
Go Listen get Listen Github.com/sirupsen/logrus
② add a new remote to your project directly, pointing to your own repo, command:
Git listen to remote listen add listen to Auxten listen to Git@github.com:auxten/logrus.git
③ Create a new branch, called the Aux Bar, and let the branch point to this remote. Command:
GIT Listen checkout listen-B listen to aux listen && listen git listen to branch listen to-u listen to auxten/master listen to aux
④ the final. Git/config probably looks like this:
[Core] Listen to hear repositoryformatversion listen = Listen to listen to listen to listen to hear the 0 listen to listen listen to listen to hear FileMode hear Listen true listen to listen to listen ignorecase listen to listen to listen to true listen to hear precomposeunicode listen to listen to True[remote listen to "origin" listen to hear the URL listen = Listen to https://github.com/sirupsen/ Logrus Listen, listen, listen, listen and listen to +refs/heads/*:refs/remotes/origin/*[remote listen to the "Auxten" listen to the URL listen to listen to hear = listen to git@github.com:auxten/ Logrus.git Listen, listen, listen, hear, hear, listen to the +refs/heads/*:refs/remotes/auxten/*[branch listen to "aux" Listen to listen to listen to the remote listen to listen to hear the Auxten listen to listen to hear listen to hear the merge listen Listen Refs/heads/master[push] Listen to the default listen = Listen to upstream
⑤push code is used
Git listen push Listen-U listen to Auxten listen to Aux:master
This command means: Push and set the upstream of Aux to Auxten master.
The method is not perfect, but at least it is more elegant to solve the problem of local development compilation.
listen python actual Combat class introduction --- November 26 (Saturday) class opened
This article is from the "Reboot DevOps Development" blog, please be sure to keep this source http://opsdev.blog.51cto.com/2180875/1884242