我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在go中创建字符串切片的地图

I am try to create a map of string slice with the code in GO

newMap := map [string][]string{
    "first" : {
        "good", "bad"
    },
    "second" : {
        "top", "bottom"
    }
}

It seems not to be the right way, what is the wrong with it?

You have to add a comma , at the end of each initializer list.

newMap := map [string][]string{
    "first" : {
        "good", "bad",
    },
    "second" : {
        "top", "bottom",
    },
}

You can find a working example here.

近期文章

  • 测试从恐慌中恢复
  • (Golang)JWT签名验证问题
  • 简单的Go Web服务器,在客户端看不到响应
  • Go功能字段设置器为什么不保留功能?
  • GoLang-观看视频(以字节为单位)
  • 装入包装内容,而后不使用其名称
  • 在golang中,TCPConn.Write / Read将返回什么错误?
  • 从远程主机获取接受自签名证书
  • Golang程序挂起而未完成执行
  • BCrypt比较两个哈希不相等
  • 在Go中声明变量
  • 从环境中获取变量吗?
  • 什么时候应该使用ParseForm,什么时候应该使用FormValue和PostFormValue?
  • 前往:JSON封送错误
  • 没有消息正文的GoLang Gin框架状态代码
  • 检查恐慌而无法恢复
  • 切片声明和初始化之间的区别
  • 是否需要检查Golang中的Write返回的“ n”
  • Golang与JavaScript(v8 / node.js)地图性能
  • 转到:如何将扩展名(subjectAltName)添加到x509.Certificate?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华