import "io/ioutil"

func main() {
content, err = iotuil.ReadFile("somefile.txt")
// etc..
}

=》

I guess this doesn't really answer your question, but if you want, you can actually call the methods without explicitly stating the package - just import with a . in front of the names (but this is not recommended; see below):

package main

import (
. "fmt"
. "io/ioutil"
) func main () {
content, err := ReadFile("testfile")
if err != nil {
Println("Errors")
}
Println("My file:\n", string(content))
}

Note @jimt's comment below - this practice is not advised outside of tests as it could cause name conflicts with future releases. Also, definitely agree with @DavidGrayson's point of being nicer to read/see where things come from.

参考:https://stackoverflow.com/questions/12925450/importing-packages-in-go

最新文章

  1. 电脑莫名其妙的被装上了流氓软件DNSunlocker的解决办法
  2. poj1741 (点分治)
  3. PTA Hashing
  4. juery与表单中name="nodeName"引起的冲突
  5. iOS支持图文混排的按钮(UIButton)
  6. select实现选中跳转
  7. STM32F4系统时钟配置及描述
  8. Servlet3.1规范和JSP2.3规范
  9. 201521123047 《Java程序设计》第4周学习总结
  10. Writing Science 笔记 6.20
  11. Python中的正则表达式(re)
  12. Hessian学习(springboot环境)
  13. C. Ehab and a 2-operation task
  14. 黄聪:HBuilder复制PHP项目后,【转到定位】功能失效
  15. 【Spring】SpringMVC之上传文件
  16. WebRTC 源码分析(四):VideoCRE 与内存抖动优化
  17. jsp页面的el表达式取数据
  18. React Native教程
  19. ubuntu自带截图工具gnome-screenshot
  20. C++解析(26):函数模板与类模板

热门文章

  1. 新浪云虚拟机ftp链接显示失败问题
  2. 设计模式——“signleton”
  3. JS——switch case
  4. TensorFlow:Windows下使用TensorFlow-Python版本
  5. python os os.path模块学习笔记
  6. ECharts实例开发学习笔记二——时间轴
  7. 视频cover占满
  8. php base64互转pdf
  9. 破解js中的this指向
  10. C++入职学习篇--代码规范(持续更新)