diff --git a/.github/workflows/gs-ci.yml b/.github/workflows/gs-ci.yml index 9e7266ff..3f913ef6 100644 --- a/.github/workflows/gs-ci.yml +++ b/.github/workflows/gs-ci.yml @@ -4,7 +4,7 @@ jobs: margo-ci: strategy: matrix: - go-version: [1.12.x, 1.13.x] + go-version: [1.13.x, 1.14.x] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 27ad4754..f6d5ec37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ https://margo.sh/b/motd - Get notified when GoSublime has a new release. ## Changes +## 20.03.09 + +This release fixes a couple bugs: + +- GO111MODULE=off is set after building, in cases where GO111MODULE wasn't already set by the user. +- An update message is shown even when the local GoSublime version is greater than that reported by the server. + ## 20.03.01 This release fixes a margo build failure when upgrading to go1.14. diff --git a/gosubl/about.py b/gosubl/about.py index acd01390..757675a1 100644 --- a/gosubl/about.py +++ b/gosubl/about.py @@ -1,7 +1,7 @@ import re import sublime -TAG = '20.03.01-1' +TAG = '20.03.09-1' ANN = 'a'+TAG VERSION = 'r'+TAG VERSION_PAT = re.compile(r'\d{2}[.]\d{2}[.]\d{2}-\d+', re.IGNORECASE) diff --git a/src/margo.sh/.github/workflows/margo-ci.yml b/src/margo.sh/.github/workflows/margo-ci.yml index 10f12b9e..eb025212 100644 --- a/src/margo.sh/.github/workflows/margo-ci.yml +++ b/src/margo.sh/.github/workflows/margo-ci.yml @@ -4,7 +4,7 @@ jobs: margo-ci: strategy: matrix: - go-version: [1.12.x, 1.13.x] + go-version: [1.13.x, 1.14.x] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/src/margo.sh/extension-example/extension-example.go b/src/margo.sh/extension-example/extension-example.go index 6184b46f..61358165 100644 --- a/src/margo.sh/extension-example/extension-example.go +++ b/src/margo.sh/extension-example/extension-example.go @@ -17,7 +17,7 @@ func Margo(m mg.Args) { m.Use( // MOTD keeps you updated about new versions and important announcements // - // It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD` + // It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD (check for updates)` // // Interval can be set in order to enable automatic update fetching. // diff --git a/src/margo.sh/mg/motd.go b/src/margo.sh/mg/motd.go index d7a2f108..8463d59b 100644 --- a/src/margo.sh/mg/motd.go +++ b/src/margo.sh/mg/motd.go @@ -42,7 +42,7 @@ type motdState struct { // MOTD keeps you updated about new versions and important announcements // -// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD` +// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD (check for updates)` // // Interval can be set in order to enable automatic update fetching. // @@ -96,7 +96,7 @@ func (m *MOTD) Reduce(mx *Ctx) *State { case RunCmd: st = st.AddBuiltinCmds(BuiltinCmd{Name: "motd.sync", Run: m.motdSyncCmd}) case QueryUserCmds: - st = st.AddUserCmds(UserCmd{Title: "Sync MOTD", Name: "motd.sync"}) + st = st.AddUserCmds(UserCmd{Title: "Sync MOTD (check for updates)", Name: "motd.sync"}) case motdAct: m.msg = act.msg } @@ -179,14 +179,35 @@ func (m *MOTD) sync(mx *Ctx) error { return nil } +func (_ *MOTD) fmtTag(s string) (string, error) { + var y, m, d, n int + scanned, err := fmt.Sscanf(s, "%02d.%02d.%02d-%d", &y, &m, &d, &n) + if scanned < 4 { + _, err = fmt.Sscanf(s, "%02d.%02d.%02d", &y, &m, &d) + } + if err != nil { + return "", err + } + if n <= 0 { + n = 1 + } + return fmt.Sprintf("%02d.%02d.%02d-%d", y, m, d, n), nil +} + func (m *MOTD) dispatchMsg(mx *Ctx, ms motdState) { res := ms.Result act := motdAct{} ctag := mx.Editor.Client.Tag + srvTag, srvTagErr := m.fmtTag(res.Tag) + cliTag, cliTagErr := m.fmtTag(ctag) switch { case ctag == "": mx.Log.Println("motd: client tag is undefined; you might need to restart the editor") - case res.Tag != ctag: + case srvTagErr != nil: + mx.Log.Println("motd: cannot parse ser`ver tag:", srvTagErr) + case cliTagErr != nil: + mx.Log.Println("motd: cannot parse client tag:", cliTagErr) + case cliTag < srvTag: act.msg = res.Message } mx.Store.Dispatch(act) diff --git a/src/margo.sh/sublime/sublime.go b/src/margo.sh/sublime/sublime.go index fd27a854..fb95f754 100644 --- a/src/margo.sh/sublime/sublime.go +++ b/src/margo.sh/sublime/sublime.go @@ -51,6 +51,8 @@ func buildAction(c *cli.Context) error { pkg, err := extensionPkg() if modSet { os.Setenv("GO111MODULE", modWas) + } else { + os.Unsetenv("GO111MODULE") } if err == nil { fixExtPkg(pkg)