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))
}

  

最新文章

  1. Swift enum(枚举)使用范例
  2. iOS 之项目中遇到的问题总结
  3. jQuery包装集
  4. 【转】8G内存下MySQL的优化详细方案
  5. lua定义一个简单的类
  6. 1.Dotnet Core安装
  7. 使用Linux碎解二
  8. SQL Server中 ldf 文件过大的解决方法
  9. Android应用崩溃后异常捕获并重启并写入日志
  10. re正则表达式16_managing complex regexes
  11. StackExchange.Redis.Extensions.Core 源码解读之 Configuration用法
  12. SynchronizationContext的研究之一(非WPF及Forms)
  13. linxu,window系统
  14. Android获取ip地址
  15. PowerDesigner从SqlServer 数据库中导入实体模型
  16. DatePicker的使用
  17. Java 中的函数式编程(Functional Programming):Lambda 初识
  18. KNN算法简单应用
  19. 测试工具之Fiddler
  20. [转]JAVA实现SFTP实例

热门文章

  1. Sublime Text 3 一些简单使用
  2. 洛谷P2901 [USACO08MAR]牛慢跑Cow Jogging
  3. 【BZOJ】1529 [POI2005]ska Piggy banks
  4. hadoop+spark 集群的安装
  5. 基于 python imageai 对象检测 目标检测 识别 视频
  6. MSSQL 数据库性能优化
  7. pcap的安装
  8. 【Educational Codeforces Round20】
  9. jquery文档加载几种写法,图片加载写法
  10. LightOJ 1282