Skip to content
Permalink
Browse files

Next (#960)

* sync margo

* v20.02.01
  • Loading branch information
DisposaBoy committed Feb 1, 2020
1 parent f78e351 commit 8265060f4b6eadcb4bd5b8f185df18cad0216d32
Showing with 4,520 additions and 2,079 deletions.
  1. +8 −0 CHANGELOG.md
  2. +1 −1 gosubl/about.py
  3. +20 −12 src/margo.sh/Gopkg.lock
  4. +2 −3 src/margo.sh/golang/gopkg/import.go
  5. +8 −0 src/margo.sh/golang/goutil/goutil.go
  6. +1 −2 src/margo.sh/golang/goutil/parse.go
  7. +2 −1 src/margo.sh/golang/typecheck.go
  8. +1 −2 src/margo.sh/kimporter/parse.go
  9. +11 −5 src/margo.sh/memo/memo.go
  10. +45 −11 src/margo.sh/mg/vfs.go
  11. +21 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/.travis.yml
  12. +21 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/LICENSE
  13. +124 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/README.markdown
  14. +31 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/big.go
  15. +173 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/bigbytes.go
  16. +143 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/bytes.go
  17. +116 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/comma.go
  18. +40 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/commaf.go
  19. +46 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/ftoa.go
  20. +8 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/humanize.go
  21. +192 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/number.go
  22. +25 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/ordinals.go
  23. +123 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/si.go
  24. +117 −0 src/margo.sh/vendor/github.com/dustin/go-humanize/times.go
  25. +32 −5 src/margo.sh/vendor/github.com/karrick/godirwalk/scandir_unix.go
  26. +26 −1 src/margo.sh/vendor/github.com/karrick/godirwalk/scandir_windows.go
  27. +9 −0 src/margo.sh/vendor/github.com/karrick/godirwalk/withReclen.go
  28. +9 −0 src/margo.sh/vendor/github.com/karrick/godirwalk/withoutReclen.go
  29. +134 −0 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_arm64.go
  30. +31 −0 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_arm64.s
  31. +11 −0 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
  32. +11 −0 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
  33. 0 src/margo.sh/vendor/golang.org/x/sys/cpu/{cpu_gccgo.c → cpu_gccgo_x86.c}
  34. 0 src/margo.sh/vendor/golang.org/x/sys/cpu/{cpu_gccgo.go → cpu_gccgo_x86.go}
  35. +2 −46 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_linux.go
  36. +6 −2 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go
  37. +1 −1 src/margo.sh/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
  38. +56 −0 src/margo.sh/vendor/golang.org/x/sys/cpu/hwcap_linux.go
  39. +0 −7 src/margo.sh/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
  40. +8 −4 src/margo.sh/vendor/golang.org/x/sys/unix/fcntl.go
  41. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/mkall.sh
  42. +2 −0 src/margo.sh/vendor/golang.org/x/sys/unix/mkerrors.sh
  43. +5 −0 src/margo.sh/vendor/golang.org/x/sys/unix/mkpost.go
  44. +17 −2 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_bsd.go
  45. +2 −17 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_darwin.go
  46. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go
  47. +128 −1 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_linux.go
  48. +11 −17 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_netbsd.go
  49. +1 −18 src/margo.sh/vendor/golang.org/x/sys/unix/syscall_openbsd.go
  50. +6 −0 src/margo.sh/vendor/golang.org/x/sys/unix/types_dragonfly.go
  51. +6 −0 src/margo.sh/vendor/golang.org/x/sys/unix/types_freebsd.go
  52. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/types_netbsd.go
  53. +3 −0 src/margo.sh/vendor/golang.org/x/sys/unix/types_solaris.go
  54. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
  55. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
  56. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
  57. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
  58. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
  59. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
  60. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
  61. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
  62. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
  63. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
  64. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
  65. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
  66. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
  67. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/{zptracearm_linux.go → zptrace_armnn_linux.go}
  68. +17 −0 src/margo.sh/vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go
  69. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/{zptracemips_linux.go → zptrace_mipsnn_linux.go}
  70. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/{zptracemipsle_linux.go → zptrace_mipsnnle_linux.go}
  71. +1 −1 src/margo.sh/vendor/golang.org/x/sys/unix/{zptrace386_linux.go → zptrace_x86_linux.go}
  72. +11 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go
  73. +16 −16 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
  74. +4 −2 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s
  75. +11 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go
  76. +16 −16 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
  77. +2 −2 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
  78. +11 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go
  79. +16 −16 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
  80. +4 −2 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s
  81. +11 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go
  82. +16 −16 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
  83. +4 −2 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
  84. +0 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
  85. +0 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
  86. +0 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
  87. +0 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
  88. +0 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go
  89. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
  90. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
  91. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
  92. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
  93. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
  94. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
  95. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
  96. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
  97. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
  98. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
  99. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
  100. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
  101. +102 −11 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
  102. +51 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
  103. +51 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
  104. +51 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
  105. +51 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
  106. +26 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
  107. +26 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
  108. +26 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
  109. +26 −27 src/margo.sh/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go
  110. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
  111. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
  112. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
  113. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
  114. +10 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
  115. +32 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
  116. +33 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
  117. +32 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
  118. +33 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
  119. +7 −0 src/margo.sh/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
  120. +1 −2 src/margo.sh/vendor/golang.org/x/tools/go/packages/doc.go
  121. +4 −3 src/margo.sh/vendor/golang.org/x/tools/go/packages/external.go
  122. +50 −115 src/margo.sh/vendor/golang.org/x/tools/go/packages/golist.go
  123. +2 −2 src/margo.sh/vendor/golang.org/x/tools/go/packages/packages.go
  124. +4 −1 src/margo.sh/vendor/golang.org/x/tools/go/ssa/builder.go
  125. +5 −0 src/margo.sh/vendor/golang.org/x/tools/imports/forward.go
  126. +4 −1 src/margo.sh/vendor/golang.org/x/tools/internal/gopathwalk/walk.go
  127. +237 −269 src/margo.sh/vendor/golang.org/x/tools/internal/imports/fix.go
  128. +35 −17 src/margo.sh/vendor/golang.org/x/tools/internal/imports/imports.go
  129. +134 −77 src/margo.sh/vendor/golang.org/x/tools/internal/imports/mod.go
  130. +79 −13 src/margo.sh/vendor/golang.org/x/tools/internal/imports/mod_cache.go
  131. +0 −100 src/margo.sh/vendor/golang.org/x/tools/internal/span/parse.go
  132. +0 −285 src/margo.sh/vendor/golang.org/x/tools/internal/span/span.go
  133. +0 −179 src/margo.sh/vendor/golang.org/x/tools/internal/span/token.go
  134. +0 −39 src/margo.sh/vendor/golang.org/x/tools/internal/span/token111.go
  135. +0 −16 src/margo.sh/vendor/golang.org/x/tools/internal/span/token112.go
  136. +0 −152 src/margo.sh/vendor/golang.org/x/tools/internal/span/uri.go
  137. +0 −94 src/margo.sh/vendor/golang.org/x/tools/internal/span/utf16.go
  138. +62 −0 src/margo.sh/vfs/blob.go
  139. +25 −3 src/margo.sh/vfs/vfs.go
  140. +15 −17 src/margo.sh/web/nodejs/packagescripts.go
@@ -10,6 +10,14 @@ https://margo.sh/b/motd - Get notified when GoSublime has a new release.

## Changes

## 20.02.01

This release focuses on fixing a performance issue due to a failure to resetting all cached data prematurely.

- Cache some files in memory to avoid re-reading from disk every time.

- The `&nodejs.PackageScripts{}` reducer now uses `yarn` instead of `npm` if the `yarn.lock` file is present.

## 20.01.01

This release mainly focuses on under-the-hood improvements for module support.
@@ -1,7 +1,7 @@
import re
import sublime

TAG = '20.01.01-1'
TAG = '20.02.01-1'
ANN = 'a'+TAG
VERSION = 'r'+TAG
VERSION_PAT = re.compile(r'\d{2}[.]\d{2}[.]\d{2}-\d+', re.IGNORECASE)

Some generated files are not rendered by default. Learn more.

@@ -8,7 +8,6 @@ import (
"github.com/rogpeppe/go-internal/module"
"github.com/rogpeppe/go-internal/semver"
"go/build"
"io/ioutil"
"margo.sh/golang/goutil"
"margo.sh/mg"
"margo.sh/mgutil"
@@ -405,7 +404,7 @@ func loadModSumNd(mx *mg.Ctx, dirNd *vfs.Node) (*modFile, error) {

func loadModSum(mx *mg.Ctx, dir string) (*modFile, error) {
gomod := filepath.Join(dir, "go.mod")
modSrc, err := ioutil.ReadFile(gomod)
modSrc, err := mx.VFS.ReadBlob(gomod).ReadFile()
if err != nil {
return nil, err
}
@@ -457,7 +456,7 @@ func loadModSum(mx *mg.Ctx, dir string) (*modFile, error) {
}

gosum := filepath.Join(dir, "go.sum")
sumSrc, err := ioutil.ReadFile(gosum)
sumSrc, err := mx.VFS.ReadBlob(gosum).ReadFile()
if err != nil {
return mf, nil
}
@@ -55,6 +55,14 @@ func BuildContext(mx *mg.Ctx) *build.Context {
if v := mx.View; v != nil && p == v.Path {
return v.Open()
}
if v := mx.View; v != nil && v.Path != "" && filepath.Dir(v.Path) == filepath.Dir(p) {
if b := mx.VFS.ReadBlob(p); b != nil {
return b.OpenFile()
}
}
if b := mx.VFS.PeekBlob(p); b != nil {
return b.OpenFile()
}
return os.Open(p)
}
return c
@@ -5,7 +5,6 @@ import (
"go/parser"
"go/scanner"
"go/token"
"io/ioutil"
"margo.sh/mg"
)

@@ -39,7 +38,7 @@ func ParseFileWithMode(mx *mg.Ctx, fn string, src []byte, mode parser.Mode) *Par
if len(src) == 0 {
var err error
if fn != "" {
src, err = ioutil.ReadFile(fn)
src, err = mx.VFS.ReadBlob(fn).ReadFile()
}
if len(src) == 0 {
return &ParsedFile{
@@ -11,6 +11,7 @@ import (
"margo.sh/mg"
"margo.sh/mgpf"
"margo.sh/mgutil"
"os"
"path/filepath"
"strings"
"time"
@@ -56,7 +57,7 @@ func (tc *TypeCheck) check(mx *mg.Ctx) {
if pf.Dur().Duration < 100*time.Millisecond {
return
}
mx.Profile.Fprint(mx.Log.Dbg.Writer(), &mgpf.PrintOpts{
mx.Profile.Fprint(os.Stderr, &mgpf.PrintOpts{
MinDuration: 10 * time.Millisecond,
})
}()
@@ -5,7 +5,6 @@ import (
"go/build"
"go/parser"
"go/token"
"io/ioutil"
"margo.sh/mg"
"path/filepath"
"sync"
@@ -23,7 +22,7 @@ type kpFile struct {

func (kf *kpFile) init() {
if len(kf.Src) == 0 {
kf.Src, kf.Err = ioutil.ReadFile(kf.Fn)
kf.Src, kf.Err = kf.Mx.VFS.ReadBlob(kf.Fn).ReadFile()
if kf.Err != nil {
return
}
@@ -141,18 +141,24 @@ func (m *M) clear() []Sticky {
}

func (m *M) Values() map[K]V {
vals := map[K]V{}
m.Range(func(k K, v V) {
vals[k] = v
})
return vals
}

func (m *M) Range(f func(k K, v V)) {
if m == nil {
return nil
return
}

m.mu.Lock()
defer m.mu.Unlock()

vals := make(map[K]V, len(m.ml))
for k, p := range m.ml {
for _, p := range m.ml {
if v := p.value(); v != nil {
vals[k] = v
f(p.k, v)
}
}
return vals
}
@@ -1,8 +1,11 @@
package mg

import (
"fmt"
hmnz "github.com/dustin/go-humanize"
"margo.sh/vfs"
"path/filepath"
"strings"
)

var (
@@ -20,21 +23,29 @@ func (vc *vfsCmd) Reduce(mx *Ctx) *State {
mx.VFS.Invalidate(v.Name)
mx.VFS.Invalidate(v.Filename())
case RunCmd:
return mx.AddBuiltinCmds(BuiltinCmd{
Name: ".vfs",
Desc: "Print a tree representing the default VFS",
Run: vc.run,
})
return mx.AddBuiltinCmds(
BuiltinCmd{
Name: ".vfs",
Desc: "Print a tree representing the default VFS",
Run: func(cx *CmdCtx) *State {
go vc.cmdVfs(cx)
return cx.State
},
},
BuiltinCmd{
Name: ".vfs-blobs",
Desc: "Print a list, and summary of, blobs (file contents) cached in the VFS.",
Run: func(cx *CmdCtx) *State {
go vc.cmdVfsBlobs(cx)
return cx.State
},
},
)
}
return mx.State
}

func (vc *vfsCmd) run(cx *CmdCtx) *State {
go vc.cmd(cx)
return cx.State
}

func (vc *vfsCmd) cmd(cx *CmdCtx) {
func (vc *vfsCmd) cmdVfs(cx *CmdCtx) {
defer cx.Output.Close()

if len(cx.Args) == 0 {
@@ -59,6 +70,29 @@ func (vc *vfsCmd) cmd(cx *CmdCtx) {
}
}

func (vc *vfsCmd) cmdVfsBlobs(cx *CmdCtx) {
defer cx.Output.Close()

files := int64(0)
size := uint64(0)
cx.VFS.PrintWithFilter(cx.Output, func(nd *vfs.Node) string {
if nd.IsBranch() {
return nd.String()
}
nm := []string{}
for _, b := range vfs.Blobs(nd) {
files++
sz := uint64(b.Len())
size += sz
nm = append(nm, fmt.Sprintf("%s (%s)", nd.String(), hmnz.IBytes(sz)))
}
return strings.Join(nm, ", ")
})
fmt.Fprintf(cx.Output, "\n%s files (%s) cached in memory.",
hmnz.Comma(files), hmnz.IBytes(size),
)
}

func init() {
DefaultReducers.Before(&vfsCmd{})
}

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit 8265060

Please sign in to comment.
You can’t perform that action at this time.