zoukankan      html  css  js  c++  java
  • Golang-错误大全

     

    .customerView.go:28:13: empty character literal or unescaped ' in character literal
    .customerView.go:34:12: empty character literal or unescaped ' in character literal
    .customerView.go:37:12: empty character literal or unescaped ' in character literal
    

     报错原因:声明空字符串变量用单引号时 

    .customerView.go:75:6: syntax error: unexpected main, expecting (
    .customerView.go:76:2: syntax error: unexpected var at end of statement
    

     报错原因:语法错误

    ..servicecustomerService.go:26:37: invalid indirect of customer (type model.Customer)
    

     报错原因:传参类型错误,注意函数要求传的是值类型还是指针类型

    TestaddUpper has malformed name: first letter after 'Test' must not be lowercase

     报错原因:测试函数命名不规范 比如:TestaddUpper  应该改为 TestAddUpper

    fatal error: concurrent map writes

     报错原因:并发写操作。开启多个协程的时候如果没有处理好资源机制就会报该错。解决方案1、加互斥锁(存在一个等待时间的问题),2、channel

    go mod init: modules disabled by GO111MODULE=off; see 'go help modules'
    

     go mod管理包,set GO111MODULE=on   window 得用管理员才能更改

     
    type MenberDao struct {
    	*tool.Orm
    }
    初始化
    dao.MenberDao{ tool.DbEngine }
    会出现警告:composite literal uses unkeyed fields

      原因:结构体无键字段初始化,就会警告

  • 相关阅读:
    Binary Tree Paths
    Implement Stack using Queues
    Path Sum II
    Path Sum
    Plus One
    Add Digits
    Missing Number
    H-Index II
    H-Index
    Ugly Number II
  • 原文地址:https://www.cnblogs.com/Essaycode/p/12670770.html
Copyright © 2011-2022 走看看