Git Product home page Git Product logo

go-recipes's Introduction

Go 语言经典知识总结

基于混合线程的并发编程模型自然不必多说

在数据类型方面有

  • 基于底层数组的切片
  • 用来传递数据的通道
  • 作为一等类型的函数
  • 可实现面向对象的结构体
  • 能无侵入实现的接口等

在语法方面有

  • 异步编程神器go语句
  • 函数的最后关卡defer语句
  • 可做类型判断的switch语句
  • 多通道操作利器select语句
  • 非常有特色的异常处理函数panic和recover

测试go程序的主要方式

  • 独立的测试源码文件
  • 三种功用不同的测试函数
  • 专用的testing代码包
  • 功能强大的go test 命令

go语言同步、并发编程工具

  • 经典的互斥锁
  • 读写锁
  • 条件变量
  • 原子操作

go语言特有的数据类型

  • 单次执行小助手 sync.Once
  • 临时对象池 sync.Pool
  • 帮助我们实现多 goroutine 协作流程的 sync.WaitGroup、context.Context
  • 一种高效的并发安全字典 sync.Map

go-recipes's People

Contributors

taylorchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.