A Tour of Go Map literals continued
If the top-level type is just a type name, you can omit it from the elements of the literal.
package main
import "fmt"
type Vertex struct {
Lat, Long float64
}
var m = map[string]Vertex {
"Bell Labs": {40.68433,-74.39967},
"Google": {37.42202, -122.08408},
}
func main() {
var m2 map[int]uint8
m2 = make(map[int]uint8)
m2[] = uint8()
m2[] = uint8()
fmt.Println(m)
fmt.Println(m2)
}
A Tour of Go Map literals continued的更多相关文章
- A Tour of Go Map literals
Map literals are like struct literals, but the keys are required. package main import "fmt" ...
- A Tour of Go Struct Literals
A struct literal denotes a newly allocated struct value by listing the values of its fields. You can ...
- go官网教程A Tour of Go
http://tour.golang.org/#1 中文版:http://go-tour-cn.appsp0t.com/#4 package main import ( "fmt" ...
- go语言笔记——map map 默认是无序的,不管是按照 key 还是按照 value 默认都不排序
示例 8.1 make_maps.go package main import "fmt" func main() { var mapLit map[string]int //va ...
- Dart 基础重点截取 Dart 2 20180417
官网教程 https://www.dartlang.org/guides/language/language-tour dart是一个单线程的语言,没有多线程 Final and const If y ...
- Go structs、slices、maps
[Go structs.slices.maps] 1.定义时*在变量名后面,使用时*在变量名前面. 2.定义struct,type在前,struct关键字在后. 3.指针可以指定struct. 4.A ...
- 来自 Thoughtram 的 Angular 2 系列资料
Angular 2 已经正式 Release 了,Thoughtram 已经发布了一系列的文档,对 Angular 2 的各个方面进行深入的阐释和说明. 我计划逐渐将这个系列翻译出来,以便对大家学习 ...
- 【GoLang】50 个 Go 开发者常犯的错误
1. { 换行: Opening Brace Can't Be Placed on a Separate Line 2. 定义未使用的变量: Unused Variables 2. import ...
- [转]50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ 50 Shades of Go: Traps, Gotc ...
随机推荐
- MysqlHelper类
连接方式:server=localhost;port=3306;userid=root;password=123456789;database=mysql;persist security info= ...
- [译]C++书籍终极推荐
转载声明: 翻译仅以技术学习和交流为目的,如需转载请务必标明原帖链接. 来源:http://stackoverflow.com/questions/388242/the-definitive-c-bo ...
- MapReduce编程系列 — 3:数据去重
1.项目名称: 2.程序代码: package com.dedup; import java.io.IOException; import org.apache.hadoop.conf.Configu ...
- 使用Mysql命令一次性备份多个数据库(所有数据库)
通过CMD命令窗口 1.找到Mysql的安装目录\mysql\BIN目录 2. 输入mysqldump --all-databases -h127.0.0.1 -uroot -p123456 > ...
- 【原创】基于ZYNQ7000的交叉编译工具链Qt+OpenCV+ffmpeg等库支持总结(二)
承接上文http://www.cnblogs.com/bombe1013/p/3294301.html,我们接下来说说Qt的移植与安装. 很喜欢Qt这个库以及Qt creater这个IDE,其实个人觉 ...
- [.NET WebAPI系列01] WebAPI 简单例子
[源] 来自微软WebAPI官方视频,Introduction to the ASP.NET Web API --Uniform Interface -- Demo-Using convention ...
- Hibernate解决高并发问题之:悲观锁 VS 乐观锁
高并发问题是程序设计所必须要解决的问题,解决此类问题最主要的途径就是对对程序进行加锁控制.hibernate对加锁机制同样做出了实现,常用加锁方式为悲观锁和乐观锁.悲观锁指的是对数据被外界(包括本系统 ...
- I.MX6 Android Linux shell MMPF0100 i2c 设置数据
#!/system/bin/busybox ash # # I.MX6 Android Linux shell MMPF0100 i2c 设置数据 # 说明: # 本文主要记录通过shell脚本来设置 ...
- 嵌入式Linux启动过程中的问题积累
嵌入式Linux启动过程中的问题积累 Dongas 07-12-19 1.Bad Magic Number ## Booting image at 33000000 ... Bad Magic Num ...
- 【Linux.Python】Python进程后台启动
嗯,比较忧伤. 前几天写了个tornado,启动了,很开心,后来每天要用时都发现it是kill掉的.好吧,是我太蠢啦.百度了下资料 python的启动方式: 1 python yourfile.py ...