Skip to content

Commit 724a683

Browse files
committed
fix some go errors/warnings
1 parent 6791d87 commit 724a683

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

wavesrv/pkg/cmdrunner/cmdrunner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ func CrCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.Up
15911591
if noHist {
15921592
screen, err := sstore.GetScreenById(ctx, ids.ScreenId)
15931593
if err != nil {
1594-
return nil, fmt.Errorf("/% error: cannot resolve screen for update: %w", err)
1594+
return nil, fmt.Errorf("/%s error: cannot resolve screen for update: %w", GetCmdStr(pk), err)
15951595
}
15961596
update := &sstore.ModelUpdate{
15971597
Screens: []*sstore.ScreenType{screen},

wavesrv/pkg/cmdrunner/shparse_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
"fmt"
88
"os"
99
"testing"
10+
11+
"github.com/wavetermdev/waveterm/wavesrv/pkg/rtnstate"
1012
)
1113

1214
func xTestParseAliases(t *testing.T) {
13-
m, err := ParseAliases(`
15+
m, err := rtnstate.ParseAliases(`
1416
alias cdg='cd work/gopath/src/github.com/sawka'
1517
alias s='scripthaus'
1618
alias x='ls;ls"'
@@ -29,7 +31,7 @@ func xTestParseFuncs(t *testing.T) {
2931
if err != nil {
3032
t.Fatalf("error reading linux-decls: %v", err)
3133
}
32-
m, err := ParseFuncs(string(file))
34+
m, err := rtnstate.ParseFuncs(string(file))
3335
if err != nil {
3436
t.Fatalf("error parsing funcs: %v", err)
3537
}

wavesrv/pkg/comp/comp_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ import (
77
"fmt"
88
"strings"
99
"testing"
10+
11+
"github.com/wavetermdev/waveterm/wavesrv/pkg/utilfn"
1012
)
1113

12-
func parseToSP(s string) StrWithPos {
14+
func parseToSP(s string) utilfn.StrWithPos {
1315
idx := strings.Index(s, "[*]")
1416
if idx == -1 {
15-
return StrWithPos{Str: s}
17+
return utilfn.StrWithPos{Str: s}
1618
}
17-
return StrWithPos{Str: s[0:idx] + s[idx+3:], Pos: idx}
19+
return utilfn.StrWithPos{Str: s[0:idx] + s[idx+3:], Pos: idx}
1820
}
1921

2022
func testParse(cmdStr string, pos int) {
21-
fmt.Printf("cmd: %s\n", strWithCursor(cmdStr, pos))
22-
p := ParseCompPoint(StrWithPos{Str: cmdStr, Pos: pos})
23+
fmt.Printf("cmd: %s\n", utilfn.StrWithPos{Str: cmdStr, Pos: pos})
24+
p := ParseCompPoint(utilfn.StrWithPos{Str: cmdStr, Pos: pos})
2325
p.dump()
2426
}
2527

@@ -64,9 +66,9 @@ func Test2(t *testing.T) {
6466
testMiniExtend(t, p, "foo's", true, `$'foo\'s[*]more`)
6567
}
6668

67-
func testParseRT(t *testing.T, origSP StrWithPos) {
69+
func testParseRT(t *testing.T, origSP utilfn.StrWithPos) {
6870
p := ParseCompPoint(origSP)
69-
newSP := StrWithPos{Str: p.getOrigStr(), Pos: p.getOrigPos()}
71+
newSP := utilfn.StrWithPos{Str: p.getOrigStr(), Pos: p.getOrigPos()}
7072
if origSP != newSP {
7173
t.Fatalf("not equal: [%s] != [%s]", origSP, newSP)
7274
}

0 commit comments

Comments
 (0)