zoukankan      html  css  js  c++  java
  • go tour 笔记 day1

    go get 访问github太慢需要配置代理,设置环境变量 http_proxy=http://127.0.0.1:xxxx 算是比较方便的一种

    ref: https://blog.csdn.net/zhyhang/article/details/78444974

    PS:也试过配置git config,但是好像没起作用,原因不明

    Go Tour

    坑1:文档里面的 go get -u github.com/Go-zh/tour tour 其实是两条命令,tour 是单独的运行指令

    坑2:defer那里稍微花了点时间理解运行流程,总的来说就是return后执行没错

    进度:目前看到 https://tour.go-zh.org/moretypes/24 函数值这里。

    吐槽

    if,for,switch这三种语句都只允许条件前面多一条语句,不像elixir的with可以来N条。

    到目前为止虽然引入了type关键词,但只涉及struct类型,自己随便试了下type一个map类型,然后make它,果然是可以的(其实文档里完全可以在map那节里面加入这个细节)。

    指针还是一如既往的老套,不过诚如所言,没有c指针的值运算。

    builtin function的源码很分散,一个make不过是在编译期翻译成对应类型的make函数再插入原文里。

    根据这里[https://stackoverflow.com/questions/18512781/built-in-source-code-location]所示,举了三个例子:

    https://github.com/golang/go/blob/master/src/runtime/slice.go < makeslice - make([]int, 10)

    https://github.com/golang/go/blob/master/src/runtime/hashmap.go < makemap - make(map[string]int)

    https://github.com/golang/go/blob/master/src/runtime/chan.go < makechan - make(chan int)

    PS: append和copy和make同理。

    暂时就这些。

  • 相关阅读:
    洛谷1462 通往奥格瑞玛的道路 二分+spfa
    NumPy 排序、条件刷选函数
    NumPy 统计函数
    2019-3-10——生成对抗网络GAN---生成mnist手写数字图像
    python if __name__ == 'main' 的作用和原理()
    Python os.getcwd()
    numpy.random.uniform()
    tf.trainable_variables()
    tf.layers.dense()
    彻底弄懂tf.Variable、tf.get_variable、tf.variable_scope以及tf.name_scope异同
  • 原文地址:https://www.cnblogs.com/pyzh/p/12976138.html
Copyright © 2011-2022 走看看