在笔记本中写了一个简易web程序,但是编译失败,提示“syntax error: nested func not allowed” 。

不明白什么意思,幸好代码量小,原来是方法的末尾的“}”丢了

package main

import "fmt"
import "net/http" func main() { http.HandleFunc("/", hello)
err := http.ListenAndServe(":8080", nil) if err != nil {
fmt.Println(err)
} } func hello(rw http.ResponseWriter, r *http.Request) { fmt.Fprintf(rw, "Hello lao yu !\n")
}

添加缺失的“}”后,编译通过!

到底提示的错误信息是什么呢? 原来是告知“不允许函数嵌套” 。

好了,仅此记录出现过的错误。

golang build error: syntax error: nested func not allowed的更多相关文章

  1. Parse error: syntax error, unexpected T_PUBLIC in 问题解决

    class 类中 public function _getInfo($sn){        $title = '';        $_array = explode('~', $sn);      ...

  2. *2 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '[' in /application/nginx-1.6.3/html/zabbix/index.php on line 32" while reading response header from upstream, clien

    今天呢想学习一下zabbix监控一下我的服务情况,然后就开始安装我的zabbix服务,首先LNMP环境准备好了,Nginx版本为1.6.3,php版本为5.3.27,MySQL版本为二进制包安装的5. ...

  3. zabbix3.0 安装时出现PHP Parse error: syntax error

    httpd的错误日志 [Sun Mar :: ] [error] [client 由于系统yum默认安装的php版本是5.3.3 zabbix 3.0支持的平台,只支持php5.4以上的版本https ...

  4. mysql报错sql injection violation, syntax error: syntax error, expect RPAREN, actual IDENTIFIER

    mysql报错sql injection violation, syntax error: syntax error, expect RPAREN, actual IDENTIFIER 处理,在控制台 ...

  5. 页面白屏并且报错PHP Parse error: syntax error, unexpected end of file in 试了很久总算解决了

    页面白屏并且报错PHP Parse error:  syntax error, unexpected end of file in 试了很久 啥短标记,打开,都试了 最简单的办法 是重新建立一个文件, ...

  6. JQuery - 特殊字符转义(Uncaught Error: Syntax error, unrecognized expression:的处理)

    今天在改一个jQuery老项目时候,发现标签上的data-id中含有特殊字符时候报错Uncaught Error: Syntax error, unrecognized expression,如何处理 ...

  7. PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法

    出现这个错误的原因就是语法错误,肯定是PHP程序的书写不规范造成,PHP语句标识符错了,没有在php.ini中开启短标签!八成是这个原因,啊啊啊! 今天在写PHP程序的时候总是出现这样的错误:Pars ...

  8. Hibernate 执行sql语句返回yntax error: syntax error, expect LPAREN, actual NOT not

    hibernate自动创建表时提示 :  ERROR: sql injection violation, syntax error: syntax error, expect LPAREN, actu ...

  9. Parse error: syntax error, unexpected end of file in *.php on line * 解决方法

    Parse error: syntax error, unexpected end of file in *.php on line * 解决方法   这篇文章主要介绍了PHP错误Parse erro ...

随机推荐

  1. Enlish相关术语

    APM 自动编程机(Automatic Programming Machine) 高级电源管理(Advanced Power Management) OSD 屏幕显示(On Screen Displa ...

  2. 数论 + 容斥 - HDU 1695 GCD

    problem's Link mean 给定五个数a,b,c,d,k,从1~a中选一个数x,1~b中选一个数y,使得gcd(x,y)=k. 求满足条件的pair(x,y)数. analyse 由于b, ...

  3. [转]seajs详解

    [转]seajs详解 SeaJS 是一个遵循commonJS规范的javascript模块加载框架,可以实现javascript的模块化开发和模块化加载(kk:模块可按需加载或全部加载). SeaJS ...

  4. JavaScript的parseint()函数

    定义和用法 parseInt() 函数可解析一个字符串,并返回一个整数. 语法 parseInt(string, radix) 参数 描述 string 必选项.要转换为数字的字符串. radix 可 ...

  5. node 下好用的工具

    1. supervisor Node Supervisor is used to restart programs when they crash. Node Supervisor 是用来当程序崩溃时 ...

  6. Spring_day02--Spring的aop操作

    Spring的aop操作 1 在spring里面进行aop操作,使用aspectj实现 (1)aspectj不是spring一部分,和spring一起使用进行aop操作 (2)Spring2.0以后新 ...

  7. 调用组件的C++代码

    #include<stdio.h>#include "LJSummary.h"#include<iostream>int main(void){ print ...

  8. 面试题思考:Java RMI与RPC,JMS的比较

    RPC:(Remote Procedure Call)  被设计为在应用程序间通信的平台中立的方式,它不理会操作系统之间以及语言之间的差异. 支持多语言 RMI:(Remote Method Invo ...

  9. 扩展jquery scroll事件,支持 scroll start 和 scroll stop

    效果预览: github: https://besswang.github.io/webapp-scroll/ 参考地址: http://www.ghugo.com/special-scroll-ev ...

  10. Android得到SD卡文件夹大小以及删除文件夹操作

    float cacheSize = dirSize(new File(Environment.getExternalStorageDirectory() + AppConstants.APP_CACH ...