case 1

// helloworld.go
package main import "fmt" func main() {
fmt.Println("Hello, 世界")
}
go run helloworld.go

go build helloworldgo
./helloworld

 

case 2

package  main

import (
"fmt"
"os"
) func main() {
var s, sep string
for i := 1; i < len(os.Args); i++ {
s += sep + os.Args[i]
sep = " "
}
fmt.Println(s)
}

case 3 package main

import (
"fmt"
"os"
) func main() {
var s, sep string
for i, arg := range os.Args[1] {
fmt.Println(i, arg)
s += sep + arg
sep = " "
}
fmt.Println(s)
}

  

case 4 - http

package main

import (
"fmt"
"net/http"
) func IndexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello world")
} func main() {
http.HandleFunc("/", IndexHandler)
http.ListenAndServe("127.0.0.1:8000", nil)
}

case 5 - http prometheus

package main

import (
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":8080", nil))
}

  

go chapter 1的更多相关文章

  1. Modern C++ CHAPTER 2(读书笔记)

    CHAPTER 2 Recipe 2-1. Initializing Variables Recipe 2-2. Initializing Objects with Initializer Lists ...

  2. Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- ApiWrapper

    前面两片文章讲解了通过AIDL和Messenger两种方式实现Android IPC.而本文所讲的并不是第三种IPC方式,而是对前面两种方式进行封装,这样我们就不用直接把Aidl文件,java文件拷贝 ...

  3. Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- Messenger

    Messenger类实际是对Aidl方式的一层封装.本文只是对如何在Service中使用Messenger类实现与客户端的通信进行讲解,对Messenger的底层不做说明.阅读Android Prog ...

  4. [转]第四章 使用OpenCV探测来至运动的结构——Chapter 4:Exploring Structure from Motion Using OpenCV

    仅供参考,还未运行程序,理解部分有误,请参考英文原版. 绿色部分非文章内容,是个人理解. 转载请注明:http://blog.csdn.net/raby_gyl/article/details/174 ...

  5. 《深入理解计算机系统》 Chapter 7 读书笔记

    <深入理解计算机系统>Chapter 7 读书笔记 链接是将各种代码和数据部分收集起来并组合成为一个单一文件的过程,这个文件可被加载(货被拷贝)到存储器并执行. 链接的时机 编译时,也就是 ...

  6. 《Linux内核设计与实现》Chapter 3 读书笔记

    <Linux内核设计与实现>Chapter 3 读书笔记 进程管理是所有操作系统的心脏所在. 一.进程 1.进程就是处于执行期的程序以及它所包含的资源的总称. 2.线程是在进程中活动的对象 ...

  7. PRML Chapter 2. Probability Distributions

    PRML Chapter 2. Probability Distributions P68 conjugate priors In Bayesian probability theory, if th ...

  8. PRML Chapter 1. Introduction

    PRML Chapter 1. Introduction 为了防止忘记,要把每章的重要内容都记下来,从第一章开始 2012@3@28 今天又回去稍微翻了一下第一章内容,发现第一次看的时候没有看透,每次 ...

  9. MathType 插入定义的chapter and section break后无法隐藏

    每一章标题后面插入一个“Next Section Break”,这样定稿后各章文件组合为总文件后,方程编号会自动递增,如果已经插入了默认的“Equation Chapter 1 Section 1”, ...

  10. WITCH CHAPTER 0 [cry] 绝密开发中的史克威尔艾尼克斯的DX12技术演示全貌

    西川善司的[WITCH CHAPTER 0  cry]讲座 ~绝密开发中的史克威尔艾尼克斯的DX12技术演示全貌   注:日文原文地址: http://pc.watch.impress.co.jp/d ...

随机推荐

  1. Small Multiple

    题目描述 Find the smallest possible sum of the digits in the decimal notation of a positive multiple of ...

  2. 【LibreOJ】#541. 「LibreOJ NOIP Round #1」七曜圣贤

    [题意]一开始车上有编号为0~a的红茶,过程中出现的红茶编号仅有[0,b),有三种操作: 1.买进编号未在车上出现过的红茶. 2.丢掉车上指定编号的红茶. 3.将最早丢出去的红茶捡回来. 每次操作后求 ...

  3. 【HNOI】五彩斑斓 模拟

    [题目描述] 给定一个n*m的矩阵,矩阵的某些位置有一个颜色(可以没有颜色,即为0),现在你可以将矩阵的某一行或者某一列染成同一种颜色,问最少用多少步能达到目标矩阵的染色方案,输出最少步数和方案. [ ...

  4. jqgrid 翻页记录选中行

    简单的jqgrid列表 $("#list").jqGrid({ url:contextPath + "/getList", postData: data, da ...

  5. Spring Cloud Netflix之Eureka 相关概念

    为什么不应该使用ZooKeeper做服务发现 英文链接:Eureka! Why You Shouldn’t Use ZooKeeper for Service Discovery:http://www ...

  6. 关于EditText.setText()无法显示的问题

    将EditText在初始化后调用EditText.setSaveEnabled(false); 让Android 系统不保存值,这样就不会恢复了.

  7. python实战===老司机奇技淫巧系列之字符转换成图片

    先放两张效果图:

  8. WoW[www]

    WoWBeez https://github.com/StealtheeEU/WoWBeez https://github.com/mtucker6784/Elysium https://github ...

  9. 2015多校第6场 HDU 5358 First One 枚举,双指针

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5358 题意:如题. 解法:观察式子发现,由于log函数的存在,使得这个函数的值域<=34,然后我 ...

  10. VPS性能测试(1):CPU物理个数、内核、超线程、多核心

    1.登录VPS界面,执行:cat /proc/cpuinfo,就会显示出VPS主机的CPU详细参数,如内核.频率.型号等等 2.主要参数physical_id表示物理CPU个数,cpu cores是内 ...