• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gookit / goutil / 40157136773
87%

Build:
DEFAULT BRANCH: master
Ran 25 Oct 2026 03:09AM UTC
Jobs 6
Files 225
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Oct 2026 03:08AM UTC coverage: 87.311% (-0.006%) from 87.317%
40157136773

push

github

inhere
fix(maputil): reject negative slice indexes when setting a value

The set path parsed the slice index with `strconv.Atoi` and dropped the error,
so a negative index panicked instead of returning an error - the same bug that
#294 fixed on the get side:

  maputil.SetByPath(&mp, "list.-1", "x")   // panic: reflect: slice index out of range
  maputil.SetByPath(&mp, "app.list[-1]", "x") // same, bracket syntax
  maputil.MakeByPath("tags[-1]", "v")      // same, when it makes the slice value

- add parseIndexKey(), which rejects a non-numeric and a negative index, and
  use it at the three places that read an index from the key path
- setMapByKeys() returns an error for a negative bracket index instead of
  slicing with it, so the map data is left unchanged
- MakeByKeys() keeps a negative index as a literal key, it can not return an
  error

The Config.Set() of gookit/config goes through maputil.SetByKeys(), so it
inherits the fix as well.

Tests: the negative index key, the bracket syntax and MakeByPath cases, plus a
positive case for an index key, the bracket syntax and a grown slice.

16 of 22 new or added lines in 2 files covered. (72.73%)

1 existing line in 1 file now uncovered.

16087 of 18425 relevant lines covered (87.31%)

5.64 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
62.4
0.93% maputil/setval.go

Coverage Regressions

Lines Coverage ∆ File
1
62.4
0.93% maputil/setval.go
Jobs
ID Job ID Ran Files Coverage
1 Go-1.19 - 40157136773.1 25 Oct 2026 03:09AM UTC 220
86.67
GitHub Action Run
2 Go-stable - 40157136773.2 25 Oct 2026 03:09AM UTC 225
83.99
GitHub Action Run
3 Go-1.23 - 40157136773.3 25 Oct 2026 03:09AM UTC 225
85.62
GitHub Action Run
4 Go-1.24 - 40157136773.4 25 Oct 2026 03:09AM UTC 225
84.86
GitHub Action Run
5 Go-1.21 - 40157136773.5 25 Oct 2026 03:09AM UTC 220
86.67
GitHub Action Run
6 Go-1.25 - 40157136773.6 25 Oct 2026 03:09AM UTC 225
84.86
GitHub Action Run
Source Files on build 40157136773
  • Tree
  • List 225
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 475295af on github
  • Prev Build on master (#40156510080)
  • Next Build on master (#40188095025)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc