Skip to content
guonaihong edited this page Sep 28, 2019 · 5 revisions

安装有两种方式

不使用go mod

这种方式有个缺点,需要自己下载依赖

env GOPATH=`pwd` go get github.com/guonaihong/gout

使用go mod方式

第一步新建workspace

mkdir use_gout
go mod init main #关键一步

撸代码

package main

import (
    "fmt"
    "github.com/guonaihong/gout"
)

func main() {
    s := ""
    err := gout.GET("http://www.qq.com").BindBody(&s).Do()
    if err != nil {
        fmt.Printf("%s\n", err)
        return
    }   

    fmt.Printf("%s\n", s)
}

运行

这种方式有个有优点,自动下载依赖

env GOPROXY=https://goproxy.cn go run t.go