Skip to content

Commit b01e25c

Browse files
authored
Merge pull request #458 from walles/johan/go-1.27
Bump Go to 1.27
2 parents e17f72d + 59defc8 commit b01e25c

25 files changed

Lines changed: 93 additions & 132 deletions

‎cmd/moor/alt-screen_test.go‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ func TestLongInputUsesAlternateScreen(t *testing.T) {
1919
t.Run(fmt.Sprintf("fromPipe=%t", fromPipe), func(t *testing.T) {
2020
options := moorOptions{answerBackgroundQuery: true}
2121
if fromPipe {
22-
hundredLines := textLines(100)
23-
options.stdin = &hundredLines
22+
options.stdin = new(textLines(100))
2423
} else {
2524
options.args = []string{createTextFile(t, 100)}
2625
}
@@ -119,8 +118,7 @@ func TestQuitIfOneScreenNeverEntersAlternateScreen(t *testing.T) {
119118
args: []string{"--quit-if-one-screen"},
120119
}
121120
if fromPipe {
122-
twoLines := "hello world 1\nhello world 2\n"
123-
options.stdin = &twoLines
121+
options.stdin = new("hello world 1\nhello world 2\n")
124122
} else {
125123
options.args = append(options.args, createTextFile(t, 2))
126124
}
@@ -170,8 +168,7 @@ func TestQuitIfOneScreenNeverEntersAlternateScreenWhenHighlighted(t *testing.T)
170168
args: []string{"--quit-if-one-screen"},
171169
}
172170
if fromPipe {
173-
lines := jsonLines(lineCount, marker)
174-
options.stdin = &lines
171+
options.stdin = new(jsonLines(lineCount, marker))
175172
} else {
176173
options.args = append(options.args, createSourceFile(t, lineCount, marker))
177174
}

‎cmd/moor/moor.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,7 @@ func pagerFromArgs(
628628

629629
pager.TargetLine = targetLine
630630
if *follow && pager.TargetLine == nil {
631-
reallyHigh := linemetadata.IndexMax()
632-
pager.TargetLine = &reallyHigh
631+
pager.TargetLine = new(linemetadata.IndexMax())
633632
}
634633

635634
return pager, screen, style, &formatter, logsRequested, nil

‎cmd/moor/plusparser.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,13 @@ func parseLineNumber(withoutPlus string) *linemetadata.Index {
5959
lineNumber = 1
6060
}
6161

62-
targetIndex := linemetadata.IndexFromOneBased(int(lineNumber))
63-
return &targetIndex
62+
return new(linemetadata.IndexFromOneBased(int(lineNumber)))
6463
}
6564

6665
func parseSearchPattern(withoutPlus string) *string {
6766
if !strings.HasPrefix(withoutPlus, "/") {
6867
return nil
6968
}
7069

71-
pattern := withoutPlus[1:]
72-
return &pattern
70+
return new(withoutPlus[1:])
7371
}

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/walles/moor/v2
22

3-
go 1.25.0
3+
go 1.27.0
44

55
require (
66
github.com/adrg/xdg v0.5.3

‎internal/editor.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ func middleVisibleLine(p *Pager) *linemetadata.Index {
118118
return nil
119119
}
120120

121-
middle := lines[len(lines)/2].inputLineIndex
122-
return &middle
121+
return new(lines[len(lines)/2].inputLineIndex)
123122
}
124123

125124
// check if the editor can accept "+LINENUMBER" argument

‎internal/file-switching_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ func TestIssue426SwitchingToSmallerFileClearsStaleScrollPosition(t *testing.T) {
2525

2626
// This matches the stale post-switch state from issue #426: the reader has
2727
// moved to a shorter file, but the scroll position still points below it.
28-
staleIndex := linemetadata.IndexFromZeroBased(70)
29-
staleIndexPtr := &staleIndex
3028
pager.scrollPosition = scrollPosition{
3129
internalDontTouch: scrollPositionInternal{
32-
lineIndex: staleIndexPtr,
30+
lineIndex: new(linemetadata.IndexFromZeroBased(70)),
3331
delta: 0,
3432
name: "Issue 426 stale file switch",
3533
},

‎internal/filteringReader_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ func BenchmarkFilterHugeFile(b *testing.B) {
5959
input := reader.NewFromTextForTesting("BenchmarkFilterHugeFile()", text)
6060
assert.NilError(b, input.Wait())
6161

62-
filterTerm := search.For("Periodic")
6362
fr := FilteringReader{
6463
BackingReader: input,
65-
Filter: &filterTerm,
64+
Filter: new(search.For("Periodic")),
6665
}
6766
fr.rebuildCache() // warmup
6867

‎internal/pager.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ func NewPager(readers ...*reader.ReaderImpl) *Pager {
263263
Filter: &pager.filter,
264264
}
265265

266-
searchHistory := BootSearchHistory("")
267-
pager.searchHistory = &searchHistory
266+
pager.searchHistory = new(BootSearchHistory(""))
268267

269268
return &pager
270269
}
@@ -471,8 +470,7 @@ func (p *Pager) handleScrolledUp() {
471470
func (p *Pager) handleScrolledDown() {
472471
if p.isScrolledToEnd() {
473472
// Follow output
474-
reallyHigh := linemetadata.IndexMax()
475-
p.setTargetLine(&reallyHigh)
473+
p.setTargetLine(new(linemetadata.IndexMax()))
476474
} else {
477475
p.setTargetLine(nil)
478476
}

‎internal/pager_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,7 @@ func TestHandleMoreLinesAvailableWithEmptyFile(t *testing.T) {
772772
pager := NewPager(emptyReader)
773773

774774
// Simulate --follow mode by setting target to max
775-
targetLine := linemetadata.IndexMax()
776-
pager.TargetLine = &targetLine
775+
pager.TargetLine = new(linemetadata.IndexMax())
777776

778777
// This should not crash when lineCount is 0
779778
pager.handleMoreLinesAvailable()

‎internal/pagermode-viewing.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,14 @@ func (m PagerModeViewing) onRune(char rune) {
173173
p.search.Clear()
174174

175175
// Searchers want to scan the whole file, start reading as much as we can
176-
reallyHigh := linemetadata.IndexMax()
177-
p.setTargetLine(&reallyHigh)
176+
p.setTargetLine(new(linemetadata.IndexMax()))
178177

179178
case '?':
180179
p.mode = NewPagerModeSearch(p, SearchDirectionBackward, p.scrollPosition)
181180
p.search.Clear()
182181

183182
// Searchers want to scan the whole file, start reading as much as we can
184-
reallyHigh := linemetadata.IndexMax()
185-
p.setTargetLine(&reallyHigh)
183+
p.setTargetLine(new(linemetadata.IndexMax()))
186184

187185
case '&':
188186
if !p.isShowingHelp {

0 commit comments

Comments
 (0)