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

  • 相关阅读:
    SQL序列键
    SQL日期跟时间值序列
    springboot日志配置
    weblogic10补丁升级与卸载
    idea使用svn报错
    mybatis插入数据并返回主键(oracle)
    UTF-8格式txt文件读取字节前三位问题
    https连接器
    git将本地项目上传码云
    aop的使用
  • 原文地址:https://www.cnblogs.com/zapline/p/6835882.html
Copyright © 2011-2022 走看看