zoukankan      html  css  js  c++  java
  • 后端程序员之路 53、A Tour of Go-3

    #method
        - Methods
            - Go does not have classes. However, you can define methods on types.
            - func (f MyFloat) Abs() float64 {
        - Interfaces
            - type Abser interface { Abs() float64 }
            - One of the most ubiquitous interfaces is Stringer defined by the fmt package.
            - Go programs express error state with error values.
            - The io package specifies the io.Reader interface, which represents the read end of a stream of data.
            - Package image defines the Image interface

    # concurrency
        - Goroutines - go say("world")
        - Channels
            - Channels are a typed conduit through which you can send and receive values with the channel operator, <-.
            - ch := make(chan int)
            - ch <- v    // Send v to channel ch.
            - v := <-ch  // Receive from ch, and assign value to v.
            - Buffered Channels - ch := make(chan int, 100)
        - Select
            - The select statement lets a goroutine wait on multiple communication operations.
            - The default case in a select is run if no other case is ready.
            - sync.Mutex
                - mux sync.Mutex
                - c.mux.Lock()
                - defer c.mux.Unlock()

    A Tour of Go
    https://tour.golang.org/list

  • 相关阅读:
    【HDOJ】2102 A计划
    this关键字
    static(静态、修饰符)
    手势抽取过程&代码复用
    Android:padding和android:layout_margin的区别
    平移动画
    读取系统联系人
    获取sim卡序列号
    图片选择器
    md5加密过程
  • 原文地址:https://www.cnblogs.com/zapline/p/6835882.html
Copyright © 2011-2022 走看看