The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
46fo

为什么 go 安装包不包含 golang.org/x/net/context 进去?

  •  
  •   46fo · Jan 20, 2017 · 1977 views
    This topic created in 3585 days ago, the information mentioned may be changed or developed.
    添加完 sqlite 后编译提示 cannot find package "golang.org/x/net/context" in any of: ,发现这个谷歌自己的,且好像还有其他的包,好奇问为啥不直接添加进安装包里去???
    4 replies  •  2017-02-08 10:00:28 +08:00
    wweir
    wweir
    Jan 20, 2017❤️1
    1
    那是因为它包含到 "context" 包里了,这个是作为 1.7 的特性被写到 release note 里的。
    改个导入地址吧,不少第三方包没能在这半年半年内跟上 go 的节奏。
    janxin
    janxin
    Jan 20, 2017 via iPhone❤️1
    2
    这个功能是 1.7 的新功能,考虑到很多版本并未迁移的用户所以保留了这个路径。如果你使用了 1.8 版本的 go ,可以使用 go fix 自动修复
    Reficul
    Reficul
    Jan 20, 2017 via Android❤️1
    3
    想起来因为自动 import 导致两个文件导入了不同的 context 的悲剧事件😂
    JohnSmith
    JohnSmith
    Feb 8, 2017 via iPhone
    4
    不同 context 其实很多时候使用得当可以兼容,毕竟他们有相同的 interface
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1996 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 14:30 · PVG 22:30 · LAX 06:30 · JFK 09:30
    ♥ Do have faith in what you're doing.