Skip to content

secfixes: restructure to support line numbers

Kevin Daudt requested to merge secfixes-restructure into master

For linting purposes, it's nice to have line numbers available for each element. In the old setup, this is impossible to record due to 2 issues:

  1. The structure of a map of lists of lists does not have a place to include any line numbers. It would be possible to keep track of a line number while iterating secfixes, but that would always be a relative file number, as the secfix section is part of a larger APKBUILD file, and
  2. The order of a map in go is random, so the order in which you get entries back does not correspond to the order of secfixes.

Conveniently, the yaml library we use provides a MapSlice type, which can be used to decode a yaml mapping, while keeping the order. But to get absolute line numbers, we need to be able to store the line numbers inline. This means we need to be able store more fields then just a mapping of lists of lists allows.

So let's switch to proper structures to support this. This is a backwards incompatible change.

Merge request reports