Skip to content

Commit bd0163d

Browse files
authored
Merge pull request #965 from DisposaBoy/next
Next
2 parents 96954d1 + 7b71488 commit bd0163d

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

.github/workflows/gs-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
margo-ci:
55
strategy:
66
matrix:
7-
go-version: [1.12.x, 1.13.x]
7+
go-version: [1.13.x, 1.14.x]
88
platform: [ubuntu-latest, macos-latest, windows-latest]
99
runs-on: ${{ matrix.platform }}
1010
steps:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ https://margo.sh/b/motd - Get notified when GoSublime has a new release.
1010

1111
## Changes
1212

13+
## 20.03.09
14+
15+
This release fixes a couple bugs:
16+
17+
- GO111MODULE=off is set after building, in cases where GO111MODULE wasn't already set by the user.
18+
- An update message is shown even when the local GoSublime version is greater than that reported by the server.
19+
1320
## 20.03.01
1421

1522
This release fixes a margo build failure when upgrading to go1.14.

gosubl/about.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
import sublime
33

4-
TAG = '20.03.01-1'
4+
TAG = '20.03.09-1'
55
ANN = 'a'+TAG
66
VERSION = 'r'+TAG
77
VERSION_PAT = re.compile(r'\d{2}[.]\d{2}[.]\d{2}-\d+', re.IGNORECASE)

src/margo.sh/.github/workflows/margo-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
margo-ci:
55
strategy:
66
matrix:
7-
go-version: [1.12.x, 1.13.x]
7+
go-version: [1.13.x, 1.14.x]
88
platform: [ubuntu-latest, macos-latest, windows-latest]
99
runs-on: ${{ matrix.platform }}
1010
steps:

src/margo.sh/extension-example/extension-example.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func Margo(m mg.Args) {
1717
m.Use(
1818
// MOTD keeps you updated about new versions and important announcements
1919
//
20-
// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD`
20+
// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD (check for updates)`
2121
//
2222
// Interval can be set in order to enable automatic update fetching.
2323
//

src/margo.sh/mg/motd.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type motdState struct {
4242

4343
// MOTD keeps you updated about new versions and important announcements
4444
//
45-
// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD`
45+
// It adds a new command `motd.sync` available via the UserCmd palette as `Sync MOTD (check for updates)`
4646
//
4747
// Interval can be set in order to enable automatic update fetching.
4848
//
@@ -96,7 +96,7 @@ func (m *MOTD) Reduce(mx *Ctx) *State {
9696
case RunCmd:
9797
st = st.AddBuiltinCmds(BuiltinCmd{Name: "motd.sync", Run: m.motdSyncCmd})
9898
case QueryUserCmds:
99-
st = st.AddUserCmds(UserCmd{Title: "Sync MOTD", Name: "motd.sync"})
99+
st = st.AddUserCmds(UserCmd{Title: "Sync MOTD (check for updates)", Name: "motd.sync"})
100100
case motdAct:
101101
m.msg = act.msg
102102
}
@@ -179,14 +179,35 @@ func (m *MOTD) sync(mx *Ctx) error {
179179
return nil
180180
}
181181

182+
func (_ *MOTD) fmtTag(s string) (string, error) {
183+
var y, m, d, n int
184+
scanned, err := fmt.Sscanf(s, "%02d.%02d.%02d-%d", &y, &m, &d, &n)
185+
if scanned < 4 {
186+
_, err = fmt.Sscanf(s, "%02d.%02d.%02d", &y, &m, &d)
187+
}
188+
if err != nil {
189+
return "", err
190+
}
191+
if n <= 0 {
192+
n = 1
193+
}
194+
return fmt.Sprintf("%02d.%02d.%02d-%d", y, m, d, n), nil
195+
}
196+
182197
func (m *MOTD) dispatchMsg(mx *Ctx, ms motdState) {
183198
res := ms.Result
184199
act := motdAct{}
185200
ctag := mx.Editor.Client.Tag
201+
srvTag, srvTagErr := m.fmtTag(res.Tag)
202+
cliTag, cliTagErr := m.fmtTag(ctag)
186203
switch {
187204
case ctag == "":
188205
mx.Log.Println("motd: client tag is undefined; you might need to restart the editor")
189-
case res.Tag != ctag:
206+
case srvTagErr != nil:
207+
mx.Log.Println("motd: cannot parse ser`ver tag:", srvTagErr)
208+
case cliTagErr != nil:
209+
mx.Log.Println("motd: cannot parse client tag:", cliTagErr)
210+
case cliTag < srvTag:
190211
act.msg = res.Message
191212
}
192213
mx.Store.Dispatch(act)

src/margo.sh/sublime/sublime.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func buildAction(c *cli.Context) error {
5151
pkg, err := extensionPkg()
5252
if modSet {
5353
os.Setenv("GO111MODULE", modWas)
54+
} else {
55+
os.Unsetenv("GO111MODULE")
5456
}
5557
if err == nil {
5658
fixExtPkg(pkg)

0 commit comments

Comments
 (0)