Skip to content

Commit

Permalink
Merge pull request #264 from visualfc/version
Browse files Browse the repository at this point in the history
update gop version
  • Loading branch information
xushiwei authored and visualfc committed Apr 28, 2024
2 parents d4da3bc + 19f5d9a commit 698a8e4
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module golang.org/x/tools
go 1.18 // tagx:compat 1.16

require (
github.com/goplus/gop v1.2.6
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4
github.com/goplus/mod v0.13.10
github.com/yuin/goldmark v1.4.13
golang.org/x/mod v0.17.0
Expand All @@ -13,6 +13,6 @@ require (
)

require (
github.com/goplus/gogen v1.15.2 // indirect
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5 // indirect
github.com/qiniu/x v1.13.10 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/goplus/gogen v1.15.2 h1:Q6XaSx/Zi5tWnjfAziYsQI6Jv6MgODRpFtOYqNkiiqM=
github.com/goplus/gogen v1.15.2/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gop v1.2.6 h1:kog3c5Js+8EopqmI4+CwueXsqibnBwYVt5q5N7juRVY=
github.com/goplus/gop v1.2.6/go.mod h1:uREWbR1MrFaviZ4Mbx4ZCcAYDoqzO0iv1Qo6Np0Xx4E=
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5 h1:OpVAkQH6VJaP4ooZgqeETcgW1Ac9wxLXej0Jl+PlxCs=
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4 h1:9AreG+CoZQqRJn9Y0HB1X0Vki5wcZShVDyv0s7Yl8wM=
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4/go.mod h1:P3AbZ3+dlZVQNMzhVWjFb+dwnEsidHGN278Hm5zDQug=
github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE=
github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
github.com/qiniu/x v1.13.10 h1:J4Z3XugYzAq85SlyAfqlKVrbf05glMbAOh+QncsDQpE=
Expand Down
19 changes: 13 additions & 6 deletions gop/packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ type Config = packages.Config
type Package struct {
packages.Package

// GopMod is the gop packages module or nil
GopMod *gopmod.Module

// GopFiles lists the absolute file paths of the package's Go source files.
// It may include files that should not be compiled, for example because
// they contain non-matching build tags, are documentary pseudo-files such as
Expand Down Expand Up @@ -392,25 +395,30 @@ func addGopFiles(ret *Package, ld *loader, dir string, mode LoadMode, test bool)
fsetTemp := token.NewFileSet()
pkgName := ret.Name
var mod *gopmod.Module
var once sync.Once
if ld != nil {
mod = ld.Context.LoadMod(ret.Module)
} else {
mod, _ = gop.LoadMod(dir)
}
ret.GopMod = mod

for _, e := range entries {
fname := e.Name()
if strings.HasPrefix(fname, "_") {
continue
}
fext := path.Ext(fname)
if goputil.FileKind(fext) == goputil.FileUnknown {
continue
if mod == nil || !mod.IsClass(fext) {
continue
}
}
if !test {
if strings.HasSuffix(fname[:len(fname)-len(fext)], "_test") {
continue
}
// check gox class test
if strings.HasSuffix(fname, "test.gox") {
once.Do(func() {
mod, _ = gop.LoadMod(dir)
})
if mod != nil {
if _, ok := mod.ClassKind(fname); ok {
continue
Expand All @@ -428,7 +436,6 @@ func addGopFiles(ret *Package, ld *loader, dir string, mode LoadMode, test bool)
}
if ld != nil && len(ret.CompiledGopFiles) > 0 {
ctx := ld.Context
mod := ctx.LoadMod(ret.Module)
ret.GopSyntax = ld.parseFiles(ret, mod, ret.CompiledGopFiles)
if mode&(NeedTypes|NeedTypesInfo) != 0 {
ret.GopTypesInfo = &typesutil.Info{
Expand Down
4 changes: 2 additions & 2 deletions gopls/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.18

require (
github.com/google/go-cmp v0.6.0
github.com/goplus/gogen v1.15.2
github.com/goplus/gop v1.2.6
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4
github.com/goplus/mod v0.13.10
github.com/jba/printsrc v0.2.2
github.com/jba/templatecheck v0.7.0
Expand Down
15 changes: 5 additions & 10 deletions gopls/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/safehtml v0.1.0 h1:EwLKo8qawTKfsi0orxcQAZzu07cICaBeFMegAU9eaT8=
github.com/google/safehtml v0.1.0/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
github.com/goplus/c2go v0.7.25/go.mod h1:e9oe4jDVhGFMJLEGmPSrVkLuXbLZAEmAu0/uD6fSz5E=
github.com/goplus/gogen v1.15.0/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gogen v1.15.1/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gogen v1.15.2 h1:Q6XaSx/Zi5tWnjfAziYsQI6Jv6MgODRpFtOYqNkiiqM=
github.com/goplus/c2go v0.7.26/go.mod h1:ePAStubV/ls8mmdPGQo6VfADTVd46rKuBemE4zzBDnA=
github.com/goplus/gogen v1.15.2/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gop v1.2.5/go.mod h1:5rLlryvlZhWLIBw1Rok8s0uvyO54vcYw/7sFLhqtNTc=
github.com/goplus/gop v1.2.6 h1:kog3c5Js+8EopqmI4+CwueXsqibnBwYVt5q5N7juRVY=
github.com/goplus/gop v1.2.6/go.mod h1:uREWbR1MrFaviZ4Mbx4ZCcAYDoqzO0iv1Qo6Np0Xx4E=
github.com/goplus/mod v0.13.9/go.mod h1:MibsLSftGmxaQq78YzUzNviyFwB9RtpMaoscufvEKH4=
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5 h1:OpVAkQH6VJaP4ooZgqeETcgW1Ac9wxLXej0Jl+PlxCs=
github.com/goplus/gogen v1.15.3-0.20240424153048-0d40138c65a5/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4 h1:9AreG+CoZQqRJn9Y0HB1X0Vki5wcZShVDyv0s7Yl8wM=
github.com/goplus/gop v1.2.0-pre.1.0.20240426043433-5e44bc4585c4/go.mod h1:P3AbZ3+dlZVQNMzhVWjFb+dwnEsidHGN278Hm5zDQug=
github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE=
github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
github.com/jba/printsrc v0.2.2 h1:9OHK51UT+/iMAEBlQIIXW04qvKyF3/vvLuwW/hL8tDU=
Expand All @@ -36,7 +33,6 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/qiniu/x v1.13.9/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
github.com/qiniu/x v1.13.10 h1:J4Z3XugYzAq85SlyAfqlKVrbf05glMbAOh+QncsDQpE=
github.com/qiniu/x v1.13.10/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand All @@ -54,7 +50,6 @@ golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2F
golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
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/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
Expand Down
5 changes: 2 additions & 3 deletions gopls/internal/lsp/cache/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,8 @@ func buildMetadata(updates map[PackageID]*source.Metadata, pkg *packages.Package
DepsErrors: packagesinternal.GetDepsErrors(pkg),
Standalone: standalone,
}
if len(pkg.GopFiles) > 0 {
m.LoadGopMod()
}

m.LoadGopMod(pkg.GopMod)

updates[id] = m

Expand Down
4 changes: 2 additions & 2 deletions gopls/internal/lsp/source/view_gox.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func (pgf *ParsedGopFile) PosLocation(start, end token.Pos) (protocol.Location,
return pgf.Mapper.PosLocation(pgf.Tok, start, end)
}

func (m *Metadata) LoadGopMod() {
m.gopMod_, _ = gop.LoadMod(m.LoadDir)
func (m *Metadata) LoadGopMod(mod *gopmod.Module) {
m.gopMod_ = mod
}

func (m *Metadata) GopMod_() *gopmod.Module {
Expand Down

0 comments on commit 698a8e4

Please sign in to comment.