Skip to content

Commit

Permalink
chore: 更新依赖项
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Aug 18, 2024
1 parent c18c2d8 commit 76b1385
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go: ['1.21.x', '1.22.x']
go: ['1.21.x', '1.23.x']

steps:

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.21
require (
github.com/issue9/assert/v4 v4.3.0
github.com/issue9/errwrap v0.3.2
golang.org/x/mod v0.17.0
golang.org/x/mod v0.20.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ github.com/issue9/assert/v4 v4.3.0 h1:W3XDKmttsfzihYGxJ9rJoL2ViJgWERB9IxfHcxjv65
github.com/issue9/assert/v4 v4.3.0/go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4=
github.com/issue9/errwrap v0.3.2 h1:7KEme9Pfe75M+sIMcPCn/DV90wjnOcRbO4DXVAHj3Fw=
github.com/issue9/errwrap v0.3.2/go.mod h1:KcCLuUGiffjooLCUjL89r1cyO8/HT/VRcQrneO53N3A=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
5 changes: 4 additions & 1 deletion mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ var (
// 如果 pkgPath 是标准库的名称,如 encoding/json 等,则返回当前使用的 Go 版本对应的标准库地址。
// 其它情况则从 modDir 指向的 go.mod 中查找 require 或是 replace 字段的定义,
// 并根据这些定义找到其指向的源码路径。
// 如果 modDir 中不存在 go.mod 会尝试向上一级目录查找。
//
// pkgPath 需要查找的包路径,如果指向的是模块下的包级别的导出路径,则会尝试使用 strings.HasPrefix 与 require 指令进行对比;
// pkgPath 需要查找的包路径,如果指向的是模块下的包级别的导出路径,则会尝试使用 [strings.HasPrefix] 与 require 指令进行对比;
// modDir go.mod 所在的目录,将在该文件中查找 pkgPath 指定的目录;
// replace 是否考虑 go.mod 中的 replace 指令的影响;
//
// 如果找不到,会返回 [fs.ErrNotExist]
//
// NOTE: 这并不会检测 dir 指向目录是否真实且准确。
func PkgSourceDir(pkgPath, modDir string, replace bool) (dir string, err error) {
if strings.IndexByte(pkgPath, '.') < 0 {
Expand Down

0 comments on commit 76b1385

Please sign in to comment.