gin v1.10.0 版本更新介绍
发布日期: 2024-05-07
版本号: v1.10.0
本次更新包含以下内容:新增功能包括代理服务器认证、绑定快捷方式、自定义BindUnmarshaler支持、引擎配置选项扩展及日志条件跳过功能;错误修复涉及URI查询绑定、文件上传校验、上下文值方法合规性、路由通配符冲突等16项问题;优化改进涵盖CI流程重构、性能提升、安全依赖升级及请求处理逻辑增强;构建流程新增代码覆盖率配置并更新了Go 1.22测试支持;文档部分修正了注释拼写错误,补充了代理认证相关说明,同时移除了冗余注释。此外还包含多项依赖库版本更新和单元测试覆盖率提升工作。
更新内容 (中文)
变更日志
功能
- 5f458dd1a6d631f324e4af9a4f5429ffdf199342: feat(auth): 新增代理服务器认证 (#3877) (@EndlessParadox1)
- 7a865dcf1dbe6ec52e074b1ddce830d278eb72cf: feat(bind): 添加 ShouldBindBodyWith 快捷方法并更新文档 (#3871) (@RedCrazyGhost)
- a18219566ca25fc51e6d2886bed849c6c3a0cd12: feat(binding): 支持为绑定实现自定义 BindUnmarshaler (#3933) (@dkkb)
- fd1faaded01aef14a3955ec076f1cbeb9cb87775: feat(binding): 支持覆盖默认绑定实现 (#3514) (@ssfyn)
- ac5e84d93ce34359bfd2f346cb2971ea754d83e3: feat(engine): 新增
OptionFunc
和With
方法 (#3572) (@flc1125) - c6ae2e69666a2b36203b29650ee75d172c725c66: feat(logger): 支持通过用户自定义逻辑跳过日志记录 (#3593) (@palvaneh)
错误修复
- d4e413648824333726ef65de5defc457e9dbf095: 回退"fix(uri): 查询参数绑定问题 (#3236)" (#3899) (@appleboy)
- 3dc1cd6572b4e3a0cd170a15debe546c2c72294f: fix(binding): 修复未上传文件时的绑定错误 (#3819) (#3820) (@clearcodecn)
- 82bcd6d39bfe9c22032764ff3b0b6f8ef1673e49: fix(binding): 解引用结构体指针 (#3199) (@echovl)
- 2b1da2b0b38dfc5d5841266037c0c8b249eca1dd: fix(context): 使上下文 Value 方法符合 Go 标准 (#3897) (@FarmerChillax)
- f70dd00b00bc0a46cb18b55bfe1f918d5d29b511: fix(engine): 修复单元测试 (#3878) (@flc1225)
- 86ff4a64c7efe1a1c875529835eeef9e15de1e86: fix(header): 根据 RFC 7231 规范允许 HTTP 405 响应头 (#3759) (@Crocmagnon)
- 09f8224593e31edf3c58ab3f13bc31ef53473733: fix(route): 在上下文副本中添加完整路径 (#3784) (@KarthikReddyPuli)
- 9f598a31aafb92d675f38f1c8371e4ac76f858bf: fix(router): 修复通配符路由冲突 (#3812) (@FirePing32)
- 4a40f8f1a49b9086b461d97e167c3b9628d8b923: fix(sec): 升级 golang.org/x/crypto 至 0.17.0 (#3832) (@chncaption)
- 386d244068db3693f938db4ead6d1f5f85942e3f: fix(tree): 正确扩展参数容量 (#3502) (@georgijd-form3)
- 8790d08909fc4d193c6c787c9c72f3089168f411: fix(uri): 查询参数绑定问题 (#3236) (@illiafox)
- 44d0dd70924dd154e3b98bc340accc53484efa9c: fix: 为 URL 查询参数添加指针支持 (#3659) (#3666) (@omkar-foss)
- 646312aef6a34095476ac846b0920db5fb24b2ea: fix: 保护调用 Copy 方法时的 Context.Keys 映射 (#3873) (@kingcanfish)
优化改进
- d4a64265f21993368c90602c18e778bf04ef36db: chore(CI): 更新发布参数 (#3595) (@qloog)
- bb3519d26f52835cf00e5e430b52651a9c378c97: chore(IP): 为 Fly.io 添加 TrustedPlatform 常量 (#3839) (@ab)
- 1b3c0859693fc85290c01ba098b1440d4776549f: chore(debug): 支持覆盖 debugPrint 语句 (#2337) (@josegonzalez)
- a64286a7760be2031209686ce4d36e99d42dd419: chore(deps): 更新依赖至最新版本 (#3835) (@appleboy)
- 9c61295efeea99f6c9d1722294f1bf61d8e464d6: chore(header): 添加 RFC 9512 对 application/yaml 的支持 (#3851) (@vincentbernat)
- a481ee2897af1e368de5c919fbeb21b89aa26fc7: chore(http): HTTP 1XX 状态码使用白色显示 (#3741) (@viralparmarme)
- c964ad370bbe007f1b18a7570f058a66f05fbe1f: chore(optimize): 优化 Context 结构体的 ShouldBindUri 方法 (#3911) (@1911860538)
- 739d2d9c80e0298dafb5df1c30bae35d63935d6c: chore(perf): 优化 Context 结构体的 Copy 方法 (#3859) (@1911860538)
- 3ea8bd99fbb4e499d70a0c8e1ce2ce4b7c6348b6: chore(refactor): 修改接口检查方式 (#3855) (@demoManito)
- ab8042e9e5370bbe0e93ea5adc6e74ae4c5df95e: chore(request): 读取前检查 reader 是否为空 (#3419) (@noahyao1024)
- 0d9dbbb44551a872d30fd89d4d55ba0515d646fd: chore(security): 升级 Protobuf 修复 CVE-2024-24786 (#3893) (@Fotkurz)
- ecdbbbe9483dd12222f2085f717a2c7cb5ac55fe: chore: 重构 CI 并更新依赖 (#3848) (@appleboy)
- 39089af62535b27aa63608f341c0a339aa88f64e: chore: 重构配置文件提升可读性 (#3951) (@appleboy)
- 160c1730efd30046239c802d5b9f895a708c3f4c: chore: 更新 GitHub Actions 配置 (#3792) (@appleboy)
- 0397e5e0c0f8f8176c29f7edd8f1bff8e45df780: chore: 更新变更日志分类并改进文档 (#3917) (@appleboy)
- 62b50cfbc0de877207ff74c160a23dff6394f563: chore: 更新依赖至最新版本 (#3694) (@appleboy)
- 638aa19e7d30513f7bc777c62ff8558fd5f90ea5: chore: 更新外部依赖至最新版本 (#3950) (@appleboy)
- c6f90df4e0c888c69524307cc35952ec2e7ead41: chore: 更新多个 Go 依赖至最新版本 (#3901) (@appleboy)
构建流程
- 78f4687875d72d10392f8a77008cbefdec4c0aa0: build(codecov): 添加 codecov 配置 (#3891) (@flc1125)
- 56dc72c4d5b1076fc9c6b81f57299739c11910b8: ci(Makefile): 为 vet 命令添加 .PHONY 标记 (#3915) (@imalasong)
- 8ab47c694ea93fdb442b617961ce9b3171151749: ci(lint): 更新代码检查工具和工作流 (#3834) (@appleboy)
- 8acbe657f1c140e3fba38f869978cab2376500c9: ci(release): 重构变更日志正则表达式模式 (#3914) (@appleboy)
- 000fdb3ac95c7c318440afbd98eaf60f7430a1db: ci(testing): 添加 go1.22 版本支持 (#3842) (@appleboy)
文档更新
- 990c44aebf20f0796d99051e53d6ee75b7ed52fb: docs(context): 为 BindWith 添加弃用注释 (#3880) (@flc1125)
- 861ffb9181dc811dc5d76fc450b36d3e68850b95: docs(middleware): 添加 BasicAuthForProxy 函数注释 (#3881) (@EndlessParadox1)
- ee70b30a97205ac1f32889f41d8a494b3b2c81a5: docs: 为常量 AuthProxyUserKey 和 BasicAuthForProxy 添加文档 (#3887) (@EndlessParadox1)
- f75144a356e57c95bd21a048f0a40492dcdb33c5: docs: 修复注释拼写错误 (#3868) (@testwill)
- 83fc7673f9797b4c7d8d1c41b94e9922303e6275: docs: 修正函数文档拼写错误 (#3872) (@TotomiEcio)
- 49f45a542719df661bd71dd48f1595f0bc1ff6f7: docs: 删除冗余注释 (#3765) (@WeiTheShinobi)
- 75ccf94d605a05fe24817fc2f166f6f2959d5cea: feat: 更新版本常量至 v1.10.0 (#3952) (@appleboy)
其他
- 02e754be9c4889f7ee56db0660cc611eb82b61d6: 升级 golang.org/x/net -> v0.13.0 (#3684) (@cpcf)
- 97eab7d09a8b048cab4a3d8ebd6c0ea78284c716: test(git): 在 gitignore 中添加开发工具 (#3370) (@demoManito)
- ae15646aba14cd8245fbebd263cc7740c6789ef3: test(http): 使用常量替代数字字面量 (#3863) (@testwill)
- fd60a24ab76c3c92955ba253c1f7eda9e4981c3c: test(path): 优化单元测试执行结果 (#3883) (@flc1125)
- bb2d8cf486bde2dc69bf05ea917095260ac13723: test(render): 提升单元测试覆盖率 (#3691) (@araujo88)
更新内容 (原始)
Changelog
Features
- 5f458dd1a6d631f324e4af9a4f5429ffdf199342: feat(auth): add proxy-server authentication (#3877) (@EndlessParadox1)
- 7a865dcf1dbe6ec52e074b1ddce830d278eb72cf: feat(bind): ShouldBindBodyWith shortcut and change doc (#3871) (@RedCrazyGhost)
- a18219566ca25fc51e6d2886bed849c6c3a0cd12: feat(binding): Support custom BindUnmarshaler for binding. (#3933) (@dkkb)
- fd1faaded01aef14a3955ec076f1cbeb9cb87775: feat(binding): support override default binding implement (#3514) (@ssfyn)
- ac5e84d93ce34359bfd2f346cb2971ea754d83e3: feat(engine): Added
OptionFunc
andWith
(#3572) (@flc1125) - c6ae2e69666a2b36203b29650ee75d172c725c66: feat(logger): ability to skip logs based on user-defined logic (#3593) (@palvaneh)
Bug fixes
- d4e413648824333726ef65de5defc457e9dbf095: Revert “fix(uri): query binding bug (#3236)” (#3899) (@appleboy)
- 3dc1cd6572b4e3a0cd170a15debe546c2c72294f: fix(binding): binding error while not upload file (#3819) (#3820) (@clearcodecn)
- 82bcd6d39bfe9c22032764ff3b0b6f8ef1673e49: fix(binding): dereference pointer to struct (#3199) (@echovl)
- 2b1da2b0b38dfc5d5841266037c0c8b249eca1dd: fix(context): make context Value method adhere to Go standards (#3897) (@FarmerChillax)
- f70dd00b00bc0a46cb18b55bfe1f918d5d29b511: fix(engine): fix unit test (#3878) (@flc1125)
- 86ff4a64c7efe1a1c875529835eeef9e15de1e86: fix(header): Allow header according to RFC 7231 (HTTP 405) (#3759) (@Crocmagnon)
- 09f8224593e31edf3c58ab3f13bc31ef53473733: fix(route): Add fullPath in context copy (#3784) (@KarthikReddyPuli)
- 9f598a31aafb92d675f38f1c8371e4ac76f858bf: fix(router): catch-all conflicting wildcard (#3812) (@FirePing32)
- 4a40f8f1a49b9086b461d97e167c3b9628d8b923: fix(sec): upgrade golang.org/x/crypto to 0.17.0 (#3832) (@chncaption)
- 386d244068db3693f938db4ead6d1f5f85942e3f: fix(tree): correctly expand the capacity of params (#3502) (@georgijd-form3)
- 8790d08909fc4d193c6c787c9c72f3089168f411: fix(uri): query binding bug (#3236) (@illiafox)
- 44d0dd70924dd154e3b98bc340accc53484efa9c: fix: Add pointer support for url query params (#3659) (#3666) (@omkar-foss)
- 646312aef6a34095476ac846b0920db5fb24b2ea: fix: protect Context.Keys map when call Copy method (#3873) (@kingcanfish)
Enhancements
- d4a64265f21993368c90602c18e778bf04ef36db: chore(CI): update release args (#3595) (@qloog)
- bb3519d26f52835cf00e5e430b52651a9c378c97: chore(IP): add TrustedPlatform constant for Fly.io. (#3839) (@ab)
- 1b3c0859693fc85290c01ba098b1440d4776549f: chore(debug): add ability to override the debugPrint statement (#2337) (@josegonzalez)
- a64286a7760be2031209686ce4d36e99d42dd419: chore(deps): update dependencies to latest versions (#3835) (@appleboy)
- 9c61295efeea99f6c9d1722294f1bf61d8e464d6: chore(header): Add support for RFC 9512: application/yaml (#3851) (@vincentbernat)
- a481ee2897af1e368de5c919fbeb21b89aa26fc7: chore(http): use white color for HTTP 1XX (#3741) (@viralparmarme)
- c964ad370bbe007f1b18a7570f058a66f05fbe1f: chore(optimize): the ShouldBindUri method of the Context struct (#3911) (@1911860538)
- 739d2d9c80e0298dafb5df1c30bae35d63935d6c: chore(perf): Optimize the Copy method of the Context struct (#3859) (@1911860538)
- 3ea8bd99fbb4e499d70a0c8e1ce2ce4b7c6348b6: chore(refactor): modify interface check way (#3855) (@demoManito)
- ab8042e9e5370bbe0e93ea5adc6e74ae4c5df95e: chore(request): check reader if it’s nil before reading (#3419) (@noahyao1024)
- 0d9dbbb44551a872d30fd89d4d55ba0515d646fd: chore(security): upgrade Protobuf for CVE-2024-24786 (#3893) (@Fotkurz)
- ecdbbbe9483dd12222f2085f717a2c7cb5ac55fe: chore: refactor CI and update dependencies (#3848) (@appleboy)
- 39089af62535b27aa63608f341c0a339aa88f64e: chore: refactor configuration files for better readability (#3951) (@appleboy)
- 160c1730efd30046239c802d5b9f895a708c3f4c: chore: update GitHub Actions configuration (#3792) (@appleboy)
- 0397e5e0c0f8f8176c29f7edd8f1bff8e45df780: chore: update changelog categories and improve documentation (#3917) (@appleboy)
- 62b50cfbc0de877207ff74c160a23dff6394f563: chore: update dependencies to latest versions (#3694) (@appleboy)
- 638aa19e7d30513f7bc777c62ff8558fd5f90ea5: chore: update external dependencies to latest versions (#3950) (@appleboy)
- c6f90df4e0c888c69524307cc35952ec2e7ead41: chore: update various Go dependencies to latest versions (#3901) (@appleboy)
Build process updates
- 78f4687875d72d10392f8a77008cbefdec4c0aa0: build(codecov): Added a codecov configuration (#3891) (@flc1125)
- 56dc72c4d5b1076fc9c6b81f57299739c11910b8: ci(Makefile): vet command add .PHONY (#3915) (@imalasong)
- 8ab47c694ea93fdb442b617961ce9b3171151749: ci(lint): update tooling and workflows for consistency (#3834) (@appleboy)
- 8acbe657f1c140e3fba38f869978cab2376500c9: ci(release): refactor changelog regex patterns and exclusions (#3914) (@appleboy)
- 000fdb3ac95c7c318440afbd98eaf60f7430a1db: ci(testing): add go1.22 version (#3842) (@appleboy)
Documentation updates
- 990c44aebf20f0796d99051e53d6ee75b7ed52fb: docs(context): Added deprecation comments to BindWith (#3880) (@flc1125)
- 861ffb9181dc811dc5d76fc450b36d3e68850b95: docs(middleware): comments to function
BasicAuthForProxy
(#3881) (@EndlessParadox1) - ee70b30a97205ac1f32889f41d8a494b3b2c81a5: docs: Add document to constant
AuthProxyUserKey
andBasicAuthForProxy
. (#3887) (@EndlessParadox1) - f75144a356e57c95bd21a048f0a40492dcdb33c5: docs: fix typo in comment (#3868) (@testwill)
- 83fc7673f9797b4c7d8d1c41b94e9922303e6275: docs: fix typo in function documentation (#3872) (@TotomiEcio)
- 49f45a542719df661bd71dd48f1595f0bc1ff6f7: docs: remove redundant comments (#3765) (@WeiTheShinobi)
- 75ccf94d605a05fe24817fc2f166f6f2959d5cea: feat: update version constant to v1.10.0 (#3952) (@appleboy)
Others
- 02e754be9c4889f7ee56db0660cc611eb82b61d6: Upgrade golang.org/x/net -> v0.13.0 (#3684) (@cpcf)
- 97eab7d09a8b048cab4a3d8ebd6c0ea78284c716: test(git): gitignore add develop tools (#3370) (@demoManito)
- ae15646aba14cd8245fbebd263cc7740c6789ef3: test(http): use constant instead of numeric literal (#3863) (@testwill)
- fd60a24ab76c3c92955ba253c1f7eda9e4981c3c: test(path): Optimize unit test execution results (#3883) (@flc1125)
- bb2d8cf486bde2dc69bf05ea917095260ac13723: test(render): increased unit tests coverage (#3691) (@araujo88)