Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: improved newgtlds.go, removed replace-between.
Previously the `tools/newgtlds.go` utility was difficult to use with the new Github action based pull-request workflow because it _always_ updated the timestamp in the header comment in the gTLD section of `public_suffix_list.dat` when it was run, even if no gTLD data changed. This meant there was a diff in the workdir after the tool ran that would cause a PR to be opened by the action. In the old travis version of the automation I used some gross shell-fu to exclude the header comment when deciding if there was a diff or not. With the new action it's not possible to change how the diff status is determined, it's a matter of `git diff` saying there's a diff locally after the script runs or not. E.g. we need the script to be idempotent when there's no true data change. To do this I reworked `newgtlds.go` to be able to consume the existing `public_suffix_list.dat` in order to be able to determine if there is a data change or not. If there's no change in the data specifically then the file is left untouched. If there is a change then the file is updated and only then is the header comment with the date stamp updated along with the new data. Conveniently this also lets us remove the `tools/replace-between` Perl script reducing the number of languages in play for this process.
- Loading branch information