NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Go modules
Go modules, #1547 by repository stars
Latest stable
v0.3.11
Last release 1 years ago
16 Nov 2025
Release timing varies
gaps range from 8 days to 10 months
Most releases are documented
notes for 37 of 50 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
108 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Nothing published for this version
fix by @guonaihong in https://github.com/guonaihong/gout/pull/390
Full Changelog: https://github.com/guonaihong/gout/compare/v0.3.10...v0.3.11
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Nothing published for this version
Nothing published for this version
优化decode ReadAll性能 #384 @asjdf 修复变量单词拼写 #382 @garudaen socks5支持用户名和密码 #387 修复golangci-lint 99%+的错误 #388
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
debug模块的trace信息可以输出的io.Writer里面
Nothing published for this version
Nothing published for this version
Nothing published for this version
在NewWithOpt 加上WithSocks5, WithProxy, WithUnixSocket三个函数。
在NewWithOpt 加上WithSocks5, WithProxy, WithUnixSocket三个函数。
gout.WithUnixSocket 为了让大家少用.UnixSocket 而设计
import (
"github.com/guonaihong/gout"
)
func main() {
// globalWithOpt里面包含连接池, 这是一个全局可复用的对象, 一个进程里面可能只需创建1个, 如果有多个不同的unixsocket,可以创建多个
globalWithOpt := gout.NewWithOpt(gout.WithUnixSocket("/tmp/test.socket"))
err := globalWithOpt.GET("url").Do()
if err != nil {
fmt.Printf("err = %v\n" ,err)
return
}
}
gout.WithProxy 为了让大家少用.SetProxy 而设计
import (
"github.com/guonaihong/gout"
)
func main() {
// globalWithOpt里面包含连接池, 这是一个全局可复用的对象, 一个进程里面可能只需创建1个, 如果有多个不同的proxy,可以创建多个
globalWithOpt := gout.NewWithOpt(gout.WithProxy("http://127.0.0.1:7000"))
err := globalWithOpt.GET("url").Do()
if err != nil {
fmt.Printf("err = %v\n" ,err)
return
}
}
gout.WithSocks5 为了让大家少用.SetSOCKS5而设计
import (
"github.com/guonaihong/gout"
)
func main() {
// globalWithOpt里面包含连接池, 这是一个全局可复用的对象, 一个进程里面可能只需创建1个, 如果有多个不同的socks5,可以创建多个
globalWithOpt := gout.NewWithOpt(gout.WithSocks5("127.0.0.1:7000"))
err := globalWithOpt.GET("url").Do()
if err != nil {
fmt.Printf("err = %v\n" ,err)
return
}
}
Nothing published for this version
Nothing published for this version
与SetHeader API唯一的区别就是不修改header名. 大部分情况用SetHeader,如果有不修改header的需求再使用SetHeaderRaw。
来源 #361
新加SetHeaderRaw接口
与SetHeader API唯一的区别就是不修改header名. 大部分情况用SetHeader,如果有不修改header的需求再使用SetHeaderRaw。
package main
import (
"fmt"
"github.com/guonaihong/gout"
"time"
)
func main() {
err := gout.
//设置GET请求和url,:8080/test.header是127.0.0.1:8080/test.header的简写
GET(":8080/test.header").
//设置debug模式
Debug(true).
//设置请求http header
SetHeaderRaw(gout.H{
"h1": "v1",
"h2": 2,
"h3": float32(3.14),
"h4": 4.56,
"h5": time.Now().Unix(),
"h6": time.Now().UnixNano(),
"h7": time.Now().Format("2006-01-02")}).
Do()
if err != nil {
fmt.Printf("%s\n", err)
return
}
}
/*
> GET /test.header HTTP/1.1
> h2: 2
> h3: 3.14
> h4: 4.56
> h5: 1574081686
> h6: 1574081686471347098
> h7: 2019-11-18
> h1: v1
>
< HTTP/1.1 200 OK
< Content-Length: 0
*/来源 #361 新加SetHeaderRaw接口
与SetHeader API唯一的区别就是不修改header名. 大部分情况用SetHeader,如果有不修改header的需求再使用SetHeaderRaw。
package main
import (
"fmt"
"github.com/guonaihong/gout"
"time"
)
func main() {
err := gout.
//设置GET请求和url,:8080/test.header是127.0.0.1:8080/test.header的简写
GET(":8080/test.header").
//设置debug模式
Debug(true).
//设置请求http header
SetHeaderRaw(gout.H{
"h1": "v1",
"h2": 2,
"h3": float32(3.14),
"h4": 4.56,
"h5": time.Now().Unix(),
"h6": time.Now().UnixNano(),
"h7": time.Now().Format("2006-01-02")}).
Do()
if err != nil {
fmt.Printf("%s\n", err)
return
}
}
/*
> GET /test.header HTTP/1.1
> h2: 2
> h3: 3.14
> h4: 4.56
> h5: 1574081686
> h6: 1574081686471347098
> h7: 2019-11-18
> h1: v1
>
< HTTP/1.1 200 OK
< Content-Length: 0
*/
Nothing published for this version
感谢 @panxl6 (可根据编译tag选择多种json序列化库)
感谢 @panxl6 (可根据编译tag选择多种json序列化库)
Nothing published for this version
import ( "github.com/guonaihong/gout" )
url 支持模板语法。
package main
import (
"github.com/guonaihong/gout"
)
type testURLTemplateCase struct {
Host string
}
func main() {
url := "https://{{.Host}}"
// 发送GET方法
gout.GET(url, testURLTemplateCase{Host:"www.qq.com"}).Do()
// 发送POST方法
gout.POST(url, testURLTemplateCase{Host:"www.github.com"}).Do()
// 发送PUT方法
gout.PUT(url, testURLTemplateCase{Host:"www.baidu.com"}).Do()
// 发送DELETE方法
gout.DELETE(url, testURLTemplateCase{Host:"www.google.com"}).Do()
// 发送PATH方法
gout.PATCH(url, testURLTemplateCase{Host:"www.google.com"}).Do()
// 发送HEAD方法
gout.HEAD(url, testURLTemplateCase{Host:"www.google.com"}).Do()
// 发送OPTIONS
gout.OPTIONS(url, testURLTemplateCase{Host:"www.google.com"}).Do()
}
Nothing published for this version
新加SetJSONNotEscape接口,不转义json中的HTML字符
新加SetJSONNotEscape接口,不转义json中的HTML字符
只要Content-Encoding是deflate, br。都可以还原成压缩之前的格式。
#343
新加解码压缩数据包的接口
AutoDecodeBody()只要Content-Encoding是deflate, br。都可以还原成压缩之前的格式。
Content-Encoding: deflate
Content-Encoding: br
func main() { gout.SetDebug(true) err := gout.GET(":8080/colorjson").Do() if err != nil { fmt.Printf("err is:%v\n") } } ```
来源,#338
package main
import (
"fmt"
"github.com/guonaihong/gout"
)
func main() {
gout.SetDebug(true)
err := gout.GET(":8080/colorjson").Do()
if err != nil {
fmt.Printf("err is:%v\n")
}
}
import (
"github.com/guonaihong/gout"
"github.com/guonaihong/gout/debug"
)
func main() {
err := gout.POST(":8080/colorjson").
Debug(debug.ToFile("./req.txt", false)).
SetJSON(gout.H{"str": "foo",
"num": 100,
"bool": false,
"null": nil,
"array": gout.A{"foo", "bar", "baz"},
"obj": gout.H{"a": 1, "b": 2},
}).Do()
if err != nil {
fmt.Printf("err = %v\n", err)
}
}
package main
import (
"bytes"
"fmt"
"github.com/guonaihong/gout"
"github.com/guonaihong/gout/debug"
)
func main() {
var buf bytes.Buffer
err := gout.POST(":8080/colorjson").
Debug(debug.ToWriter(&buf, false)).
SetJSON(gout.H{"str": "foo",
"num": 100,
"bool": false,
"null": nil,
"array": gout.A{"foo", "bar", "baz"},
"obj": gout.H{"a": 1, "b": 2},
}).Do()
if err != nil {
fmt.Printf("err = %v\n", err)
}
fmt.Println(buf.String())
}
Nothing published for this version
支持多个对象的绑定。 ``go var responseStruct struct { Name string json:"name" Age int json:"age"` } var responseStr string
支持多个对象的绑定。
var responseStruct struct {
Name string `json:"name"`
Age int `json:"age"`
}
var responseStr string
gout.GET("url").
SetQuery(gout.H{}).
BindJSON(&responseStruct).
BindBody(&responseStr).
Do()
log.Println(responseStr)
// do something with responseStruct ...
Nothing published for this version
Nothing published for this version
Nothing published for this version
在mac+go1.17的组合下面sys库会runtime panic.
更新标准扩展库sys版本号.
在mac+go1.17的组合下面sys库会runtime panic.
Nothing published for this version
增加MiddlerFunc Helper 感谢 @Sora233 SetQuery和SetHeader等API int 类型0值序列化为空字符串 现改为"0",
增加MiddlerFunc Helper 感谢 @Sora233 SetQuery和SetHeader等API int 类型0值序列化为空字符串 现改为"0",
Nothing published for this version
Nothing published for this version
优化SetXXX函数, 传递nil 会panic的现象. 感谢 @listening3
优化SetXXX函数, 传递nil 会panic的现象. 感谢 @listening3
Nothing published for this version
Nothing published for this version
Nothing published for this version
修复host写完整url, url内容不对的情况 感谢 @TMaize
本次功能如下:
结果中间件用法如下. https://github.com/guonaihong/gout#responseuse
Nothing published for this version
```go import ( "fmt" "github.com/guonaihong/gout" )
详细的讨论可看 #306
import (
"fmt"
"github.com/guonaihong/gout"
)
type testValid struct {
Val string `valid:"required"`
}
func main() {
tv := testValid{}
err := gout.
// 设置POST方法和url
POST(":8080/req/body").
//打开debug模式
Debug(true).
//解析json, 并且当需要的字段没有值时, 返回错误
BindJSON(&tv).
//结束函数
Do()
if err != nil {
fmt.Printf("%s\n", err)
return
}
}
详细设计可看 #305 本次功能优化在使用query string时,可以使用更丰富的数据结构。 ```go package main
详细设计可看 #305 本次功能优化在使用query string时,可以使用更丰富的数据结构。
package main
import "github.com/guonaihong/gout"
type query struct {
A []string `query:"a"`
}
func main() {
gout.GET(":8080/").SetQuery(query{A: []string{"1", "2", "3"}}).Do()
}
客户端请求的包如下:
GET /?a=1&a=2&a=3 HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip
Nothing published for this version
Nothing published for this version
新增Response接口 ```go func main() {
新增Response接口
func main() {
resp, err := gout.GET(":8080").SetJSON(`{"test":"value"}`).Response()
if resp != nil {
defer resp.Body.Close()
}
}
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
` NewWithOpt接口新增WithTimeout配置, 相比全局gout.SetTimeout`是个更好的选择.
NewWithOpt接口新增WithTimeout配置, 相比全局gout.SetTimeout是个更好的选择.Nothing published for this version
Nothing published for this version
支持关闭3xx状态码自动跳转的功能. ```go import ( "github.com/guonaihong/gout" )
支持关闭3xx状态码自动跳转的功能.
import (
"github.com/guonaihong/gout"
)
func main() {
// globalWithOpt里面包含连接池, 这是一个全局可复用的对象, 一个进程里面可能只需创建1个
globalWithOpt := gout.NewWithOpt(gout.WithClose3xxJump())
err := globalWithOpt.GET("url").Do()
if err != nil {
fmt.Printf("err = %v\n" ,err)
return
}
}
忽略ssl验证, 使用`gout.WithInsecureSkipVerify()接口配置该功能, 传入gout.NewWithOpt()接口即可生效. ``go import ( "github.com/guonaihong/gout" )
忽略ssl验证,
使用gout.WithInsecureSkipVerify()接口配置该功能, 传入gout.NewWithOpt()接口即可生效.
import (
"github.com/guonaihong/gout"
)
func main() {
// globalWithOpt里面包含连接池, 这是一个全局可复用的对象
globalWithOpt := gout.NewWithOpt(gout.WithInsecureSkipVerify())
err := globalWithOpt.GET("url").Do()
if err != nil {
fmt.Printf("err = %v\n" ,err)
return
}
}
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.