package main: read unexpected NUL in input

我的问题:

go build -o wfs_server wfs_server_lite.go wfs_websockets_hub.go

解决方法:

go build -o wfs_server.exe wfs_server_lite.go wfs_websockets_hub.go

今天在win7上安装了golang(go语言)开发环境。按照Runoob教程上提供的说明,进行了环境的配置。但是,在进行Hello world测试时,出现了 package main: read unexpected NUL in input 错误。开始以为是环境变量错误,重新配置了几遍,还是没有解决问题。最后,发现是源程序文档编码格式错误!

解决办法
使用notepad进行源代码文档编辑,选择编码格式为UTF-8格式;

错误原因
As a side note: Windows has funny (somewhat inaccurate) names:

Both UTF-8 and UTF-16 formats use unicode code points. Windows calls UTF-16
LE "Unicode". As go source code uses UTF-8, typical ASCII range characters
are 1 byte each
'h' 'e' 'l' 'l' 'o'
while UTF-16 are two bytes each:
0 'h' 0 'e' 0 'l' 0 'l' 0 'o'

Thus because the Go compiler expects UTF-8, it interperts the UTF-16 zero
bytes as invalid NULL characters.
-Daniel

package main: read unexpected NUL in input相关推荐

  1. spray.json.JsonParser$ParsingException: Unexpected end-of-input at input index

    完整报错如下: Exception in thread "main" spray.json.JsonParser$ParsingException: Unexpected end- ...

  2. java.io.eof_java.io.IOException: java.io.EOFException: Unexpected end of input stream错误

    报错现象: Diagnostic Messages for this Task: Error: java.io.IOException: java.io.EOFException: Unexpecte ...

  3. unexpected symbol、unexpected end of input

    unexpected symbol.unexpected end of input 问题: # 不是一个合法的表达式(expression) parse(text = "2^") ...

  4. hadoop异常: java.io.EOFException: Unexpected end of input stream

    hadoop异常: java.io.EOFException: Unexpected end of input stream 参考文章: (1)hadoop异常: java.io.EOFExcepti ...

  5. 浏览器报错:unexpected end of input 解决方法

    浏览器报错:unexpected end of input 解决方法 参考文章: (1)浏览器报错:unexpected end of input 解决方法 (2)https://www.cnblog ...

  6. Uncaught SyntaxError: Unexpected end of input

    Uncaught SyntaxError: Unexpected end of input 最近做项目遇到这样一个问题Uncaught SyntaxError: Unexpected end of i ...

  7. Uncaught SyntaxError: Unexpected end of input 解决办法

    Unexpected end of input 的英文意思是"意外的终止输入".这行报错一般都是代表我们浏览器在读取我们的js代码时,碰到了不可预知的错误,导致浏览器 无法进行下面 ...

  8. 菜尼奥排错之keras TypeError: _init_subclassed_network() got an unexpected keyword argument ‘input‘

    环境版本: Ubuntu 18.04.2 LTS Nvidia GeForce RTX2080super CUDA Version 10.0 tensorflow-gpu 1.13.1 keras 2 ...

  9. electron 实现index.html与main.js通讯,获取input输入框数据。

    我都知道一个electron程序 需要 index.html,main.js,package.json: 这一点其他文章都有讲述 我就不再赘述了: 可以参考: Electron桌面应用打包流程 本文着 ...

最新文章

  1. 网络推广公司浅析网站栏目页该如何优化?
  2. 学习笔记:linuxsocket通信基础
  3. python 网络编程_Python网络编程(六)
  4. Java位操作:如何将long类型的指定位设置为0或1?How to set/unset a bit at specific position of a long?
  5. POJ 2513 Colored Sticks
  6. Ubuntu16.04以root身份登入!
  7. Arduino笔记-呼吸流水灯
  8. OpenShift ocp packages
  9. JDK8新特性(九)之Stream流的find()、max()、min()、reduce()方法
  10. Web 2.0理念在产品应用中的借鉴之处
  11. C语言面试常见问题总结
  12. 寻找肇事汽车车牌号C语言,北京交通大学C语言综合程序的设计(黄宇班).doc
  13. Mysql全国省区县地区码
  14. 调查问卷或量表用总分还是平均分好?
  15. 吉利远景 SUV 升级车机系统 MCU 及 SPD 的一些问题
  16. Axure使用教程(二)、动态面板
  17. UFS 理解 - Reference Clock
  18. chan算法matlab,MATLAB实现基于Chan氏算法的二维TDOA定位-Go语言中文社区
  19. PPT修改尺寸(修改幻灯片大小)
  20. mysql rman_利用RMAN把ORACLE10G64位降级为32位_MySQL

热门文章

  1. 开机时不显示启动菜单grub
  2. mysql单机多实例主从_【转载】MySQL单机多实例安装并配置主从复制
  3. matlab rltool,基于Matlab工具箱Rltool的控制系统校正设计
  4. C 把两个bitmap文件合并成一个bitmap文件
  5. oracle冷备份 代码,Oracle冷备份和恢复自动产生sql源代码
  6. linux centos 6.8svn,CentOS6.8 安装配置以SVNAdmin管理SVN代码库
  7. ubuntu mysql5.6 编译安装_Ubuntu14.04编译安装mysql5.6.26
  8. hashcode相等的两个对象一定相等吗_为什么重写 equals方法时一定要重写hashCode方法?...
  9. 随动系统控制c语言源程序,基于DSP的小功率随动系统的控制器设计及优化
  10. mega_[MEGA DEAL] 2018 Essential JavaScript编码捆绑包(96%折扣)