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的更多相关文章

  1. A Tour of Go Map literals

    Map literals are like struct literals, but the keys are required. package main import "fmt" ...

  2. A Tour of Go Struct Literals

    A struct literal denotes a newly allocated struct value by listing the values of its fields. You can ...

  3. go官网教程A Tour of Go

    http://tour.golang.org/#1 中文版:http://go-tour-cn.appsp0t.com/#4 package main import ( "fmt" ...

  4. go语言笔记——map map 默认是无序的,不管是按照 key 还是按照 value 默认都不排序

    示例 8.1 make_maps.go package main import "fmt" func main() { var mapLit map[string]int //va ...

  5. Dart 基础重点截取 Dart 2 20180417

    官网教程 https://www.dartlang.org/guides/language/language-tour dart是一个单线程的语言,没有多线程 Final and const If y ...

  6. Go structs、slices、maps

    [Go structs.slices.maps] 1.定义时*在变量名后面,使用时*在变量名前面. 2.定义struct,type在前,struct关键字在后. 3.指针可以指定struct. 4.A ...

  7. 来自 Thoughtram 的 Angular 2 系列资料

    Angular 2 已经正式 Release 了,Thoughtram 已经发布了一系列的文档,对 Angular 2 的各个方面进行深入的阐释和说明. 我计划逐渐将这个系列翻译出来,以便对大家学习 ...

  8. 【GoLang】50 个 Go 开发者常犯的错误

    1. { 换行:   Opening Brace Can't Be Placed on a Separate Line 2. 定义未使用的变量:  Unused Variables 2. import ...

  9. [转]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 ...

随机推荐

  1. Linux---More命令 初级实现

    Linux: more已实现:more filename , quit不需要回车未实现:command | more 重定向 ,显示百分比 Waiting... /* Linux: more 已实现: ...

  2. linux查看在线用户 who命令参数及用法

    linux who 命令 详解 Linux最常用命令之一 功能说明:显示目前登入系统的用户信息. 语 法:who [-Himqsw][--help][--version][am i][记录文件] 补充 ...

  3. nginx如何解决超长请求串

    nginx是一个强大的http服务器,但是在使用过程中发现,当遇到超长的post请求或者get请求时,nginx会返回413.400.414等状态码,这是因为请求串长度超过了nginx默认的缓存大小或 ...

  4. 210. Course Schedule II

    题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have ...

  5. UVA548——Tree(中后序建树+DFS)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  6. Android性能优化典范 - 第2季

    Google发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的缩放,缓 ...

  7. P44、面试题4:替换空格

    题目:请实现一个函数,把字符串中的每个空格替换成“%20”.例如输入“We are happy.”,则输出“We%20are%20happy.”. 如果用java string类中提供的replace ...

  8. R语言学习笔记:查看函数的R源代码

    getAnywhere 该函数可以返回一些函数的R源代码,如: getAnywhere(kmeans) 该函数具体用法,请参看官方说明. Retrieve an R Object, Including ...

  9. API HOOK技术

    API HOOK技术是一种用于改变API执行结果的技术,Microsoft 自身也在Windows操作系统里面使用了这个技术,如Windows兼容模式等. API HOOK 技术并不是计算机病毒专有技 ...

  10. poj 3253 Fence Repair (哈夫曼树 优先队列)

    题目:http://poj.org/problem?id=3253 没用long long wrong 了一次 #include <iostream> #include<cstdio ...